diff --git a/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedInDetExtensionAlg.cxx b/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedInDetExtensionAlg.cxx index c0c80680cf15c20143b0ede49c7b3a1b9980ef5e..7c1300ffbc1709bbd8147fa2b8abf1b0550c8eae 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedInDetExtensionAlg.cxx +++ b/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedInDetExtensionAlg.cxx @@ -7,7 +7,7 @@ #include "MuonCombinedEvent/MuonCandidateCollection.h" MuonCombinedInDetExtensionAlg::MuonCombinedInDetExtensionAlg(const std::string& name, ISvcLocator* pSvcLocator) - : AthAlgorithm(name, pSvcLocator) { + : AthReentrantAlgorithm(name, pSvcLocator) { } StatusCode @@ -31,10 +31,10 @@ MuonCombinedInDetExtensionAlg::initialize() } StatusCode -MuonCombinedInDetExtensionAlg::execute() +MuonCombinedInDetExtensionAlg::execute(const EventContext& ctx) const { - SG::ReadHandle<InDetCandidateCollection> indetCandidateCollection(m_indetCandidateCollectionName); + SG::ReadHandle<InDetCandidateCollection> indetCandidateCollection(m_indetCandidateCollectionName, ctx); if (!indetCandidateCollection.isValid()) { ATH_MSG_ERROR("Could not read " << m_indetCandidateCollectionName); return StatusCode::FAILURE; @@ -45,7 +45,7 @@ MuonCombinedInDetExtensionAlg::execute() for (const MuonCombined::InDetCandidate* candidate : *indetCandidateCollection) ATH_MSG_VERBOSE(candidate->toString()); - SG::WriteHandle<MuonCombined::InDetCandidateToTagMap> tagMap(m_tagMap); + SG::WriteHandle<MuonCombined::InDetCandidateToTagMap> tagMap(m_tagMap, ctx); ATH_CHECK(tagMap.record(std::make_unique<MuonCombined::InDetCandidateToTagMap>())); TrackCollection* combTracks = nullptr; @@ -53,50 +53,52 @@ MuonCombinedInDetExtensionAlg::execute() Trk::SegmentCollection* segments = nullptr; if (m_combTracks.key() != "") { - SG::WriteHandle<TrackCollection> wh_combTracks(m_combTracks); + SG::WriteHandle<TrackCollection> wh_combTracks(m_combTracks, ctx); ATH_CHECK(wh_combTracks.record(std::make_unique<TrackCollection>())); combTracks = wh_combTracks.ptr(); } if (m_METracks.key() != "") { - SG::WriteHandle<TrackCollection> wh_meTracks(m_METracks); + SG::WriteHandle<TrackCollection> wh_meTracks(m_METracks, ctx); ATH_CHECK(wh_meTracks.record(std::make_unique<TrackCollection>())); meTracks = wh_meTracks.ptr(); } if (m_segments.key() != "") { - SG::WriteHandle<Trk::SegmentCollection> wh_segs(m_segments); + SG::WriteHandle<Trk::SegmentCollection> wh_segs(m_segments, ctx); ATH_CHECK(wh_segs.record(std::make_unique<Trk::SegmentCollection>())); segments = wh_segs.ptr(); } if (m_usePRDs) { MuonCombined::IMuonCombinedInDetExtensionTool::MuonPrdData prdData; - SG::ReadHandle<Muon::MdtPrepDataContainer> mdtPRDContainer(m_MDT_ContainerName); + SG::ReadHandle<Muon::MdtPrepDataContainer> mdtPRDContainer(m_MDT_ContainerName, ctx); prdData.mdtPrds = mdtPRDContainer.cptr(); if (m_hasCSC) { - SG::ReadHandle<Muon::CscPrepDataContainer> cscPRDContainer(m_CSC_ContainerName); + SG::ReadHandle<Muon::CscPrepDataContainer> cscPRDContainer(m_CSC_ContainerName, ctx); prdData.cscPrds = cscPRDContainer.cptr(); } if (m_hasSTGC && m_hasMM) { - SG::ReadHandle<Muon::sTgcPrepDataContainer> stgcPRDContainer(m_sTGC_ContainerName); - SG::ReadHandle<Muon::MMPrepDataContainer> mmPRDContainer(m_MM_ContainerName); + SG::ReadHandle<Muon::sTgcPrepDataContainer> stgcPRDContainer(m_sTGC_ContainerName, ctx); + SG::ReadHandle<Muon::MMPrepDataContainer> mmPRDContainer(m_MM_ContainerName, ctx); prdData.stgcPrds = stgcPRDContainer.cptr(); prdData.mmPrds = mmPRDContainer.cptr(); } - SG::ReadHandle<Muon::RpcPrepDataContainer> rpcPRDContainer(m_RPC_ContainerName); + SG::ReadHandle<Muon::RpcPrepDataContainer> rpcPRDContainer(m_RPC_ContainerName, ctx); prdData.rpcPrds = rpcPRDContainer.cptr(); - SG::ReadHandle<Muon::TgcPrepDataContainer> tgcPRDContainer(m_TGC_ContainerName); + SG::ReadHandle<Muon::TgcPrepDataContainer> tgcPRDContainer(m_TGC_ContainerName, ctx); prdData.tgcPrds = tgcPRDContainer.cptr(); - for (auto& tool : m_muonCombinedInDetExtensionTools) + for (auto& tool : m_muonCombinedInDetExtensionTools) { tool->extendWithPRDs(*indetCandidateCollection, tagMap.ptr(), prdData, combTracks, meTracks, segments); + } } else { - for (auto& tool : m_muonCombinedInDetExtensionTools) + for (auto& tool : m_muonCombinedInDetExtensionTools) { tool->extend(*indetCandidateCollection, tagMap.ptr(), combTracks, meTracks, segments); + } } //Clean up at the end of execute for (auto& tool : m_muonCombinedInDetExtensionTools) { - tool->cleanUp(); + tool->cleanUp(); } return StatusCode::SUCCESS; diff --git a/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedInDetExtensionAlg.h b/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedInDetExtensionAlg.h index 593a9cd97715219b4125022f2540424ef667b6d7..0d88f16967fba66153edbbeadbae905f9b35a8c0 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedInDetExtensionAlg.h +++ b/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedInDetExtensionAlg.h @@ -6,7 +6,7 @@ #define MUONCOMBINEDALGS_MUONCOMBINEDINDETEXTENSIONALG_H -#include "AthenaBaseComps/AthAlgorithm.h" +#include "AthenaBaseComps/AthReentrantAlgorithm.h" #include "GaudiKernel/ToolHandle.h" #include "MuonCombinedEvent/InDetCandidateCollection.h" #include "MuonCombinedEvent/InDetCandidateToTagMap.h" @@ -20,13 +20,13 @@ #include <string> -class MuonCombinedInDetExtensionAlg : public AthAlgorithm { +class MuonCombinedInDetExtensionAlg : public AthReentrantAlgorithm { public: MuonCombinedInDetExtensionAlg(const std::string& name, ISvcLocator* pSvcLocator); ~MuonCombinedInDetExtensionAlg()=default; StatusCode initialize(); - StatusCode execute(); + StatusCode execute(const EventContext& ctx) const; private: ToolHandleArray<MuonCombined::IMuonCombinedInDetExtensionTool> m_muonCombinedInDetExtensionTools{this,"MuonCombinedInDetExtensionTools",{}};