diff --git a/Reconstruction/egamma/egammaAlgs/src/egammaForwardBuilder.cxx b/Reconstruction/egamma/egammaAlgs/src/egammaForwardBuilder.cxx index 3d415104545a589168ebc7e7f6162e8df780f38b..5c8ec70badd011bcea9c189073de67b02b51e341 100644 --- a/Reconstruction/egamma/egammaAlgs/src/egammaForwardBuilder.cxx +++ b/Reconstruction/egamma/egammaAlgs/src/egammaForwardBuilder.cxx @@ -8,6 +8,7 @@ #include "xAODCaloEvent/CaloClusterAuxContainer.h" #include "xAODCaloEvent/CaloCluster.h" #include "CaloDetDescr/CaloDetDescrManager.h" +#include "CaloUtils/CaloClusterStoreHelper.h" #include "xAODEgamma/ElectronContainer.h" #include "xAODEgamma/ElectronAuxContainer.h" @@ -97,11 +98,7 @@ StatusCode egammaForwardBuilder::execute(const EventContext& ctx) const ctx ); - ATH_CHECK(outClusterContainer.record( - std::make_unique<xAOD::CaloClusterContainer>(), - std::make_unique<xAOD::CaloClusterAuxContainer>() - )); - + ATH_CHECK(CaloClusterStoreHelper::AddContainerWriteHandle(outClusterContainer)); SG::WriteHandle<CaloClusterCellLinkContainer> outClusterContainerCellLink( m_outClusterContainerCellLinkKey, ctx diff --git a/Reconstruction/egamma/egammaAlgs/src/egammaSuperClusterBuilder.cxx b/Reconstruction/egamma/egammaAlgs/src/egammaSuperClusterBuilder.cxx index 7c1b7db9df268714f620e4bdfd7251401557c4cf..fe3b528e647c2a6dab934314c17472dfaec5a4c8 100644 --- a/Reconstruction/egamma/egammaAlgs/src/egammaSuperClusterBuilder.cxx +++ b/Reconstruction/egamma/egammaAlgs/src/egammaSuperClusterBuilder.cxx @@ -5,6 +5,7 @@ #include "egammaSuperClusterBuilder.h" #include "CaloDetDescr/CaloDetDescrManager.h" +#include "CaloUtils/CaloClusterStoreHelper.h" #include "StoreGate/ReadHandle.h" #include "StoreGate/WriteHandle.h" #include "xAODCaloEvent/CaloCluster.h" @@ -62,10 +63,9 @@ egammaSuperClusterBuilder::execute(const EventContext& ctx) const // Have to register cluster container in order to properly get cluster links. SG::WriteHandle<xAOD::CaloClusterContainer> outputClusterContainer( m_outputegammaSuperClustersKey, ctx); - ATH_CHECK(outputClusterContainer.record( - std::make_unique<xAOD::CaloClusterContainer>(), - std::make_unique<xAOD::CaloClusterAuxContainer>())); + ATH_CHECK(CaloClusterStoreHelper::AddContainerWriteHandle(outputClusterContainer)); + // Create the new egamma Super Cluster based EgammaRecContainer SG::WriteHandle<EgammaRecContainer> newEgammaRecs( m_egammaSuperRecCollectionKey, ctx); @@ -78,9 +78,7 @@ egammaSuperClusterBuilder::execute(const EventContext& ctx) const std::optional<SG::WriteHandle<xAOD::CaloClusterContainer>> precorrClustersH; if (!m_precorrClustersKey.empty()) { precorrClustersH.emplace(m_precorrClustersKey, ctx); - ATH_CHECK(precorrClustersH->record( - std::make_unique<xAOD::CaloClusterContainer>(), - std::make_unique<xAOD::CaloClusterAuxContainer>())); + ATH_CHECK(CaloClusterStoreHelper::AddContainerWriteHandle(*precorrClustersH)); precorrClustersH->ptr()->reserve(inputSize); } diff --git a/Reconstruction/egamma/egammaAlgs/src/electronSuperClusterBuilder.cxx b/Reconstruction/egamma/egammaAlgs/src/electronSuperClusterBuilder.cxx index 94375edd0593c59db6c9b3b871bff1b52c56a337..d29beba6c1546ec147f86153e1ed5b588cd1788d 100644 --- a/Reconstruction/egamma/egammaAlgs/src/electronSuperClusterBuilder.cxx +++ b/Reconstruction/egamma/egammaAlgs/src/electronSuperClusterBuilder.cxx @@ -5,6 +5,7 @@ #include "electronSuperClusterBuilder.h" // #include "CaloDetDescr/CaloDetDescrManager.h" +#include "CaloUtils/CaloClusterStoreHelper.h" #include "xAODCaloEvent/CaloCluster.h" #include "xAODCaloEvent/CaloClusterAuxContainer.h" #include "xAODEgamma/Egamma.h" @@ -70,9 +71,7 @@ electronSuperClusterBuilder::execute(const EventContext& ctx) const SG::WriteHandle<xAOD::CaloClusterContainer> outputClusterContainer( m_outputElectronSuperClustersKey, ctx); - ATH_CHECK(outputClusterContainer.record( - std::make_unique<xAOD::CaloClusterContainer>(), - std::make_unique<xAOD::CaloClusterAuxContainer>())); + ATH_CHECK(CaloClusterStoreHelper::AddContainerWriteHandle(outputClusterContainer)); // Create the new Electron Super Cluster based EgammaRecContainer SG::WriteHandle<EgammaRecContainer> newEgammaRecs( @@ -86,9 +85,7 @@ electronSuperClusterBuilder::execute(const EventContext& ctx) const std::optional<SG::WriteHandle<xAOD::CaloClusterContainer>> precorrClustersH; if (!m_precorrClustersKey.empty()) { precorrClustersH.emplace(m_precorrClustersKey, ctx); - ATH_CHECK(precorrClustersH->record( - std::make_unique<xAOD::CaloClusterContainer>(), - std::make_unique<xAOD::CaloClusterAuxContainer>())); + ATH_CHECK(CaloClusterStoreHelper::AddContainerWriteHandle(*precorrClustersH)); precorrClustersH->ptr()->reserve(inputSize); } diff --git a/Reconstruction/egamma/egammaAlgs/src/photonSuperClusterBuilder.cxx b/Reconstruction/egamma/egammaAlgs/src/photonSuperClusterBuilder.cxx index ed5be9f3ae36151a865c9ffa012da56f4abb28d9..606fc85d745c7b43446cc0a7cadddd04d073117d 100644 --- a/Reconstruction/egamma/egammaAlgs/src/photonSuperClusterBuilder.cxx +++ b/Reconstruction/egamma/egammaAlgs/src/photonSuperClusterBuilder.cxx @@ -5,6 +5,7 @@ #include "photonSuperClusterBuilder.h" #include "CaloDetDescr/CaloDetDescrManager.h" +#include "CaloUtils/CaloClusterStoreHelper.h" #include "xAODCaloEvent/CaloCluster.h" #include "xAODCaloEvent/CaloClusterAuxContainer.h" #include "xAODEgamma/EgammaEnums.h" @@ -62,9 +63,7 @@ photonSuperClusterBuilder::execute(const EventContext& ctx) const // Have to register cluster container in order to properly get cluster links. SG::WriteHandle<xAOD::CaloClusterContainer> outputClusterContainer( m_outputPhotonSuperClustersKey, ctx); - ATH_CHECK(outputClusterContainer.record( - std::make_unique<xAOD::CaloClusterContainer>(), - std::make_unique<xAOD::CaloClusterAuxContainer>())); + ATH_CHECK(CaloClusterStoreHelper::AddContainerWriteHandle(outputClusterContainer)); // Create the new Photon Super Cluster based EgammaRecContainer SG::WriteHandle<EgammaRecContainer> newEgammaRecs( @@ -78,9 +77,7 @@ photonSuperClusterBuilder::execute(const EventContext& ctx) const std::optional<SG::WriteHandle<xAOD::CaloClusterContainer>> precorrClustersH; if (!m_precorrClustersKey.empty()) { precorrClustersH.emplace(m_precorrClustersKey, ctx); - ATH_CHECK(precorrClustersH->record( - std::make_unique<xAOD::CaloClusterContainer>(), - std::make_unique<xAOD::CaloClusterAuxContainer>())); + ATH_CHECK(CaloClusterStoreHelper::AddContainerWriteHandle(*precorrClustersH)); precorrClustersH->ptr()->reserve(inputSize); } diff --git a/Reconstruction/egamma/egammaTools/src/EMClusterTool.cxx b/Reconstruction/egamma/egammaTools/src/EMClusterTool.cxx index 093e390672eb3f01d6147e72ed324de972655076..8cc602c10c9f1be2154df442edf4d026580e5cf3 100644 --- a/Reconstruction/egamma/egammaTools/src/EMClusterTool.cxx +++ b/Reconstruction/egamma/egammaTools/src/EMClusterTool.cxx @@ -54,9 +54,7 @@ EMClusterTool::contExecute(const EventContext& ctx, SG::WriteHandle<xAOD::CaloClusterContainer> outputClusterContainer( m_outputClusterContainerKey, ctx); - ATH_CHECK(outputClusterContainer.record( - std::make_unique<xAOD::CaloClusterContainer>(), - std::make_unique<xAOD::CaloClusterAuxContainer>())); + ATH_CHECK(CaloClusterStoreHelper::AddContainerWriteHandle(outputClusterContainer)); SG::WriteHandle<CaloClusterCellLinkContainer> outputClusterContainerCellLink( m_outputClusterContainerCellLinkKey, ctx);