diff --git a/Reconstruction/eflowRec/eflowRec/IPFBaseTool.h b/Reconstruction/eflowRec/eflowRec/IPFBaseTool.h index 2dd627e53ae0a450d03f659cb12240b7c9db102f..f5a3606d37be203b966c867475a5a10dee3a8934 100644 --- a/Reconstruction/eflowRec/eflowRec/IPFBaseTool.h +++ b/Reconstruction/eflowRec/eflowRec/IPFBaseTool.h @@ -14,7 +14,7 @@ class IPFBaseTool : virtual public IAlgTool { public: /** Execute method to use eflowCaloObjectContainer */ - virtual StatusCode execute(const eflowCaloObjectContainer&) = 0; + virtual StatusCode execute(eflowCaloObjectContainer&) = 0; DeclareInterfaceID(IPFBaseTool,1,0); diff --git a/Reconstruction/eflowRec/eflowRec/IPFClusterCollectionTool.h b/Reconstruction/eflowRec/eflowRec/IPFClusterCollectionTool.h index edee4b39164d5cd797ea3696e40404154f6c99f2..f6290fc686935ff89a2b881499371c1c3845c4f0 100644 --- a/Reconstruction/eflowRec/eflowRec/IPFClusterCollectionTool.h +++ b/Reconstruction/eflowRec/eflowRec/IPFClusterCollectionTool.h @@ -15,8 +15,8 @@ class IPFClusterCollectionTool : virtual public IAlgTool { public: /** Put all clusters into a temporary container - then we use this to calculate moments, some of which depend on configuration of nearby clusters */ - virtual std::unique_ptr<xAOD::CaloClusterContainer> execute(const eflowCaloObjectContainer& theEflowCaloObjectContainer, bool useNonModifiedClusters) = 0; - virtual std::unique_ptr<eflowRecClusterContainer> retrieve(const eflowCaloObjectContainer& theEflowCaloObjectContainer, bool useNonModifiedClusters) = 0; + virtual std::unique_ptr<xAOD::CaloClusterContainer> execute(eflowCaloObjectContainer& theEflowCaloObjectContainer, bool useNonModifiedClusters) = 0; + virtual std::unique_ptr<eflowRecClusterContainer> retrieve(eflowCaloObjectContainer& theEflowCaloObjectContainer, bool useNonModifiedClusters) = 0; DeclareInterfaceID(IPFClusterCollectionTool,1,0); diff --git a/Reconstruction/eflowRec/eflowRec/PFClusterCollectionTool.h b/Reconstruction/eflowRec/eflowRec/PFClusterCollectionTool.h index c9ebafdb0c3c8d3985ac04403f22240ae565fdc3..cae404d40e31da815b318bc0d6d95330789f624c 100644 --- a/Reconstruction/eflowRec/eflowRec/PFClusterCollectionTool.h +++ b/Reconstruction/eflowRec/eflowRec/PFClusterCollectionTool.h @@ -20,8 +20,8 @@ class PFClusterCollectionTool : public extends<AthAlgTool, IPFClusterCollectionT ~PFClusterCollectionTool() {}; StatusCode initialize(); - std::unique_ptr<xAOD::CaloClusterContainer> execute(const eflowCaloObjectContainer& theEflowCaloObjectContainer, bool useNonModifiedClusters); - std::unique_ptr<eflowRecClusterContainer> retrieve(const eflowCaloObjectContainer& theEflowCaloObjectContainer, bool useNonModifiedClusters); + std::unique_ptr<xAOD::CaloClusterContainer> execute(eflowCaloObjectContainer& theEflowCaloObjectContainer, bool useNonModifiedClusters); + std::unique_ptr<eflowRecClusterContainer> retrieve(eflowCaloObjectContainer& theEflowCaloObjectContainer, bool useNonModifiedClusters); StatusCode finalize(); }; diff --git a/Reconstruction/eflowRec/eflowRec/PFLCCalibTool.h b/Reconstruction/eflowRec/eflowRec/PFLCCalibTool.h index 630fcfe787913be6f56e4e79aab33ec68af836c9..954f3cddd716f7cf8956339030db8ff4a40fa4c8 100644 --- a/Reconstruction/eflowRec/eflowRec/PFLCCalibTool.h +++ b/Reconstruction/eflowRec/eflowRec/PFLCCalibTool.h @@ -28,7 +28,7 @@ class PFLCCalibTool : public extends<AthAlgTool, IPFBaseTool> { ~PFLCCalibTool() {} virtual StatusCode initialize() override; - virtual StatusCode execute(const eflowCaloObjectContainer& theEflowCaloObjectContainer) override; + virtual StatusCode execute(eflowCaloObjectContainer& theEflowCaloObjectContainer) override; virtual StatusCode finalize() override; private: diff --git a/Reconstruction/eflowRec/eflowRec/PFMomentCalculatorTool.h b/Reconstruction/eflowRec/eflowRec/PFMomentCalculatorTool.h index 325abc20449ae56c0b0eb734f710d675bea2e1a4..ad47f589ad715392094873cda91c1486fb5479b6 100644 --- a/Reconstruction/eflowRec/eflowRec/PFMomentCalculatorTool.h +++ b/Reconstruction/eflowRec/eflowRec/PFMomentCalculatorTool.h @@ -26,7 +26,7 @@ class PFMomentCalculatorTool : public extends<AthAlgTool, IPFBaseTool> { ~PFMomentCalculatorTool() {} virtual StatusCode initialize() override; - virtual StatusCode execute(const eflowCaloObjectContainer& theEflowCaloObjectContainer) override; + virtual StatusCode execute(eflowCaloObjectContainer& theEflowCaloObjectContainer) override; virtual StatusCode finalize() override; private: diff --git a/Reconstruction/eflowRec/eflowRec/eflowCaloObject.h b/Reconstruction/eflowRec/eflowRec/eflowCaloObject.h index c646362ceb700cf9e894642d324ef142a8eec9e6..17015c3b5f866c0e0a10edecca9ce299e2711ee5 100644 --- a/Reconstruction/eflowRec/eflowRec/eflowCaloObject.h +++ b/Reconstruction/eflowRec/eflowRec/eflowCaloObject.h @@ -18,7 +18,6 @@ PURPOSE: Calorimeter Object data class #include <vector> #include <memory> -#include <map> #include "AthLinks/ElementLink.h" class eflowRecCluster; @@ -33,26 +32,14 @@ An internal EDM object which stores information about systems of associated trac class eflowCaloObject { public: - eflowCaloObject() { m_eflowRecClusters.clear(); m_trackClusterLinks.clear(); m_eflowRecTracks.clear(); } + eflowCaloObject()=default; ~eflowCaloObject(); void addTrack(eflowRecTrack* track) { m_eflowRecTracks.push_back(track); } void addCluster(eflowRecCluster* cluster) { m_eflowRecClusters.push_back(cluster); } - void addTrackClusterLinks(std::vector<eflowTrackClusterLink*> trackClusterLink) { - for (unsigned int i=0; i<trackClusterLink.size(); ++i) { - addTrackClusterLink(trackClusterLink.at(i)); - } - } - void addTracks(std::vector<eflowRecTrack*> tracks) { - for (unsigned int i=0; i<tracks.size(); ++i) { - addTrack(tracks.at(i)); - } - } - void addClusters(std::vector<eflowRecCluster*> clusters) { - for (unsigned int i=0; i<clusters.size(); ++i) { - addCluster(clusters.at(i)); - } - } + void addTrackClusterLinks(const std::vector<eflowTrackClusterLink*> &trackClusterLink); + void addTracks(const std::vector<eflowRecTrack*> &tracks); + void addClusters(const std::vector<eflowRecCluster*> &clusters); /* For a specific eflowTrackClusterLink indicate whether or not it has been fully/partially subtracted by setting the energy ratio ** of subtracted cluster energy to original cluster enegry (first float). A value other than nan indicates it has been fully or partially subtracted. @@ -60,12 +47,14 @@ public: void setTrackClusterLinkSubtractionStatus(unsigned int index, std::pair<float,float> energyRatio_energyValPair) { m_trackClusterLinks[index].second = energyRatio_energyValPair; } /* Track accessor methods */ - eflowRecTrack* efRecTrack(int i) const { return m_eflowRecTracks[i]; } + const eflowRecTrack* efRecTrack(int i) const { return m_eflowRecTracks[i]; } + eflowRecTrack* efRecTrack(int i) { return m_eflowRecTracks[i]; } unsigned nTracks() const{ return m_eflowRecTracks.size(); } void clearTracks() { m_eflowRecTracks.clear(); } /* Cluster accessor methods */ - eflowRecCluster* efRecCluster(int i) const { return m_eflowRecClusters[i]; } + const eflowRecCluster* efRecCluster(int i) const { return m_eflowRecClusters[i]; } + eflowRecCluster* efRecCluster(int i) { return m_eflowRecClusters[i]; } unsigned nClusters() const{ return m_eflowRecClusters.size(); } void clearClusters() { m_eflowRecClusters.clear(); } diff --git a/Reconstruction/eflowRec/eflowRec/eflowRecCluster.h b/Reconstruction/eflowRec/eflowRec/eflowRecCluster.h index ff781c36793e08444d442b311d72418befc083f7..6b6ab81021dc1bb1de51b4a0186665f5480a96a8 100644 --- a/Reconstruction/eflowRec/eflowRec/eflowRecCluster.h +++ b/Reconstruction/eflowRec/eflowRec/eflowRecCluster.h @@ -86,9 +86,9 @@ public: { return m_cellsWeightMap; } - - int getClusterType(); - const bool& isTouchable() { return m_isTouchable; } + /** Specifies if we have a cluster mainly in ECAL, HCAL or FCAL */ + int getClusterType() const; + bool isTouchable() const { return m_isTouchable; } private: /** ENUM that defines calorimeter regions as ECAL, HCAL or FCAL */ @@ -109,8 +109,6 @@ private: ElementLink<xAOD::CaloClusterContainer> m_clusElementLink; bool m_isTouchable; - /** Specifies if we have a cluster mainly in ECAL, HCAL or FCAL */ - CalorimeterType m_calorimeterType; /* for EM mode, LC weight for cells are retrieved before doing any * subtraction; they will be used after subtraction */ diff --git a/Reconstruction/eflowRec/src/PFChargedFlowElementCreatorAlgorithm.cxx b/Reconstruction/eflowRec/src/PFChargedFlowElementCreatorAlgorithm.cxx index 62c5355b30c9a73ccd0e294625b60a8dd4cc0bda..7a595135794301b96d5475a7d4250541afb7b2ba 100644 --- a/Reconstruction/eflowRec/src/PFChargedFlowElementCreatorAlgorithm.cxx +++ b/Reconstruction/eflowRec/src/PFChargedFlowElementCreatorAlgorithm.cxx @@ -42,7 +42,7 @@ void PFChargedFlowElementCreatorAlgorithm::createChargedFlowElements(const eflow /* Loop over all tracks in the eflowCaloObject */ for (unsigned int iTrack = 0; iTrack < energyFlowCaloObject.nTracks(); ++iTrack) { - eflowRecTrack* efRecTrack = energyFlowCaloObject.efRecTrack(iTrack); + const eflowRecTrack* efRecTrack = energyFlowCaloObject.efRecTrack(iTrack); /* Skip tracks that haven't been subtracted */ if (!m_eOverPMode && !efRecTrack->isSubtracted()){continue;} diff --git a/Reconstruction/eflowRec/src/PFClusterCollectionTool.cxx b/Reconstruction/eflowRec/src/PFClusterCollectionTool.cxx index 6115eba2a362034de3f9e8b9e9f5f17994eb15c1..73b61d832d632058bd1ff1b958c204d2ecafa34b 100644 --- a/Reconstruction/eflowRec/src/PFClusterCollectionTool.cxx +++ b/Reconstruction/eflowRec/src/PFClusterCollectionTool.cxx @@ -14,12 +14,12 @@ StatusCode PFClusterCollectionTool::initialize(){ return StatusCode::SUCCESS; } -std::unique_ptr<eflowRecClusterContainer> PFClusterCollectionTool::retrieve(const eflowCaloObjectContainer& theEflowCaloObjectContainer, bool useNonModifiedClusters) { +std::unique_ptr<eflowRecClusterContainer> PFClusterCollectionTool::retrieve(eflowCaloObjectContainer& theEflowCaloObjectContainer, bool useNonModifiedClusters) { std::unique_ptr<eflowRecClusterContainer> result = std::make_unique<eflowRecClusterContainer>(); /* Loop over all eflowCaloObjects */ - for (const auto *thisEflowCaloObject : theEflowCaloObjectContainer){ + for (auto thisEflowCaloObject : theEflowCaloObjectContainer){ /* Add all clusters on the eflowCaloObject to the container */ unsigned int nClusters = thisEflowCaloObject->nClusters(); @@ -38,12 +38,12 @@ std::unique_ptr<eflowRecClusterContainer> PFClusterCollectionTool::retrieve(cons } -std::unique_ptr<xAOD::CaloClusterContainer> PFClusterCollectionTool::execute(const eflowCaloObjectContainer& theEflowCaloObjectContainer, bool useNonModifiedClusters) { +std::unique_ptr<xAOD::CaloClusterContainer> PFClusterCollectionTool::execute(eflowCaloObjectContainer& theEflowCaloObjectContainer, bool useNonModifiedClusters) { std::unique_ptr<xAOD::CaloClusterContainer> result = std::make_unique<xAOD::CaloClusterContainer>(SG::VIEW_ELEMENTS); /* Loop over all eflowCaloObjects */ - for (const auto *thisEflowCaloObject : theEflowCaloObjectContainer){ + for (auto thisEflowCaloObject : theEflowCaloObjectContainer){ /* Add all clusters on the eflowCaloObject to the container */ unsigned int nClusters = thisEflowCaloObject->nClusters(); diff --git a/Reconstruction/eflowRec/src/PFLCCalibTool.cxx b/Reconstruction/eflowRec/src/PFLCCalibTool.cxx index f748bbba6c7dba23019a189b27d040a8c0c238d3..cd617f1a298c484649306d6ddd4fa2977721399c 100644 --- a/Reconstruction/eflowRec/src/PFLCCalibTool.cxx +++ b/Reconstruction/eflowRec/src/PFLCCalibTool.cxx @@ -43,7 +43,7 @@ StatusCode PFLCCalibTool::initialize() { } -StatusCode PFLCCalibTool::execute(const eflowCaloObjectContainer& theEflowCaloObjectContainer) { +StatusCode PFLCCalibTool::execute(eflowCaloObjectContainer& theEflowCaloObjectContainer) { if (m_useLocalWeight) { std::unique_ptr<eflowRecClusterContainer> theEFRecClusterContainer = m_clusterCollectionTool->retrieve(theEflowCaloObjectContainer, true); diff --git a/Reconstruction/eflowRec/src/PFMomentCalculatorTool.cxx b/Reconstruction/eflowRec/src/PFMomentCalculatorTool.cxx index 618eba66b171294ab1e1d13ec82a283f67d86a34..4c87cfb1e2af753e21e07e980e49dfda5ddcc603 100644 --- a/Reconstruction/eflowRec/src/PFMomentCalculatorTool.cxx +++ b/Reconstruction/eflowRec/src/PFMomentCalculatorTool.cxx @@ -28,7 +28,7 @@ StatusCode PFMomentCalculatorTool::initialize(){ return StatusCode::SUCCESS; } -StatusCode PFMomentCalculatorTool::execute(const eflowCaloObjectContainer& theEflowCaloObjectContainer) { +StatusCode PFMomentCalculatorTool::execute(eflowCaloObjectContainer& theEflowCaloObjectContainer) { /* Collect all the clusters in a temporary container (with VIEW_ELEMENTS!) */ bool useNonModifiedClusters = true; diff --git a/Reconstruction/eflowRec/src/PFNeutralFlowElementCreatorAlgorithm.cxx b/Reconstruction/eflowRec/src/PFNeutralFlowElementCreatorAlgorithm.cxx index 3b2ff2bb12e00c4d69825357a3db38e6936f8d7a..ce334ed584778bdaffab2e830ed5d2f9bb45cfcd 100644 --- a/Reconstruction/eflowRec/src/PFNeutralFlowElementCreatorAlgorithm.cxx +++ b/Reconstruction/eflowRec/src/PFNeutralFlowElementCreatorAlgorithm.cxx @@ -55,7 +55,7 @@ PFNeutralFlowElementCreatorAlgorithm::createNeutralFlowElement( { for (unsigned int iCluster = 0; iCluster < energyFlowCaloObject.nClusters(); ++iCluster){ - eflowRecCluster* thisEfRecCluster = energyFlowCaloObject.efRecCluster(iCluster); + const eflowRecCluster* thisEfRecCluster = energyFlowCaloObject.efRecCluster(iCluster); /* Skip empty clusters (presumably subtraction remnants) */ const CaloClusterCellLink* theCellLink = energyFlowCaloObject.efRecCluster(iCluster)->getCluster()->getCellLinks(); diff --git a/Reconstruction/eflowRec/src/eflowCaloObject.cxx b/Reconstruction/eflowRec/src/eflowCaloObject.cxx index 2ead36092de37fde36ed277b0706a4d5cba666df..a502e61ff779c0bd5b1fcfee43a99c67c2f42e60 100644 --- a/Reconstruction/eflowRec/src/eflowCaloObject.cxx +++ b/Reconstruction/eflowRec/src/eflowCaloObject.cxx @@ -22,6 +22,19 @@ CREATED: 22nd November, 2004 eflowCaloObject::~eflowCaloObject() = default; +void eflowCaloObject::addTrackClusterLinks(const std::vector<eflowTrackClusterLink*> &trackClusterLink) { + for (auto *ptr : trackClusterLink) { + addTrackClusterLink(ptr); + } +} + + void eflowCaloObject::addTracks(const std::vector<eflowRecTrack*> &tracks) { + m_eflowRecTracks.insert(m_eflowRecTracks.end(), tracks.begin(), tracks.end()); + } + + void eflowCaloObject::addClusters(const std::vector<eflowRecCluster*> &clusters) { + m_eflowRecClusters.insert(m_eflowRecClusters.end(), clusters.begin(), clusters.end()); + } double eflowCaloObject::getExpectedEnergy() const { double expectedEnergy(0.0); diff --git a/Reconstruction/eflowRec/src/eflowRecCluster.cxx b/Reconstruction/eflowRec/src/eflowRecCluster.cxx index b811bff38a40d18afec1ab89c9a149bfd583656d..0d039a1a77292724dda7340070f37eb4ffd5d590 100644 --- a/Reconstruction/eflowRec/src/eflowRecCluster.cxx +++ b/Reconstruction/eflowRec/src/eflowRecCluster.cxx @@ -15,7 +15,7 @@ #include "xAODCaloEvent/CaloClusterKineHelper.h" eflowRecCluster::eflowRecCluster(const ElementLink<xAOD::CaloClusterContainer>& clusElementLink, xAOD::CaloClusterContainer& newClusContainer) : - m_clusterId(-1), m_originalClusElementLink(clusElementLink), m_isTouchable(false),m_calorimeterType(UNASSIGNED) , m_matchCluster(nullptr) { + m_clusterId(-1), m_originalClusElementLink(clusElementLink), m_isTouchable(false), m_matchCluster(nullptr) { const xAOD::CaloCluster* originalCluster = *clusElementLink; m_cluster = new xAOD::CaloCluster(); newClusContainer.push_back(m_cluster); @@ -42,7 +42,6 @@ eflowRecCluster::eflowRecCluster(const eflowRecCluster& originalEflowRecCluster) m_clusElementLink = originalEflowRecCluster.m_clusElementLink; m_originalClusElementLink = originalEflowRecCluster.m_originalClusElementLink; m_isTouchable = originalEflowRecCluster.m_isTouchable; - m_calorimeterType = originalEflowRecCluster.m_calorimeterType; m_matchCluster = std::make_unique<eflowMatchCluster>(this); } @@ -54,7 +53,6 @@ eflowRecCluster& eflowRecCluster::operator=(const eflowRecCluster& originalEflow m_clusElementLink = originalEflowRecCluster.m_clusElementLink; m_originalClusElementLink = originalEflowRecCluster.m_originalClusElementLink; m_isTouchable = originalEflowRecCluster.m_isTouchable; - m_calorimeterType = originalEflowRecCluster.m_calorimeterType; m_matchCluster = std::make_unique<eflowMatchCluster>(this); return *this; }//if not assigning to self, then we have copied the data to the new object @@ -95,10 +93,8 @@ double eflowRecCluster::getVarianceOfSumExpectedEnergy() { return varianceExpectedEnergy; } -int eflowRecCluster::getClusterType() { - if(m_calorimeterType!=UNASSIGNED) { - return m_calorimeterType; - } +int eflowRecCluster::getClusterType() const { + CaloClusterKineHelper::calculateKine(m_cluster, true, true); double EMB_E = m_cluster->eSample(xAOD::CaloCluster::CaloSample::PreSamplerB) @@ -134,18 +130,18 @@ int eflowRecCluster::getClusterType() { double ratioEM = (EMB_E+EME_E)/totalEnergy; double ratioHCAL = (HEC_E+Tile_E)/totalEnergy; double ratioFCAL = (FCAL_E + MiniFCAL_E)/totalEnergy; - + int calorimeterType = UNASSIGNED; if(ratioEM > 0.5) { - m_calorimeterType = ECAL; + calorimeterType = ECAL; } else if (ratioHCAL > 0.5) { - m_calorimeterType = HCAL; + calorimeterType = HCAL; } else if (ratioFCAL > 0.5) { - m_calorimeterType = FCAL; + calorimeterType = FCAL; } else { - m_calorimeterType = UNKNOWN; + calorimeterType = UNKNOWN; } - assert(m_calorimeterType!=UNASSIGNED); - return m_calorimeterType; + assert(calorimeterType!=UNASSIGNED); + return calorimeterType; }