diff --git a/Calorimeter/CaloClusterCorrection/CaloClusterCorrection/CaloFillRectangularCluster.h b/Calorimeter/CaloClusterCorrection/CaloClusterCorrection/CaloFillRectangularCluster.h index 699410b9b5dd79ec9561ada3c00eaab7ddd98ad5..68f600d640339a2e3ca0b9d44296ba35f5614796 100755 --- a/Calorimeter/CaloClusterCorrection/CaloClusterCorrection/CaloFillRectangularCluster.h +++ b/Calorimeter/CaloClusterCorrection/CaloClusterCorrection/CaloFillRectangularCluster.h @@ -84,13 +84,6 @@ public: virtual void makeCorrection(const EventContext& ctx, xAOD::CaloCluster* cluster) const override; - - // Temp workaround to keep IsolationTools happy. - void makeCorrection(xAOD::CaloCluster* cluster) const - { - return makeCorrection (Gaudi::Hive::currentContext(), cluster); - } - /* * @brief Return the seed position of a cluster. * @param helper Sampling calculation helper object. diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCalo/DerivationFrameworkCalo/ClusterEnergyPerLayerDecorator.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCalo/DerivationFrameworkCalo/ClusterEnergyPerLayerDecorator.h index f39483f02c902ac0da1eeb43faa9de4ba53dbe83..309d1c4589944fa4c8dbb48ef37ee554763df415 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCalo/DerivationFrameworkCalo/ClusterEnergyPerLayerDecorator.h +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCalo/DerivationFrameworkCalo/ClusterEnergyPerLayerDecorator.h @@ -14,9 +14,8 @@ #include "AthenaBaseComps/AthAlgTool.h" #include "DerivationFrameworkInterfaces/IThinningTool.h" #include "DerivationFrameworkInterfaces/IAugmentationTool.h" - #include "xAODEgamma/EgammaFwd.h" - +#include "GaudiKernel/EventContext.h" #include "GaudiKernel/ToolHandle.h" class CaloFillRectangularCluster; @@ -45,8 +44,9 @@ namespace DerivationFramework { ToolHandle<CaloClusterCollectionProcessor> m_caloFillRectangularTool; CaloFillRectangularCluster *m_tool; std::string m_CellCollectionName; - - void decorateObject(const xAOD::Egamma*& egamma) const; + + void decorateObject(const EventContext& ctx, + const xAOD::Egamma* egamma) const; }; } diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCalo/src/ClusterEnergyPerLayerDecorator.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCalo/src/ClusterEnergyPerLayerDecorator.cxx index fb82b127204fdcac97630d264da9c87fcc900bbb..4bf6030d84fa9e8a1c21a9eeee5ea807eeabec89 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCalo/src/ClusterEnergyPerLayerDecorator.cxx +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCalo/src/ClusterEnergyPerLayerDecorator.cxx @@ -66,20 +66,27 @@ StatusCode DerivationFramework::ClusterEnergyPerLayerDecorator::finalize() // The decoration itself StatusCode DerivationFramework::ClusterEnergyPerLayerDecorator::addBranches() const { + + const EventContext& ctx=Gaudi::Hive::currentContext(); for (const std::string& SGkey : {m_SGKey_photons, m_SGKey_electrons}) { if (SGkey == "") continue; const xAOD::EgammaContainer *container(0); ATH_CHECK( evtStore()->retrieve(container, SGkey) ); - for (auto egamma : *container) - decorateObject(egamma); + for (auto egamma : *container){ + decorateObject(ctx, egamma); + } } - + return StatusCode::SUCCESS; } -void DerivationFramework::ClusterEnergyPerLayerDecorator::decorateObject(const xAOD::Egamma*& egamma) const{ - +void +DerivationFramework::ClusterEnergyPerLayerDecorator::decorateObject( + const EventContext& ctx, + const xAOD::Egamma* egamma) const +{ + if (not egamma or not egamma->caloCluster()) return; const CaloCellContainer* cellCont(0); @@ -88,17 +95,20 @@ void DerivationFramework::ClusterEnergyPerLayerDecorator::decorateObject(const x if (evtStore()->retrieve(cellCont,m_CellCollectionName).isFailure()) ATH_MSG_WARNING(m_CellCollectionName<< " not found"); else if (not egamma->author(xAOD::EgammaParameters::AuthorCaloTopo35) ) - { - egcClone = CaloClusterStoreHelper::makeCluster( cellCont, - egamma->caloCluster()->eta0(), - egamma->caloCluster()->phi0(), - egamma->caloCluster()->clusterSize()); - m_tool->makeCorrection(egcClone); + { + egcClone = + CaloClusterStoreHelper::makeCluster(cellCont, + egamma->caloCluster()->eta0(), + egamma->caloCluster()->phi0(), + egamma->caloCluster()->clusterSize()); + m_tool->makeCorrection(ctx, egcClone); } - for (unsigned int layer: m_layers) - egamma->auxdecor<float>(Form("E%dx%d_Lr%d", m_eta_size, m_phi_size, layer)) =\ + for (unsigned int layer: m_layers){ + egamma->auxdecor<float>( + Form("E%dx%d_Lr%d", m_eta_size, m_phi_size, layer)) = egcClone ? egcClone->energyBE(layer) : 0.; + } delete egcClone; }