diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/MuonHoughPatternFinderTool.h b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/MuonHoughPatternFinderTool.h index f2c9902b558b31a91a0ad865d6230802fba9167a..fde49f390d61e434c2a410cf31eeabc18589d5bd 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/MuonHoughPatternFinderTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/MuonHoughPatternFinderTool.h @@ -51,7 +51,7 @@ namespace Muon { const std::vector<const CscPrepDataCollection*>& cscCols, const std::vector<const TgcPrepDataCollection*>& tgcCols, const std::vector<const RpcPrepDataCollection*>& rpcCols, - const MuonSegmentCombinationCollection* cscSegmentCombis ) const; + const MuonSegmentCombinationCollection* cscSegmentCombis, const EventContext& ctx ) const; private: @@ -70,13 +70,13 @@ namespace Muon { /** analyse hits */ MuonPatternCombinationCollection* analyse( const MuonHoughHitContainer& hitcontainer, - const std::map <const Trk::PrepRawData*, std::set<const Trk::PrepRawData*,Muon::IdentifierPrdLess> >* phietahitassociation ) const; + const std::map <const Trk::PrepRawData*, std::set<const Trk::PrepRawData*,Muon::IdentifierPrdLess> >* phietahitassociation, const EventContext& ctx ) const; private: /** record patterncollection to storegate or deletes collection when m_recordAllOutput is false */ - void record(const MuonPrdPatternCollection* patCol, const SG::WriteHandleKey<MuonPrdPatternCollection>& key ) const; + void record(const MuonPrdPatternCollection* patCol, const SG::WriteHandleKey<MuonPrdPatternCollection>& key, const EventContext &ctx ) const; /** convert and add rpc preprawdata collection (1 chamber) */ diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/MuonLayerHoughTool.h b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/MuonLayerHoughTool.h index 28bc66cf3bab33a0bfd2f1d9483b57ea9a9c95e8..21a139279b043bf61064627a9be936af6abc493f 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/MuonLayerHoughTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/MuonLayerHoughTool.h @@ -126,7 +126,7 @@ namespace Muon { const TgcPrepDataContainer* tgcCont, const RpcPrepDataContainer* rpcCont, const sTgcPrepDataContainer* stgcCont, - const MMPrepDataContainer* mmCont ) const; + const MMPrepDataContainer* mmCont, const EventContext& ctx ) const; /** find patterns for a give set of MuonPrepData collections + optionally CSC segment combinations */ virtual std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<HoughDataPerSectorVec>> @@ -134,7 +134,7 @@ namespace Muon { const std::vector<const CscPrepDataCollection*>& cscCols, const std::vector<const TgcPrepDataCollection*>& tgcCols, const std::vector<const RpcPrepDataCollection*>& rpcCols, - const MuonSegmentCombinationCollection* ) const override; + const MuonSegmentCombinationCollection*, const EventContext& ctx ) const override; void reset() const; @@ -219,7 +219,7 @@ namespace Muon { void matchTruth( std::set<Identifier>& truthHits, const PRD_MultiTruthCollection& truthCol, const Identifier& id, MuonHough::HitDebugInfo& debug ) const; void initializeSectorMapping(const MuonGM::MuonDetectorManager* detMgr); - void getTruth() const; + void getTruth(const EventContext& ctx) const; void printTruthSummary( std::set<Identifier>& truth, std::set<Identifier>& found ) const; void buildRoads(MaximumVec& seedMaxima, MuonHough::MuonDetectorHough& detectorHoughTransforms, diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonHoughPatternFinderTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonHoughPatternFinderTool.cxx index 48e72d3ae0d245b8e7eda0c6dd0c34d8351bc304..6b864b6b3c047a6383a89a6b26e2da0d5ddd35c0 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonHoughPatternFinderTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonHoughPatternFinderTool.cxx @@ -77,7 +77,7 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo const std::vector<const CscPrepDataCollection*>& cscCols, const std::vector<const TgcPrepDataCollection*>& tgcCols, const std::vector<const RpcPrepDataCollection*>& rpcCols, - const MuonSegmentCombinationCollection* cscSegmentCombis ) const { + const MuonSegmentCombinationCollection* cscSegmentCombis, const EventContext& ctx) const { /** map between mdt chamber identifiers and corresponding rpc hits (hit_no_begin and hit_no_end)*/ std::map<int,std::vector<std::pair<int, int> > > rpcmdtstationmap; @@ -93,7 +93,7 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo // analyse data std::unique_ptr<MuonPatternCombinationCollection> patCombiCol; if( hitcontainer ) { - patCombiCol.reset(analyse( *hitcontainer, phietahitassociation.get())); + patCombiCol.reset(analyse( *hitcontainer, phietahitassociation.get(), ctx)); }else{ ATH_MSG_INFO (" No hit container created! "); } @@ -142,7 +142,7 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo return StatusCode::SUCCESS; } - MuonPatternCombinationCollection* MuonHoughPatternFinderTool::analyse( const MuonHoughHitContainer& hitcontainer, const std::map <const Trk::PrepRawData*, std::set<const Trk::PrepRawData*,Muon::IdentifierPrdLess> >* phietahitassociation ) const { + MuonPatternCombinationCollection* MuonHoughPatternFinderTool::analyse( const MuonHoughHitContainer& hitcontainer, const std::map <const Trk::PrepRawData*, std::set<const Trk::PrepRawData*,Muon::IdentifierPrdLess> >* phietahitassociation, const EventContext& ctx ) const { ATH_MSG_DEBUG ("size of event: " << hitcontainer.size()); @@ -182,9 +182,9 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo combinedpatterns = new MuonPrdPatternCollection(); } - record( phipatterns, m_CosmicPhiPatternsKey ); - record( etapatterns, m_CosmicEtaPatternsKey ); - record( combinedpatterns, m_COMBINED_PATTERNSKey ); + record( phipatterns, m_CosmicPhiPatternsKey, ctx ); + record( etapatterns, m_CosmicEtaPatternsKey, ctx ); + record( combinedpatterns, m_COMBINED_PATTERNSKey, ctx ); /** empty and clear the houghpattern vectors */ m_muonHoughPatternTool->reset(houghpattern); @@ -386,7 +386,7 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo } // getAllHits - void MuonHoughPatternFinderTool::record( const MuonPrdPatternCollection* patCol, const SG::WriteHandleKey<MuonPrdPatternCollection> &key ) const { + void MuonHoughPatternFinderTool::record( const MuonPrdPatternCollection* patCol, const SG::WriteHandleKey<MuonPrdPatternCollection> &key, const EventContext &ctx ) const { if( !patCol ) { ATH_MSG_WARNING ("Zero pointer, could not save patterns!!! "); @@ -401,7 +401,7 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo delete patCol; } else { - SG::WriteHandle<MuonPrdPatternCollection> handle(key); + SG::WriteHandle<MuonPrdPatternCollection> handle(key, ctx); StatusCode sc = handle.record(std::unique_ptr<MuonPrdPatternCollection>(const_cast<MuonPrdPatternCollection*> (patCol))); if ( sc.isFailure() ){ ATH_MSG_WARNING ("Could not save patterns at " << key.key()); diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughAlg.cxx b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughAlg.cxx index 3af1848b5ddbfe1c5aa5e25810e6c6e3db8d0a77..09240564a70eb61b33ad41d82807dc11d55245ce 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughAlg.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughAlg.cxx @@ -12,7 +12,7 @@ #include "MuonPrepRawData/MMPrepDataCollection.h" MuonLayerHoughAlg::MuonLayerHoughAlg(const std::string& name, ISvcLocator* pSvcLocator): - AthAlgorithm(name,pSvcLocator) + AthReentrantAlgorithm(name,pSvcLocator) { } @@ -36,17 +36,17 @@ StatusCode MuonLayerHoughAlg::initialize() return StatusCode::SUCCESS; } -StatusCode MuonLayerHoughAlg::execute() +StatusCode MuonLayerHoughAlg::execute(const EventContext& ctx) const { - const Muon::RpcPrepDataContainer* rpcPrds = GetObject(m_keyRpc); - const Muon::MdtPrepDataContainer* mdtPrds = GetObject(m_keyMdt); - const Muon::TgcPrepDataContainer* tgcPrds = GetObject(m_keyTgc); - const Muon::CscPrepDataContainer* cscPrds = m_keyCsc.empty() ? nullptr : GetObject(m_keyCsc); - const Muon::sTgcPrepDataContainer* stgcPrds = m_keysTgc.empty() ? nullptr : GetObject(m_keysTgc); - const Muon::MMPrepDataContainer* mmPrds = m_keyMM.empty() ? nullptr : GetObject(m_keyMM); + const Muon::RpcPrepDataContainer* rpcPrds = GetObject(m_keyRpc, ctx); + const Muon::MdtPrepDataContainer* mdtPrds = GetObject(m_keyMdt, ctx); + const Muon::TgcPrepDataContainer* tgcPrds = GetObject(m_keyTgc, ctx); + const Muon::CscPrepDataContainer* cscPrds = m_keyCsc.empty() ? nullptr : GetObject(m_keyCsc, ctx); + const Muon::sTgcPrepDataContainer* stgcPrds = m_keysTgc.empty() ? nullptr : GetObject(m_keysTgc, ctx); + const Muon::MMPrepDataContainer* mmPrds = m_keyMM.empty() ? nullptr : GetObject(m_keyMM, ctx); ATH_MSG_VERBOSE("calling layer tool "); - auto [combis, houghDataPerSectorVec] = m_layerTool->analyse(mdtPrds,cscPrds,tgcPrds,rpcPrds,stgcPrds,mmPrds); - SG::WriteHandle<MuonPatternCombinationCollection> Handle(m_combis); + auto [combis, houghDataPerSectorVec] = m_layerTool->analyse(mdtPrds,cscPrds,tgcPrds,rpcPrds,stgcPrds,mmPrds, ctx); + SG::WriteHandle<MuonPatternCombinationCollection> Handle(m_combis, ctx); if( combis ){ if (Handle.record(std::move(combis)).isFailure()) { ATH_MSG_WARNING("Failed to record MuonPatternCombinationCollection at MuonLayerHoughCombis"); @@ -63,7 +63,7 @@ StatusCode MuonLayerHoughAlg::execute() } // write hough data to SG - SG::WriteHandle<Muon::MuonLayerHoughTool::HoughDataPerSectorVec> handle {m_houghDataPerSectorVecKey}; + SG::WriteHandle<Muon::MuonLayerHoughTool::HoughDataPerSectorVec> handle {m_houghDataPerSectorVecKey, ctx}; if (houghDataPerSectorVec) { ATH_CHECK(handle.record(std::move(houghDataPerSectorVec))); } diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughAlg.h b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughAlg.h index db207f44375d9c84ba4b29dd7c0b1e682baa727a..d3a0fcf3222af006f1634fd45e1d4d727b229b6c 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughAlg.h +++ b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughAlg.h @@ -5,12 +5,12 @@ #ifndef MUONLAYERHOUGHALG_H #define MUONLAYERHOUGHALG_H -#include "AthenaBaseComps/AthAlgorithm.h" +#include "AthenaBaseComps/AthReentrantAlgorithm.h" #include "GaudiKernel/ToolHandle.h" #include "MuonHoughPatternTools/MuonLayerHoughTool.h" #include "MuonRecHelperTools/MuonEDMPrinterTool.h" -class MuonLayerHoughAlg : public AthAlgorithm +class MuonLayerHoughAlg : public AthReentrantAlgorithm { public: MuonLayerHoughAlg(const std::string& name, ISvcLocator* pSvcLocator); @@ -18,12 +18,12 @@ class MuonLayerHoughAlg : public AthAlgorithm virtual ~MuonLayerHoughAlg() = default; virtual StatusCode initialize() override; - virtual StatusCode execute() override; + virtual StatusCode execute(const EventContext& ctx) const override; virtual StatusCode finalize() override; private: template<class T> - const T* GetObject(SG::ReadHandleKey<T> &key); + const T* GetObject(const SG::ReadHandleKey<T> &key, const EventContext& ctx) const; SG::ReadHandleKey<Muon::TgcPrepDataContainer> m_keyTgc{this,"TgcPrepDataContainer","TGC_Measurements"}; SG::ReadHandleKey<Muon::RpcPrepDataContainer> m_keyRpc{this,"RpcPrepDataContainer","RPC_Measurements"}; @@ -42,8 +42,8 @@ class MuonLayerHoughAlg : public AthAlgorithm template<class T> -const T* MuonLayerHoughAlg::GetObject(SG::ReadHandleKey<T> &key){ - SG::ReadHandle<T> handle( key); +const T* MuonLayerHoughAlg::GetObject(const SG::ReadHandleKey<T> &key, const EventContext& ctx) const{ + SG::ReadHandle<T> handle( key, ctx); if( handle.isPresent() && !handle.isValid()) { ATH_MSG_WARNING("MuonLayerHoughAlg Cannot retrieve " << handle.key() ); return nullptr; diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughTool.cxx index 7544613cd3b07ac3e4b0d3a248074c962ea8754c..63f0e8b7e9531a9a2a37d246092bc7d01f4c2586 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughTool.cxx @@ -149,9 +149,9 @@ namespace Muon { return StatusCode::SUCCESS; } - void MuonLayerHoughTool::getTruth() const { + void MuonLayerHoughTool::getTruth(const EventContext& ctx) const { if(m_ntuple){ - SG::ReadHandle<xAOD::TruthParticleContainer> truthMuons(m_MuonTruthParticlesKey); + SG::ReadHandle<xAOD::TruthParticleContainer> truthMuons(m_MuonTruthParticlesKey, ctx); if (truthMuons.isValid()) { ATH_MSG_DEBUG("Retrieved truth muons " << truthMuons->size()); int nmuons = 0; @@ -173,7 +173,7 @@ namespace Muon { ++nmuons; } m_ntuple->nmuons = nmuons; - SG::ReadHandle<xAOD::MuonSegmentContainer> truthSegments(m_MuonTruthSegmentsKey); + SG::ReadHandle<xAOD::MuonSegmentContainer> truthSegments(m_MuonTruthSegmentsKey, ctx); if (truthSegments.isValid()) { ATH_MSG_DEBUG("Retrieved truth Segments " << truthSegments->size()); int nsegs = 0; @@ -208,12 +208,12 @@ namespace Muon { const std::vector<const CscPrepDataCollection*>& , const std::vector<const TgcPrepDataCollection*>& tgcCols, const std::vector<const RpcPrepDataCollection*>& rpcCols, - const MuonSegmentCombinationCollection* ) const + const MuonSegmentCombinationCollection*, const EventContext& ctx ) const -> std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<HoughDataPerSectorVec>> { reset(); State state; ATH_MSG_DEBUG("MuonLayerHoughTool::find"); - if( m_doTruth ) getTruth(); + if( m_doTruth ) getTruth(ctx); // create structure to hold data per sector and set the sector indices @@ -280,12 +280,12 @@ namespace Muon { const TgcPrepDataContainer* tgcCont, const RpcPrepDataContainer* rpcCont, const sTgcPrepDataContainer* stgcCont, - const MMPrepDataContainer* mmCont ) const + const MMPrepDataContainer* mmCont, const EventContext& ctx ) const -> std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<HoughDataPerSectorVec>> { reset(); State state; ATH_MSG_DEBUG("MuonLayerHoughTool::analyse"); - if( m_doTruth ) getTruth(); + if( m_doTruth ) getTruth(ctx); state.houghDataPerSectorVec->vec.resize(16); diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces/MuonRecToolInterfaces/IMuonHoughPatternFinderTool.h b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces/MuonRecToolInterfaces/IMuonHoughPatternFinderTool.h index ba0280e3a571853d1d1796124462025bf01fbfa2..a704dcbfd627466e3f5d4d776beb1b14d612acde 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces/MuonRecToolInterfaces/IMuonHoughPatternFinderTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces/MuonRecToolInterfaces/IMuonHoughPatternFinderTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUON_IMUONHOUGHPATTERNFINDERTOOL_H @@ -40,7 +40,7 @@ namespace Muon { const std::vector<const CscPrepDataCollection*>& cscCols, const std::vector<const TgcPrepDataCollection*>& tgcCols, const std::vector<const RpcPrepDataCollection*>& rpcCols, - const MuonSegmentCombinationCollection* cscSegmentCombis ) const = 0; + const MuonSegmentCombinationCollection* cscSegmentCombis, const EventContext& ctx ) const = 0; }; diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentCombinationFinder.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentCombinationFinder.cxx index 9b31d8a01faea7ae80e0bbf1e231a9419bd85b4b..8d4a1a8116b8af910bb6c00d62fba3fa6d726109 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentCombinationFinder.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentCombinationFinder.cxx @@ -105,7 +105,7 @@ Muon::MooSegmentCombinationFinder::findSegments(const std::vector<const MdtPrepD const std::vector<const CscPrepDataCollection*>& cscCols, const std::vector<const TgcPrepDataCollection*>& tgcCols, const std::vector<const RpcPrepDataCollection*>& rpcCols, - Muon::IMooSegmentCombinationFinder::Output& output) const + Muon::IMooSegmentCombinationFinder::Output& output, const EventContext& ctx) const { // Super tool has various different stages. // 1. 2d Csc segment making, which produces MuonSegmentCombinations that are passed to the 4D segment maker, and the @@ -145,7 +145,7 @@ Muon::MooSegmentCombinationFinder::findSegments(const std::vector<const MdtPrepD if (m_doMdtSegments) { // search for global patterns auto [combis, houghData] = - m_houghPatternFinder->find(mdtCols, cscCols, tgcCols, rpcCols, csc4dSegmentCombinations.get()); + m_houghPatternFinder->find(mdtCols, cscCols, tgcCols, rpcCols, csc4dSegmentCombinations.get(), ctx); output.patternCombinations = combis.release(); output.houghDataPerSectorVec = std::move(houghData); printSummary("Pattern finding", output.patternCombinations); diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentCombinationFinder.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentCombinationFinder.h index 0552dbf6a3f20fdcb78331522dd700b50a9b3a26..c048518a8b5c1e32b2f6389bef88fa4e40e994a0 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentCombinationFinder.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentCombinationFinder.h @@ -65,7 +65,7 @@ class MooSegmentCombinationFinder : virtual public IMooSegmentCombinationFinder, const std::vector<const CscPrepDataCollection*>& cscCols, const std::vector<const TgcPrepDataCollection*>& tgcCols, const std::vector<const RpcPrepDataCollection*>& rpcCols, - IMooSegmentCombinationFinder::Output& output) const; + IMooSegmentCombinationFinder::Output& output, const EventContext& ctx) const; private: /** helper functions to print summary output for the different stages */ diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentFinderAlg.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentFinderAlg.cxx index dc8c4fe1707398cb645499259645417d7d794e56..b63dc2e7a5a5b17155e4d416de548701f100ac4f 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentFinderAlg.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentFinderAlg.cxx @@ -97,7 +97,7 @@ MooSegmentFinderAlg::execute(const EventContext& ctx) const SG::WriteHandle<MuonPatternCombinationCollection> patHandle(m_patternCombiLocation, ctx); - m_segmentFinder->findSegments(mdtCols, cscCols, tgcCols, rpcCols, output); + m_segmentFinder->findSegments(mdtCols, cscCols, tgcCols, rpcCols, output, ctx); if (output.patternCombinations) { if (patHandle.record(std::unique_ptr<MuonPatternCombinationCollection>(output.patternCombinations)).isSuccess()) diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonSegmentCombinerToolInterfaces/MuonSegmentCombinerToolInterfaces/IMooSegmentCombinationFinder.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonSegmentCombinerToolInterfaces/MuonSegmentCombinerToolInterfaces/IMooSegmentCombinationFinder.h index 7551c0b331fb5ed72a255b030c0bf66a47f0629c..1ba58e6d2212aaa57c4e5c05f2bc3984ab4241e0 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonSegmentCombinerToolInterfaces/MuonSegmentCombinerToolInterfaces/IMooSegmentCombinationFinder.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonSegmentCombinerToolInterfaces/MuonSegmentCombinerToolInterfaces/IMooSegmentCombinationFinder.h @@ -43,7 +43,7 @@ namespace Muon const std::vector<const CscPrepDataCollection*>& cscCols, const std::vector<const TgcPrepDataCollection*>& tgcCols, const std::vector<const RpcPrepDataCollection*>& rpcCols, - Output& output) const = 0; + Output& output, const EventContext& ctx) const = 0; }; diff --git a/Trigger/TrigAlgorithms/TrigMuSuperEF/src/TrigMuSuperEF.cxx b/Trigger/TrigAlgorithms/TrigMuSuperEF/src/TrigMuSuperEF.cxx index 5aaf35b9b998eba0a519fc273cdac16878a1a8ab..dcecd4429a918e7ec49a186372e1f26ec6558298 100644 --- a/Trigger/TrigAlgorithms/TrigMuSuperEF/src/TrigMuSuperEF.cxx +++ b/Trigger/TrigAlgorithms/TrigMuSuperEF/src/TrigMuSuperEF.cxx @@ -844,8 +844,9 @@ HLT::ErrorCode TrigMuSuperEF::runCaloTagOnly(const HLT::TriggerElement* inputTE, HLT::ErrorCode TrigMuSuperEF::runMSReconstruction(const IRoiDescriptor* muonRoI, HLT::TriggerElement* TEout, MuonCandidateCollection& muonCandidates, std::unique_ptr<xAOD::MuonContainer>& muonContainerOwn) { ATH_MSG_DEBUG("Call getExtrapolatedTracks"); - // Use standalone track tool to find muon candidates - HLT::ErrorCode hltStatus = m_TrigMuonEF_saTrackTool->getExtrapolatedTracks(muonRoI, muonCandidates, *m_extrTrkTrackColl, m_TMEF_monVars, m_TMEF_SATimers); + // Use standalone track tool to find muon candidate + const EventContext& ctx = getContext(); + HLT::ErrorCode hltStatus = m_TrigMuonEF_saTrackTool->getExtrapolatedTracks(muonRoI, muonCandidates, *m_extrTrkTrackColl, m_TMEF_monVars, m_TMEF_SATimers, ctx); // only bail out in case of real problem. So still attach features if no muon found: important for caching! if ( hltStatus != HLT::OK && hltStatus != HLT::MISSING_FEATURE ) return hltStatus; @@ -933,7 +934,8 @@ HLT::ErrorCode TrigMuSuperEF::runSegmentTaggedOnly(const HLT::TriggerElement* in ATH_MSG_ERROR("Problem getting ID tracks"); return hltStatus; } - hltStatus = m_TrigMuonEF_saTrackTool->getSegments(muonRoI, m_TMEF_monVars, m_TMEF_STTimers); + const EventContext& ctx = getContext(); + hltStatus = m_TrigMuonEF_saTrackTool->getSegments(muonRoI, m_TMEF_monVars, m_TMEF_STTimers, ctx); InDetCandidateCollection inDetCandidates; buildInDetCandidates(elv_xaodidtrks, &inDetCandidates); @@ -1059,7 +1061,8 @@ HLT::ErrorCode TrigMuSuperEF::runStandardChain(const HLT::TriggerElement* inputT if(m_doInsideOut && (m_insideOutFirst || !m_doOutsideIn)) { ATH_MSG_DEBUG( "Executing extend()" ); ++m_counter_TrigMuGirl.total; - hltStatus = m_TrigMuonEF_saTrackTool->getSegments(muonRoI, m_TMEF_monVars, m_TMEF_SATimers); + const EventContext& ctx = getContext(); + hltStatus = m_TrigMuonEF_saTrackTool->getSegments(muonRoI, m_TMEF_monVars, m_TMEF_SATimers, ctx); MuonCombined::InDetCandidateToTagMap* mugirlTagMap=new MuonCombined::InDetCandidateToTagMap(); m_tagMaps.push_back(mugirlTagMap); @@ -1928,7 +1931,8 @@ HLT::ErrorCode TrigMuSuperEF::rebuildCache(const IRoiDescriptor* muonRoI, HLT::T if(m_doInsideOut && (m_insideOutFirst || !m_doOutsideIn)) { ATH_MSG_DEBUG( "Executing extend()" ); ++m_counter_TrigMuGirl.total; - hltStatus = m_TrigMuonEF_saTrackTool->getSegments(muonRoI, m_TMEF_monVars, m_TMEF_SATimers); + const EventContext& ctx = getContext(); + hltStatus = m_TrigMuonEF_saTrackTool->getSegments(muonRoI, m_TMEF_monVars, m_TMEF_SATimers, ctx); MuonCombined::InDetCandidateToTagMap* mugirlTagMap=new MuonCombined::InDetCandidateToTagMap(); m_tagMaps.push_back(mugirlTagMap); diff --git a/Trigger/TrigAlgorithms/TrigMuonEF/src/TrigMuonEFStandaloneTrackTool.cxx b/Trigger/TrigAlgorithms/TrigMuonEF/src/TrigMuonEFStandaloneTrackTool.cxx index 0b79de7ca0b627837c690dedce43cda3a708e894..78092d6f353fbfbde20f9b99d58f8d15299a3d8c 100644 --- a/Trigger/TrigAlgorithms/TrigMuonEF/src/TrigMuonEFStandaloneTrackTool.cxx +++ b/Trigger/TrigAlgorithms/TrigMuonEF/src/TrigMuonEFStandaloneTrackTool.cxx @@ -610,13 +610,13 @@ HLT::ErrorCode TrigMuonEFStandaloneTrackTool::getSpectrometerTracks(const IRoiDescriptor* muonRoI, SegmentCache*& cache, TrigMuonEFMonVars& monVars, - std::vector<TrigTimer*>& timers ) + std::vector<TrigTimer*>& timers, const EventContext& ctx) { // // Segment finding // ATH_MSG_DEBUG("In getSpectrometerTracks, about to call findSegments"); - HLT::ErrorCode hltStatus = findSegments(muonRoI, cache, monVars.segs, timers, 0); + HLT::ErrorCode hltStatus = findSegments(muonRoI, cache, monVars.segs, timers, 0, ctx); if (hltStatus!=HLT::OK) { return hltStatus; } @@ -640,15 +640,15 @@ HLT::ErrorCode TrigMuonEFStandaloneTrackTool::getExtrapolatedTracks(const IRoiDe TrackCollection& extrapolatedTracks, SegmentCache*& cache, TrigMuonEFMonVars& monVars, - std::vector<TrigTimer*>& timers) + std::vector<TrigTimer*>& timers, const EventContext& ctx) { ATH_MSG_DEBUG("In getExtrapolatedTracks with cache"); - HLT::ErrorCode hltStatus = getSpectrometerTracks( muonRoI, cache, monVars, timers ); + HLT::ErrorCode hltStatus = getSpectrometerTracks( muonRoI, cache, monVars, timers, ctx ); // if fail to get trks from L2 hits, retry with all hits if(m_useL2Hits && (hltStatus==HLT::MISSING_FEATURE || !m_spectrometerTracks || m_spectrometerTracks->empty()) ){ m_useL2Hits=false; - hltStatus = getSpectrometerTracks( muonRoI, cache, monVars, timers ); + hltStatus = getSpectrometerTracks( muonRoI, cache, monVars, timers, ctx ); m_useL2Hits=true; } if (hltStatus!=HLT::OK && hltStatus!=HLT::MISSING_FEATURE) { @@ -744,7 +744,7 @@ HLT::ErrorCode TrigMuonEFStandaloneTrackTool::findSegments(const IRoiDescriptor* SegmentCache*& cache, TrigMuonEFSegmentMonVars& monVars, std::vector<TrigTimer*>& timers, - unsigned int firstTimerIndex ) + unsigned int firstTimerIndex, const EventContext& ctx ) { #if DEBUG_ROI_VS_FULL m_fileWithHashIds_rpc << "\n#####\n\n"; @@ -904,7 +904,7 @@ if (m_useMdtData>0) { } if (m_rpcPrepDataProvider->decode( getRpcRobList(muonRoI) ).isSuccess()) { ATH_MSG_DEBUG("ROB-based seeded PRD decoding of RPC done successfully"); - SG::ReadCondHandle<RpcCablingCondData> rpcCableHandle{m_rpcCablingKey}; + SG::ReadCondHandle<RpcCablingCondData> rpcCableHandle{m_rpcCablingKey, ctx}; const RpcCablingCondData* rpcCabling{*rpcCableHandle}; if(!rpcCabling){ ATH_MSG_ERROR("nullptr to the read rpc cabling conditions object"); @@ -955,7 +955,7 @@ if (m_useMdtData>0) { } if (m_mdtPrepDataProvider->decode( getMdtRobList(muonRoI) ).isSuccess()) { ATH_MSG_DEBUG("ROB-based seeded decoding of MDT done successfully"); - SG::ReadCondHandle<MuonMDT_CablingMap> mdtCableHandle{m_mdtCablingKey}; + SG::ReadCondHandle<MuonMDT_CablingMap> mdtCableHandle{m_mdtCablingKey, ctx}; const MuonMDT_CablingMap* mdtCabling{*mdtCableHandle}; if(!mdtCabling){ ATH_MSG_ERROR("nullptr to the read mdt cabling conditions object"); @@ -1039,7 +1039,7 @@ if (m_useMdtData>0) { CscPrepDataContainer* cscPrds = nullptr; if (m_useCscData && !csc_hash_ids.empty()) {// CSC decoding - SG::WriteHandle<Muon::CscPrepDataContainer> wh_clusters(m_cscClustersKey); + SG::WriteHandle<Muon::CscPrepDataContainer> wh_clusters(m_cscClustersKey, ctx); cscPrds = new CscPrepDataContainer(m_idHelperSvc->cscIdHelper().module_hash_max()); if (!wh_clusters.isPresent()) { /// record the container in storeGate @@ -1132,7 +1132,7 @@ if (m_useMdtData>0) { // Get RPC container if (m_useRpcData && !rpc_hash_ids.empty()) { const RpcPrepDataContainer* rpcPrds = 0; - SG::ReadHandle<Muon::RpcPrepDataContainer> RpcCont(m_rpcKey); + SG::ReadHandle<Muon::RpcPrepDataContainer> RpcCont(m_rpcKey, ctx); if( !RpcCont.isValid() ) { msg() << MSG::ERROR << " Cannot retrieve RPC PRD Container" << endmsg; return HLT::NAV_ERROR; @@ -1193,7 +1193,7 @@ if (m_useMdtData>0) { if (m_useMdtData && !mdt_hash_ids.empty()) { const MdtPrepDataContainer* mdtPrds = 0; - SG::ReadHandle<Muon::MdtPrepDataContainer> MdtCont(m_mdtKey); + SG::ReadHandle<Muon::MdtPrepDataContainer> MdtCont(m_mdtKey, ctx); if( !MdtCont.isValid() ) { ATH_MSG_ERROR(" Cannot retrieve MDT PRD Container"); return HLT::NAV_ERROR; @@ -1293,7 +1293,7 @@ if (m_useMdtData>0) { if (m_useTgcData && !tgc_hash_ids.empty()) { const TgcPrepDataContainer* tgcPrds = 0; - SG::ReadHandle<Muon::TgcPrepDataContainer> TgcCont(m_tgcKey); + SG::ReadHandle<Muon::TgcPrepDataContainer> TgcCont(m_tgcKey, ctx); if( !TgcCont.isValid() ) { ATH_MSG_ERROR(" Cannot retrieve TGC PRD Container"); return HLT::NAV_ERROR; @@ -1378,7 +1378,7 @@ if (m_useMdtData>0) { << " with size " << TGCcoll->size()); } const TgcPrepDataContainer* tgcPrdsNextBC = 0; - SG::ReadHandle<Muon::TgcPrepDataContainer> TgcCont(m_tgcKeyNextBC); + SG::ReadHandle<Muon::TgcPrepDataContainer> TgcCont(m_tgcKeyNextBC, ctx); if( !TgcCont.isValid() ) { ATH_MSG_ERROR(" Cannot retrieve TGC PRD Container"); return HLT::NAV_ERROR; @@ -1470,7 +1470,7 @@ if (m_useMdtData>0) { if (dataPrepTime) dataPrepTime->stop(); // check time-out - if (m_doTimeOutChecks && Athena::Timeout::instance().reached() ) { + if (m_doTimeOutChecks && Athena::Timeout::instance(ctx).reached() ) { ATH_MSG_WARNING("Timeout reached. Aborting sequence."); return HLT::ErrorCode(HLT::Action::ABORT_EVENT, HLT::Reason::TIMEOUT); } @@ -1607,15 +1607,15 @@ if (m_useMdtData>0) { output.segmentCollection=segColl.get(); if(m_useL2Hits){ if(mdtCols2.size()>0){ - m_segmentsFinderTool->findSegments(mdtCols2, cscCols, tgcCols, rpcCols, output); + m_segmentsFinderTool->findSegments(mdtCols2, cscCols, tgcCols, rpcCols, output, ctx); if(output.segmentCollection->size()==0){ ATH_MSG_DEBUG("didn't find mstrk with l2 hits, use all mdt hits in roi"); - m_segmentsFinderTool->findSegments(mdtCols, cscCols, tgcCols, rpcCols, output); + m_segmentsFinderTool->findSegments(mdtCols, cscCols, tgcCols, rpcCols, output, ctx); } } - else m_segmentsFinderTool->findSegments(mdtCols, cscCols, tgcCols, rpcCols, output); + else m_segmentsFinderTool->findSegments(mdtCols, cscCols, tgcCols, rpcCols, output, ctx); } - else m_segmentsFinderTool->findSegments(mdtCols, cscCols, tgcCols, rpcCols, output); + else m_segmentsFinderTool->findSegments(mdtCols, cscCols, tgcCols, rpcCols, output, ctx); if (!output.segmentCollection) { if (segFinderTime) segFinderTime->stop(); ATH_MSG_WARNING("Segment finder returned an invalid pointer for the segments"); @@ -2365,20 +2365,20 @@ void TrigMuonEFStandaloneTrackTool::handle(const Incident &inc) HLT::ErrorCode TrigMuonEFStandaloneTrackTool::getSegments(const IRoiDescriptor* muonRoI, TrigMuonEFMonVars& monVars, - std::vector<TrigTimer*>& timers ) + std::vector<TrigTimer*>& timers, const EventContext& ctx ) { SegmentCache* cache = 0; - return findSegments(muonRoI, cache, monVars.segs, timers, 0 ); + return findSegments(muonRoI, cache, monVars.segs, timers, 0, ctx ); } //________________________________________________________________________ HLT::ErrorCode TrigMuonEFStandaloneTrackTool::getSpectrometerTracks(const IRoiDescriptor* muonRoI, TrigMuonEFMonVars& monVars, - std::vector<TrigTimer*>& timers ) + std::vector<TrigTimer*>& timers, const EventContext& ctx ) { SegmentCache* cache = 0; - return getSpectrometerTracks( muonRoI, cache, monVars, timers ); + return getSpectrometerTracks( muonRoI, cache, monVars, timers, ctx ); } //________________________________________________________________________ @@ -2387,11 +2387,11 @@ TrigMuonEFStandaloneTrackTool::getExtrapolatedTracks(const IRoiDescriptor* muonR MuonCandidateCollection& candidateCollection, TrackCollection& extrapolatedTracks, TrigMuonEFMonVars& monVars, - std::vector<TrigTimer*>& timers) + std::vector<TrigTimer*>& timers, const EventContext& ctx) { SegmentCache* cache = 0; ATH_MSG_DEBUG("In getExtrapolatedTracks without cache"); - return getExtrapolatedTracks( muonRoI, candidateCollection, extrapolatedTracks, cache, monVars, timers ); + return getExtrapolatedTracks( muonRoI, candidateCollection, extrapolatedTracks, cache, monVars, timers, ctx ); } //________________________________________________________________________ diff --git a/Trigger/TrigAlgorithms/TrigMuonEF/src/TrigMuonEFStandaloneTrackTool.h b/Trigger/TrigAlgorithms/TrigMuonEF/src/TrigMuonEFStandaloneTrackTool.h index b883e5b20081042d5ba1cfa135bf71beab12bb4b..6d3653a6f596cd596d954558579ea97fe5338624 100644 --- a/Trigger/TrigAlgorithms/TrigMuonEF/src/TrigMuonEFStandaloneTrackTool.h +++ b/Trigger/TrigAlgorithms/TrigMuonEF/src/TrigMuonEFStandaloneTrackTool.h @@ -40,6 +40,7 @@ #include "MuonSegmentMakerToolInterfaces/IMuonSegmentOverlapRemovalTool.h" #include "CxxUtils/checker_macros.h" + ATLAS_NO_CHECK_FILE_THREAD_SAFETY; // legacy trigger code #include <vector> @@ -110,19 +111,19 @@ class TrigMuonEFStandaloneTrackTool : public AthAlgTool, /** Run segment finding only */ virtual HLT::ErrorCode getSegments(const IRoiDescriptor* muonRoI, TrigMuonEFMonVars& monvars, - std::vector<TrigTimer*>& timers); + std::vector<TrigTimer*>& timers, const EventContext& ctx); /** Run segment finding and spectrometer track building */ virtual HLT::ErrorCode getSpectrometerTracks(const IRoiDescriptor* muonRoI, TrigMuonEFMonVars& monVars, - std::vector<TrigTimer*>& timers); + std::vector<TrigTimer*>& timers, const EventContext& ctx); /** Run segment finding, spectrometer track building and extrapolation */ virtual HLT::ErrorCode getExtrapolatedTracks(const IRoiDescriptor* muonRoI, MuonCandidateCollection& candidateCollection, TrackCollection& extrapolatedTracks, TrigMuonEFMonVars& monvars, - std::vector<TrigTimer*>& timers); + std::vector<TrigTimer*>& timers, const EventContext& ctx); /** get list of hashIDs used in roi (used for internal caching in TrigMuSuperEF) **/ virtual std::vector<std::vector<IdentifierHash> > getHashList(const IRoiDescriptor* muonRoI); @@ -206,7 +207,7 @@ class TrigMuonEFStandaloneTrackTool : public AthAlgTool, HLT::ErrorCode getSpectrometerTracks(const IRoiDescriptor* muonRoI, SegmentCache*& cache, TrigMuonEFMonVars& monVars, - std::vector<TrigTimer*>& timers); + std::vector<TrigTimer*>& timers, const EventContext& ctx); /** Run segment finding, spectrometer track building and extrapolation */ HLT::ErrorCode getExtrapolatedTracks(const IRoiDescriptor* muonRoI, @@ -214,14 +215,14 @@ class TrigMuonEFStandaloneTrackTool : public AthAlgTool, TrackCollection& extrapolatedTracks, SegmentCache*& cache, TrigMuonEFMonVars& monvars, - std::vector<TrigTimer*>& timers); + std::vector<TrigTimer*>& timers, const EventContext& ctx); /** Find segments in input ROI */ HLT::ErrorCode findSegments(const IRoiDescriptor* muonRoI, SegmentCache*& cache, TrigMuonEFSegmentMonVars& monvars, - std::vector<TrigTimer*>& timers, unsigned int firstTimerIndex ); + std::vector<TrigTimer*>& timers, unsigned int firstTimerIndex, const EventContext& ctx ); /** Build tracks out of input segments */ HLT::ErrorCode buildTracks(const Trk::SegmentCollection* segment_collection, diff --git a/Trigger/TrigTools/TrigMuonToolInterfaces/TrigMuonToolInterfaces/ITrigMuonStandaloneTrackTool.h b/Trigger/TrigTools/TrigMuonToolInterfaces/TrigMuonToolInterfaces/ITrigMuonStandaloneTrackTool.h index 4d2e3d0172717d6da4a3e8274ffb650a182fa0ef..ff25e6d12b25dda488b0100f0e64fb3aa69ec8fb 100644 --- a/Trigger/TrigTools/TrigMuonToolInterfaces/TrigMuonToolInterfaces/ITrigMuonStandaloneTrackTool.h +++ b/Trigger/TrigTools/TrigMuonToolInterfaces/TrigMuonToolInterfaces/ITrigMuonStandaloneTrackTool.h @@ -52,19 +52,19 @@ class ITrigMuonStandaloneTrackTool : virtual public IAlgTool { /** Run segment finding only */ virtual HLT::ErrorCode getSegments(const IRoiDescriptor* muonRoI, TrigMuonEFMonVars& monvars, - std::vector<TrigTimer*>& timers) = 0; + std::vector<TrigTimer*>& timers, const EventContext& ctx) = 0; /** Run segment finding and spectrometer track building */ virtual HLT::ErrorCode getSpectrometerTracks(const IRoiDescriptor* muonRoI, TrigMuonEFMonVars& monVars, - std::vector<TrigTimer*>& timers) = 0; + std::vector<TrigTimer*>& timers, const EventContext& ctx) = 0; /** Run segment finding, spectrometer track building and extrapolation */ virtual HLT::ErrorCode getExtrapolatedTracks(const IRoiDescriptor* muonRoI, MuonCandidateCollection& candidateCollection, TrackCollection& extrapolatedTracks, TrigMuonEFMonVars& monvars, - std::vector<TrigTimer*>& timers) = 0; + std::vector<TrigTimer*>& timers, const EventContext& ctx) = 0; /** return last created MuonPatternCombinationCollection. Object will be deleted by tool at the end of the event. NB: You can not attach this object to the TriggerElement */