diff --git a/Reconstruction/eflowRec/eflowRec/PFClusterSelector.h b/Reconstruction/eflowRec/eflowRec/PFClusterSelector.h deleted file mode 100644 index 5df3fd6fb94f45f28026e1ed42eddc53c6e1bacb..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/eflowRec/PFClusterSelector.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef PFCLUSTERSELECTOR_H -#define PFCLUSTERSELECTOR_H - -#include "AthenaBaseComps/AthAlgorithm.h" -#include "GaudiKernel/ToolHandle.h" -#include "xAODCaloEvent/CaloClusterContainer.h" - -#include <map> - -class eflowRecClusterContainer; - -class PFClusterSelector : public AthAlgorithm { - -public: - /** Default constructor */ - PFClusterSelector(const std::string& name, ISvcLocator* pSvcLocator); - /** Default destructor */ - ~PFClusterSelector() {}; - - /** Gaudi AthAlgorithm hooks */ - StatusCode initialize(); - StatusCode execute(); - StatusCode finalize(); - -private: - /** for EM mode, LC weight for cells are retrieved before doing any subtraction; they will be used after subtraction */ - void retrieveLCCalCellWeight(const double& energy, const unsigned& index, std::map<IdentifierHash,double>& cellsWeight,const xAOD::CaloClusterContainer& caloCalClustersContainer); - - /** ReadHandleKey for the CaloClusterContainer to be used as input */ - SG::ReadHandleKey<xAOD::CaloClusterContainer> m_caloClustersReadHandleKey{this,"clustersName","CaloTopoCluster","ReadHandleKey for the CaloClusterContainer to be used as input"}; - - /** ReadHandleKey for the CaloClusterContainer, at LC scale, to be used as input */ - SG::ReadHandleKey<xAOD::CaloClusterContainer> m_caloCalClustersReadHandleKey{this,"calClustersName","CaloCalTopoClusters","ReadHandleKey for the CaloClusterContainer, at LC scale, to be used as input"}; - - /** WriteHandleKey for the eflowRecClusterContainer to write out */ - SG::WriteHandleKey<eflowRecClusterContainer> m_eflowRecClustersWriteHandleKey{this,"eflowRecClustersOutputName","eflowRecClusters","WriteHandleKey for the eflowRecClusterContainer to write out"}; - - - -}; -#endif diff --git a/Reconstruction/eflowRec/src/PFClusterSelector.cxx b/Reconstruction/eflowRec/src/PFClusterSelector.cxx deleted file mode 100644 index 2b2b7d640b30cb474dc51f7cc41ad470071828ce..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/src/PFClusterSelector.cxx +++ /dev/null @@ -1,113 +0,0 @@ -#include "CaloDetDescr/CaloDetDescrManager.h" -#include "CaloIdentifier/CaloCell_ID.h" -#include "eflowRec/eflowRecCluster.h" -#include "eflowRec/PFClusterSelector.h" -#include "xAODCaloEvent/CaloCluster.h" - -PFClusterSelector::PFClusterSelector(const std::string& name, ISvcLocator* pSvcLocator): - AthAlgorithm(name, pSvcLocator) -{ -} - -StatusCode PFClusterSelector::initialize(){ - - ATH_CHECK(m_caloClustersReadHandleKey.initialize()); - ATH_CHECK(m_caloCalClustersReadHandleKey.initialize()); - - ATH_CHECK(m_eflowRecClustersWriteHandleKey.initialize()); - - return StatusCode::SUCCESS; -} - -StatusCode PFClusterSelector::execute(){ - - SG::ReadHandle<xAOD::CaloClusterContainer> caloClustersReadHandle(m_caloClustersReadHandleKey); - - /* Verify the read handle has a valid pointer, and if not return */ - if (!caloClustersReadHandle.isValid()){ - ATH_MSG_WARNING(" Invalid ReadHandle for xAOD::CaloCluster with key: " << caloClustersReadHandle.key()); - return StatusCode::SUCCESS; - } - /* Record the eflowRecCluster output container */ - SG::WriteHandle<eflowRecClusterContainer> eflowRecClustersWriteHandle(m_eflowRecClustersWriteHandleKey); - ATH_CHECK(eflowRecClustersWriteHandle.record(std::make_unique<eflowRecClusterContainer>())); - - SG::ReadHandle<xAOD::CaloClusterContainer> caloCalClustersReadHandle(m_caloCalClustersReadHandleKey); - - /* Fill the vector of eflowRecClusters */ - unsigned int nClusters = caloClustersReadHandle->size(); - for (unsigned int iCluster = 0; iCluster < nClusters; ++iCluster) { - /* Create the eflowRecCluster and put it in the container */ - std::unique_ptr<eflowRecCluster> thisEFRecCluster = std::make_unique<eflowRecCluster>(ElementLink<xAOD::CaloClusterContainer>(*caloClustersReadHandle, iCluster)); - - if (caloCalClustersReadHandle.isValid()){ - std::map<IdentifierHash,double> cellsWeightMap; - retrieveLCCalCellWeight(caloClustersReadHandle->at(iCluster)->e(), iCluster, cellsWeightMap, *caloCalClustersReadHandle); - - if (msgLvl(MSG::DEBUG)) { - //zhangr - std::map<IdentifierHash, double>::iterator it = cellsWeightMap.begin(); - for (; it != cellsWeightMap.end(); ++it) { - ATH_MSG_DEBUG("zhangrui eflowPreparation " << iCluster << "/" << nClusters << ": e=" - << caloClustersReadHandle->at(iCluster)->e() << " (" << it->first << " " - << it->second << ")"); - } - } - - thisEFRecCluster->setCellsWeight(cellsWeightMap); - } - - thisEFRecCluster->setClusterId(iCluster); - eflowRecClustersWriteHandle->push_back(std::move(thisEFRecCluster)); - - if (msgLvl(MSG::DEBUG)) { - const xAOD::CaloCluster* thisCluster = caloClustersReadHandle->at(iCluster); - ATH_MSG_DEBUG("eflowPreparation clus = " << thisCluster->eta() << " " << thisCluster->phi() << " " << thisCluster->e()/cosh(thisCluster->eta())); - } - } - - return StatusCode::SUCCESS; -} - -StatusCode PFClusterSelector::finalize(){ - return StatusCode::SUCCESS; -} - -void PFClusterSelector::retrieveLCCalCellWeight(const double& energy, const unsigned& index, std::map<IdentifierHash,double>& cellsWeight, const xAOD::CaloClusterContainer& caloCalClustersContainer) { - - /* match CaloCluster with CaloCalCluster to obtain cell weight */ - /* first try the position at 'index'. If we are lucky, the loop can be avoided. */ - /* Note the read handle has been tested to be valid prior to the call of this function */ - const xAOD::CaloCluster* matchedCalCluster = caloCalClustersContainer.at(index); - - if (matchedCalCluster){ - - if (!(fabs(energy - matchedCalCluster->rawE()) < 0.001)) { - matchedCalCluster = nullptr; - for (unsigned iCalCalCluster = 0; iCalCalCluster < caloCalClustersContainer.size(); - ++iCalCalCluster) { - matchedCalCluster = caloCalClustersContainer.at(iCalCalCluster); - if (fabs(energy - matchedCalCluster->rawE()) < 0.001) { - break; - } - } - if (!matchedCalCluster) ATH_MSG_WARNING("Invalid pointer to matched cluster - failed to find cluster match"); - } - assert(matchedCalCluster); - - /* obtain cell index and cell weight */ - const CaloDetDescrManager* calo_dd_man = CaloDetDescrManager::instance(); - const CaloCell_ID* calo_id = calo_dd_man->getCaloCell_ID(); - xAOD::CaloCluster::const_cell_iterator itCell = matchedCalCluster->cell_begin(); - xAOD::CaloCluster::const_cell_iterator endCell = matchedCalCluster->cell_end(); - for (; itCell != endCell; ++itCell) { - const CaloCell* pCell = *itCell; - Identifier myId = pCell->ID(); - IdentifierHash myHashId = calo_id->calo_cell_hash(myId); - cellsWeight[myHashId] = itCell.weight(); - } - } - else ATH_MSG_WARNING("Invalid pointer to matched cluster - could not look up local hadron cell weights"); - - return ; -} diff --git a/Reconstruction/eflowRec/src/components/eflowRec_entries.cxx b/Reconstruction/eflowRec/src/components/eflowRec_entries.cxx index 666e12792c5b331ec2bebe705bc97900301acd3c..2c67c74c56d629ed0bd4384c9bc33b1a00514939 100644 --- a/Reconstruction/eflowRec/src/components/eflowRec_entries.cxx +++ b/Reconstruction/eflowRec/src/components/eflowRec_entries.cxx @@ -7,7 +7,6 @@ #include "eflowRec/eflowOverlapRemoval.h" #include "eflowRec/PFLeptonSelector.h" #include "eflowRec/PFTrackSelector.h" -#include "eflowRec/PFClusterSelector.h" #include "eflowRec/PFClusterSelectorTool.h" #include "eflowRec/PFAlgorithm.h" #include "eflowRec/PFCellLevelSubtractionTool.h" @@ -21,7 +20,6 @@ DECLARE_COMPONENT( eflowOverlapRemoval ) DECLARE_COMPONENT( PFLeptonSelector ) -DECLARE_COMPONENT( PFClusterSelector ) DECLARE_COMPONENT( PFClusterSelectorTool ) DECLARE_COMPONENT( PFTrackSelector ) DECLARE_COMPONENT( PFAlgorithm )