diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentCombinationFinder.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentCombinationFinder.cxx index 8d4a1a8116b8af910bb6c00d62fba3fa6d726109..2ba31fdc96f0afa7d70981be7bb8d7b366aeaf1e 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentCombinationFinder.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentCombinationFinder.cxx @@ -127,12 +127,12 @@ Muon::MooSegmentCombinationFinder::findSegments(const std::vector<const MdtPrepD std::unique_ptr<MuonSegmentCombinationCollection> csc4dSegmentCombinations(new MuonSegmentCombinationCollection); if (m_doCscSegments) { // reconstruct segments in the CSC eta and phi plane - csc2dSegmentCombinations = m_csc2dSegmentFinder->find(cscCols); + csc2dSegmentCombinations = m_csc2dSegmentFinder->find(cscCols, ctx); printSummary("CSC 2D segment finding", csc2dSegmentCombinations.get()); // combine CSC segments in eta and phi plane if any were found if (csc2dSegmentCombinations) { - csc4dSegmentCombinations = m_csc4dSegmentFinder->find(*csc2dSegmentCombinations); + csc4dSegmentCombinations = m_csc4dSegmentFinder->find(*csc2dSegmentCombinations, ctx); printSummary("CSC 4D segment finding", csc4dSegmentCombinations.get()); } diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MuonSegmentFinderAlg.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MuonSegmentFinderAlg.cxx index 60bf0301fb2daeabdbcde31eafec66c34354d3b3..9e275a731935db9871a1d4af82a1f1ac3334c718 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MuonSegmentFinderAlg.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MuonSegmentFinderAlg.cxx @@ -163,11 +163,11 @@ MuonSegmentFinderAlg::execute(const EventContext& ctx) const ATH_MSG_DEBUG("Retrieved CscPrepDataContainer " << cscCols.size()); // reconstruct segments in the CSC eta and phi plane std::unique_ptr<MuonSegmentCombinationCollection> csc2dSegmentCombinations = - m_csc2dSegmentFinder->find(cscCols); + m_csc2dSegmentFinder->find(cscCols, ctx); // combine CSC segments in eta and phi plane if any were found if (csc2dSegmentCombinations) { std::unique_ptr<MuonSegmentCombinationCollection> csc4dSegmentCombinations = - m_csc4dSegmentFinder->find(*csc2dSegmentCombinations); + m_csc4dSegmentFinder->find(*csc2dSegmentCombinations, ctx); if (csc4dSegmentCombinations) { // now copy the segments into the collection, not optimal as unneeded copy diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/CscSegmentMakers/ICscSegmentFinder.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/CscSegmentMakers/ICscSegmentFinder.h index ae55ee2c48e975892c3dbca93b981d7d356c7e36..5f1f61dae361e45684f432c040761a72c6d60d0a 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/CscSegmentMakers/ICscSegmentFinder.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/CscSegmentMakers/ICscSegmentFinder.h @@ -40,10 +40,10 @@ public: // Interface methods // virtual Muon::MuonSegmentCombination* find( const Muon::CscPrepDataCollection& pcol) =0; // using Muon::IMuonSegmentMaker::find; - virtual std::unique_ptr<MuonSegmentCombinationCollection> find( const std::vector<const Muon::CscPrepDataCollection*>& pcols) const =0; + virtual std::unique_ptr<MuonSegmentCombinationCollection> find( const std::vector<const Muon::CscPrepDataCollection*>& pcols, const EventContext& ctx) const =0; // for 4d SegmentMaker - virtual std::unique_ptr<MuonSegmentCombinationCollection> find( const MuonSegmentCombinationCollection& segcols) const =0; + virtual std::unique_ptr<MuonSegmentCombinationCollection> find( const MuonSegmentCombinationCollection& segcols, const EventContext& ctx) const =0; /* virtual std::vector<const Muon::MuonSegment*>* find( const Trk::TrackRoad& road, diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/CscSegmentMakers/ICscSegmentUtilTool.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/CscSegmentMakers/ICscSegmentUtilTool.h index 0febb869fd07e10a8a0be867e74f7aa801ffc255..9000cf71c8009de90429cc7a82cd96039f33f03a 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/CscSegmentMakers/ICscSegmentUtilTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/CscSegmentMakers/ICscSegmentUtilTool.h @@ -57,25 +57,25 @@ public: // Interface methods get2dMuonSegmentCombination( Identifier eta_id, Identifier phi_id, ICscSegmentFinder::ChamberTrkClusters& eta_clus, ICscSegmentFinder::ChamberTrkClusters& phi_clus, - const Amg::Vector3D& lpos000, int etaStat=0, int phiStat=0 ) const=0; + const Amg::Vector3D& lpos000, const EventContext& ctx, int etaStat=0, int phiStat=0 ) const=0; virtual Muon::MuonSegmentCombination* get4dMuonSegmentCombination(Identifier eta_id, Identifier phi_id, ICscSegmentFinder::ChamberTrkClusters& eta_clus, ICscSegmentFinder::ChamberTrkClusters& phi_clus, - const Amg::Vector3D& lpos000 ) const =0; + const Amg::Vector3D& lpos000, const EventContext& ctx ) const =0; // Get 2d segments eta/phi seperately virtual Muon::MuonSegmentCombination* - get4dMuonSegmentCombination(const Muon::MuonSegmentCombination* Muon2dSegComb) const=0; + get4dMuonSegmentCombination(const Muon::MuonSegmentCombination* Muon2dSegComb, const EventContext& ctx) const=0; virtual std::unique_ptr<std::vector<std::unique_ptr<Muon::MuonSegment> > > getMuonSegments(Identifier eta_id, Identifier phi_id, ICscSegmentFinder::ChamberTrkClusters& eta_clus, ICscSegmentFinder::ChamberTrkClusters& phi_clus, - const Amg::Vector3D& lpos000) const=0; + const Amg::Vector3D& lpos000, const EventContext& ctx) const=0; - virtual bool isGood(uint32_t stripHashId) const=0; + virtual bool isGood(uint32_t stripHashId, const EventContext& ctx) const=0; }; diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc2dSegmentMaker.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc2dSegmentMaker.cxx index fff9b4f95a0b4ab37a7557d1f199aac7816ee9a9..e1bdb6ddfecce8c5d09a913db00e32b47d51c2f2 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc2dSegmentMaker.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc2dSegmentMaker.cxx @@ -79,7 +79,7 @@ StatusCode Csc2dSegmentMaker::initialize(){ //****************************************************************************** -std::unique_ptr<MuonSegmentCombinationCollection> Csc2dSegmentMaker::find( const std::vector<const Muon::CscPrepDataCollection*>& pcols) const +std::unique_ptr<MuonSegmentCombinationCollection> Csc2dSegmentMaker::find( const std::vector<const Muon::CscPrepDataCollection*>& pcols, const EventContext& ctx) const { // Construct output segment collection. @@ -100,7 +100,7 @@ std::unique_ptr<MuonSegmentCombinationCollection> Csc2dSegmentMaker::find( const << clus->size() << " clusters" ); if (clus->size() == 0) continue; // skip zero cluster collection - MuonSegmentCombination* pcol =findSegmentCombination(*clus); + MuonSegmentCombination* pcol =findSegmentCombination(*clus, ctx); if (pcol) { mpsegs->push_back(pcol); ATH_MSG_DEBUG("Found 2d CSC segment " << m_printer->print( *pcol )); @@ -116,7 +116,7 @@ std::unique_ptr<MuonSegmentCombinationCollection> Csc2dSegmentMaker::find( const //****************************************************************************** -MuonSegmentCombination* Csc2dSegmentMaker::findSegmentCombination(const CscPrepDataCollection& clus) const { +MuonSegmentCombination* Csc2dSegmentMaker::findSegmentCombination(const CscPrepDataCollection& clus, const EventContext& ctx) const { // check whether input not empty if( clus.empty() ) return 0; @@ -161,7 +161,7 @@ MuonSegmentCombination* Csc2dSegmentMaker::findSegmentCombination(const CscPrepD Identifier stripId=m_idHelperSvc->cscIdHelper().channelID(redName,stationEta,stationPhi,chamberLayer,iLay+1,iPhi,iStrip+1); IdentifierHash hashID; m_idHelperSvc->cscIdHelper().get_channel_hash(stripId,hashID); - if(!m_segmentTool->isGood(hashID)){ + if(!m_segmentTool->isGood(hashID, ctx)){ ATH_MSG_DEBUG("bad strip"); nbad++; } @@ -229,7 +229,7 @@ MuonSegmentCombination* Csc2dSegmentMaker::findSegmentCombination(const CscPrepD MuonSegmentCombination* pcol = 0; if (nHitLayer_eta >=2 || nHitLayer_phi >=2) { ATH_MSG_DEBUG( "Csc2dSegment calls get2dMuonSegmentCombination !!!" ); - pcol = m_segmentTool->get2dMuonSegmentCombination(eta_id, phi_id, eta_clus, phi_clus, lpos000, layStatus[0], layStatus[1]); + pcol = m_segmentTool->get2dMuonSegmentCombination(eta_id, phi_id, eta_clus, phi_clus, lpos000, ctx, layStatus[0], layStatus[1]); } // to avoid memory leak @@ -252,7 +252,7 @@ MuonSegmentCombination* Csc2dSegmentMaker::findSegmentCombination(const CscPrepD } //****************************************************************************** -std::unique_ptr<MuonSegmentCombinationCollection> Csc2dSegmentMaker::find( const MuonSegmentCombinationCollection& ) const +std::unique_ptr<MuonSegmentCombinationCollection> Csc2dSegmentMaker::find( const MuonSegmentCombinationCollection&, const EventContext& ) const { return std::unique_ptr<MuonSegmentCombinationCollection>(); diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc2dSegmentMaker.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc2dSegmentMaker.h index ecd70880b40805a24373ea686386fc96da27bf1a..1edb589c85320f549dfbdc4ba5a0af97468d5d0f 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc2dSegmentMaker.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc2dSegmentMaker.h @@ -31,11 +31,11 @@ public: StatusCode initialize(); - std::unique_ptr<MuonSegmentCombinationCollection> find( const std::vector<const Muon::CscPrepDataCollection*>& pcols) const; - std::unique_ptr<MuonSegmentCombinationCollection> find( const MuonSegmentCombinationCollection& ) const; + std::unique_ptr<MuonSegmentCombinationCollection> find( const std::vector<const Muon::CscPrepDataCollection*>& pcols, const EventContext& ctx) const; + std::unique_ptr<MuonSegmentCombinationCollection> find( const MuonSegmentCombinationCollection&, const EventContext& ctx ) const; private: - Muon::MuonSegmentCombination* findSegmentCombination( const Muon::CscPrepDataCollection& pcol ) const; + Muon::MuonSegmentCombination* findSegmentCombination( const Muon::CscPrepDataCollection& pcol, const EventContext& ctx ) const; ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc4dSegmentMaker.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc4dSegmentMaker.cxx index 877fb763a9d77946e67b28cf8a8814c1de530153..3df6ab5425e41057ae5994154056e33dd9a783c3 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc4dSegmentMaker.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc4dSegmentMaker.cxx @@ -94,7 +94,7 @@ Csc4dSegmentMaker::initialize() //****************************************************************************** std::unique_ptr<MuonSegmentCombinationCollection> -Csc4dSegmentMaker::find(const MuonSegmentCombinationCollection& segcols) const +Csc4dSegmentMaker::find(const MuonSegmentCombinationCollection& segcols, const EventContext& ctx) const { // Set dump flag. @@ -119,7 +119,7 @@ Csc4dSegmentMaker::find(const MuonSegmentCombinationCollection& segcols) const ATH_MSG_DEBUG("Csc4dSegmentMaker called get4dMuonSegmentCombination"); - MuonSegmentCombination* pcol = m_segmentTool->get4dMuonSegmentCombination(&insegs); + MuonSegmentCombination* pcol = m_segmentTool->get4dMuonSegmentCombination(&insegs, ctx); if (pcol) { pcols->push_back(pcol); ATH_MSG_DEBUG("Found 4d CSC segment " << std::endl << m_printer->print(*pcol)); @@ -143,7 +143,7 @@ Csc4dSegmentMaker::finalize() // dummy ICscSegmentFinder interface std::unique_ptr<MuonSegmentCombinationCollection> -Csc4dSegmentMaker::find(const std::vector<const Muon::CscPrepDataCollection*>&) const +Csc4dSegmentMaker::find(const std::vector<const Muon::CscPrepDataCollection*>&, const EventContext&) const { return 0; } diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc4dSegmentMaker.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc4dSegmentMaker.h index d4059a03d8efd545860905ef35dd602d97194f77..a97fe920480df615b93f3043124910b49081e0ad 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc4dSegmentMaker.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc4dSegmentMaker.h @@ -49,9 +49,9 @@ class Csc4dSegmentMaker : virtual public ICscSegmentFinder, public AthAlgTool { // Finalization. StatusCode finalize(); - std::unique_ptr<MuonSegmentCombinationCollection> find(const MuonSegmentCombinationCollection&) const; + std::unique_ptr<MuonSegmentCombinationCollection> find(const MuonSegmentCombinationCollection&, const EventContext& ctx) const; std::unique_ptr<MuonSegmentCombinationCollection> find( - const std::vector<const Muon::CscPrepDataCollection*>& pcols) const; // not used here + const std::vector<const Muon::CscPrepDataCollection*>& pcols, const EventContext& ctx) const; // not used here private: // data // Properties. diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/CscSegmentMaker.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/CscSegmentMaker.cxx deleted file mode 100644 index 5bdc89e2e8b37b6722286bdb15b79e492885a134..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/CscSegmentMaker.cxx +++ /dev/null @@ -1,175 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#include "CscSegmentMaker.h" - -#include <sstream> - -#include "MuonPrepRawData/CscPrepDataContainer.h" -#include "MuonSegment/MuonSegment.h" -#include "MuonSegment/MuonSegmentCombinationCollection.h" -#include "xAODEventInfo/EventInfo.h" - -using Muon::CscPrepData; -using Muon::CscPrepDataCollection; -using Muon::CscPrepDataContainer; - -/*namespace { - - std::string station_name(int station) { - if ( station == 1 ) return "CSS"; - if ( station == 2 ) return "CSL"; - return "UNKNOWN_STATION"; - } - - std::string measphi_name(bool measphi) { - if ( measphi ) return "phi"; - return "eta"; - } - - // Convert chamber identifier to string. - std::string chamber(int istation, int zsec, int phi) { - std::ostringstream ssout; - if ( istation == 1 ) ssout << "CSS"; - else if ( istation ==2 ) ssout << "CSL"; - else ssout << "???"; - if ( zsec == -1 ) ssout << "-"; - else if ( zsec == 1 ) ssout << "+"; - else ssout << "?"; - ssout << phi; - return ssout.str(); - } - -}*/ - -//****************************************************************************** - -CscSegmentMaker::CscSegmentMaker(const std::string& aname, ISvcLocator* pSvcLocator) - : AthAlgorithm(aname, pSvcLocator), - m_dumped(0), - m_dump(false), - m_psegs(std::unique_ptr<MuonSegmentCombinationCollection>()), - m_psegs4d(std::unique_ptr<MuonSegmentCombinationCollection>()) -{ - declareProperty("dump_count", m_dumpcount = 5); - declareProperty("sg_inkey", m_sg_inkey = ""); - declareProperty("sg_2d_outkey", m_sg_outkey = ""); - declareProperty("sg_4d_outkey", m_sg_4d_outkey = ""); -} - -//****************************************************************************** - -// Destructor. - -CscSegmentMaker::~CscSegmentMaker() {} - -//****************************************************************************** - -StatusCode -CscSegmentMaker::initialize() -{ - - ATH_MSG_INFO("Initializing " << name()); - - ATH_MSG_INFO(" Dump count: " << m_dumpcount); - // Show keys. - ATH_MSG_INFO(" Input SG key: " << m_sg_inkey); - ATH_MSG_INFO(" Output SG key for 2D Segment: " << m_sg_outkey); - ATH_MSG_INFO(" Output SG key for 4D Segment: " << m_sg_4d_outkey); - - ATH_MSG_INFO(" 2D Segment Finder is " << m_2dseg_finder.typeAndName()); - ATH_MSG_INFO(" 4D Segment Finder is " << m_4dseg_finder.typeAndName()); - - - // Retrieve the Segment Finder tool. - ATH_CHECK(m_2dseg_finder.retrieve()); - ATH_MSG_DEBUG("Retrieved 2dseg finder tool " << m_2dseg_finder); - - // Retrieve the Segment Finder tool. - ATH_CHECK(m_4dseg_finder.retrieve()); - ATH_MSG_DEBUG("Retrieved 4dseg finder tool " << m_4dseg_finder); - - return StatusCode::SUCCESS; -} - -//****************************************************************************** - -StatusCode -CscSegmentMaker::execute() -{ - - m_dump = m_dumped < m_dumpcount || m_dumpcount < 0; - if (m_dump) ++m_dumped; - - StatusCode sc = StatusCode::SUCCESS; - // Get event info. - const xAOD::EventInfo* pevt = 0; - StatusCode sc_ev = evtStore()->retrieve(pevt, ""); - int evt = pevt->eventNumber(); - int run = pevt->runNumber(); - if (m_dump) ATH_MSG_DEBUG("Processing run " << run << ", event " << evt); - - /////////// - // Build Segment - sc = build_segments(); - if (sc.isFailure()) { - ATH_MSG_ERROR(" Failed to build segments "); - } - - sc = evtStore()->record(m_psegs.release(), m_sg_outkey); - if (sc.isFailure()) { - ATH_MSG_ERROR(" Cannot record CSC segment collection " << m_sg_outkey); - } else { - if (m_dump) ATH_MSG_DEBUG(" Created " << m_psegs->size() << " 2D segments and "); - } - - sc = evtStore()->record(m_psegs4d.release(), m_sg_4d_outkey); - if (sc.isFailure()) { - ATH_MSG_ERROR(" Cannot record CSC segment collection " << m_sg_4d_outkey); - } else { - if (m_dump) ATH_MSG_DEBUG(m_psegs4d->size() << " 4D segments."); - } - - return StatusCode::SUCCESS; -} - -//****************************************************************************** -StatusCode -CscSegmentMaker::build_segments() -{ - // Retrieve the container. - const CscPrepDataContainer* pcols = nullptr; - StatusCode status = evtStore()->retrieve(pcols, m_sg_inkey); - - if (m_dump) ATH_MSG_DEBUG("Retrieved " << pcols->size() << " CSC cluster collections."); - - // Chambers incols; - if (status.isSuccess()) { - std::vector<const CscPrepDataCollection*> myclus; - for (CscPrepDataContainer::const_iterator icol = pcols->begin(); icol != pcols->end(); ++icol) - myclus.push_back(*icol); - - ATH_MSG_DEBUG("CscSegmentMaker called find!!"); - m_psegs = m_2dseg_finder->find(myclus); - // Construct output segment collection. - ATH_MSG_DEBUG("CscSegmentMaker called find!!"); - if (m_psegs) { - if (m_psegs->size() > 1) { - m_psegs4d = m_4dseg_finder->find(*m_psegs); - } - } - } - return StatusCode::SUCCESS; -} - -//****************************************************************************** - -StatusCode -CscSegmentMaker::finalize() -{ - ATH_MSG_DEBUG("Goodbye"); - return StatusCode::SUCCESS; -} - -//****************************************************************************** diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/CscSegmentMaker.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/CscSegmentMaker.h deleted file mode 100644 index eb3cb85f28ef90d27ae16c48b37d7874eb12560a..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/CscSegmentMaker.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -// Csc2dSegmentMaker.h -#ifndef CscSegmentMaker_H -#define CscSegmentMaker_H - -// Algorithm to find CSC 2D segments from clusters. -// -// Segmetns are witten as MuonSegment objects to a -// MuonSegmentCombinationCollection. There is a separate combination for -// each chamber (with segments) and separate r and phi collections -// for each combination. - -#include "AthenaBaseComps/AthAlgorithm.h" -#include "CscSegmentMakers/ICscSegmentFinder.h" // MuonSegmentCombinationCollection.h MuonSegmentCombination.h included -#include "GaudiKernel/ToolHandle.h" -#include "Identifier/Identifier.h" - -namespace Muon { -class CscPrepData; -} - -class CscSegmentMaker : public AthAlgorithm { - - public: // methods - // Constructor. - CscSegmentMaker(const std::string& name, ISvcLocator* pSvcLocator); - - // Destructor. - ~CscSegmentMaker(); - - // Initialization. - StatusCode initialize(); - - // Event processing. - StatusCode execute(); - - // Finalization. - StatusCode finalize(); - - - private: // methods - StatusCode build_segments(); - - private: // data - // Number of events dumped. - int m_dumped; - // Debug flags. - bool m_dump; - int m_dumpcount; - - // Properties. - std::string m_sg_inkey; - std::string m_sg_outkey; - std::string m_sg_4d_outkey; - - ToolHandle<ICscSegmentFinder> m_2dseg_finder{ - this, - "segfinder_2d", - "", - }; - ToolHandle<ICscSegmentFinder> m_4dseg_finder{ - this, - "segfinder_4d", - "", - }; - - // Output container. - std::unique_ptr<MuonSegmentCombinationCollection> m_psegs; - std::unique_ptr<MuonSegmentCombinationCollection> m_psegs4d; -}; - -#endif diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/CscSegmentUtilTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/CscSegmentUtilTool.cxx index b0ddd8e772a3ef59e65ff43794c20d9fc3596108..df0aff8a2c16c5b61c451135290da33c8b677900 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/CscSegmentUtilTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/CscSegmentUtilTool.cxx @@ -118,7 +118,7 @@ std::unique_ptr<std::vector<std::unique_ptr<MuonSegment> > > CscSegmentUtilTool: getMuonSegments(Identifier eta_id, Identifier phi_id, ICscSegmentFinder::ChamberTrkClusters& eta_clus, ICscSegmentFinder::ChamberTrkClusters& phi_clus, - const Amg::Vector3D& lpos000 ) const { + const Amg::Vector3D& lpos000, const EventContext& ctx ) const { if (! enoughHitLayers(eta_clus, phi_clus) ) { ATH_MSG_DEBUG (" Could not find at least two individual layer hits! "); @@ -130,10 +130,10 @@ getMuonSegments(Identifier eta_id, Identifier phi_id, ATH_MSG_DEBUG ( "getMuonSegments2: No of clusters in layer " << i << " " << eta_clus[i].size() << " " << phi_clus[i].size() ); ATH_MSG_DEBUG ("getMuonSegments called get2dMuonSegmentCombination"); - std::unique_ptr<MuonSegmentCombination> Muon2dSegComb(get2dMuonSegmentCombination(eta_id, phi_id, eta_clus, phi_clus, lpos000)); + std::unique_ptr<MuonSegmentCombination> Muon2dSegComb(get2dMuonSegmentCombination(eta_id, phi_id, eta_clus, phi_clus, lpos000, ctx)); ATH_MSG_DEBUG ("getMuonSegments called get4dMuonSegmentCombination"); - std::unique_ptr<MuonSegmentCombination> Muon4dSegComb(get4dMuonSegmentCombination(Muon2dSegComb.get())); + std::unique_ptr<MuonSegmentCombination> Muon4dSegComb(get4dMuonSegmentCombination(Muon2dSegComb.get(), ctx)); std::unique_ptr<std::vector<std::unique_ptr<MuonSegment> > > segments_clone (new std::vector<std::unique_ptr<MuonSegment> >); @@ -158,7 +158,7 @@ MuonSegmentCombination* CscSegmentUtilTool:: get2dMuonSegmentCombination( Identifier eta_id, Identifier phi_id, ICscSegmentFinder::ChamberTrkClusters& eta_clus, ICscSegmentFinder::ChamberTrkClusters& phi_clus, - const Amg::Vector3D& lpos000, int etaStat, int phiStat ) const { + const Amg::Vector3D& lpos000, const EventContext& ctx, int etaStat, int phiStat) const { int nGoodEta=0,nGoodPhi=0; for (int i=0; i<4; ++i){ @@ -180,10 +180,10 @@ get2dMuonSegmentCombination( Identifier eta_id, Identifier phi_id, ICscSegmentFinder::Segments phi_segs; // get2dSegments does : find_2dsegments -> find_2dseg3hit -> add_2dsegments - get2dSegments(eta_id, phi_id, eta_clus, phi_clus, eta_segs, phi_segs, lpos000, etaStat, phiStat); + get2dSegments(eta_id, phi_id, eta_clus, phi_clus, eta_segs, phi_segs, lpos000, ctx, etaStat, phiStat); std::unique_ptr<MuonSegmentCombination::SegmentVec> psegs (new MuonSegmentCombination::SegmentVec); for ( ICscSegmentFinder::Segments::const_iterator iseg=eta_segs.begin(); iseg!=eta_segs.end(); ++iseg ) { - std::unique_ptr<MuonSegment> pseg(build_segment(*iseg, false, eta_id, nGoodEta==2)); // build_segment does getRios + std::unique_ptr<MuonSegment> pseg(build_segment(*iseg, false, eta_id, nGoodEta==2, ctx)); // build_segment does getRios if (pseg) { ATH_MSG_DEBUG( " =============================> get2dMuonSegmentCombination:: MuonSegment time (eta) from build_segment is " << pseg->time() ); psegs->push_back(std::move(pseg)); @@ -195,7 +195,7 @@ get2dMuonSegmentCombination( Identifier eta_id, Identifier phi_id, // Insert phi-segments. std::unique_ptr<MuonSegmentCombination::SegmentVec> phisegs(new MuonSegmentCombination::SegmentVec); for ( ICscSegmentFinder::Segments::const_iterator iseg=phi_segs.begin(); iseg!=phi_segs.end(); ++iseg ) { - std::unique_ptr<MuonSegment> pseg(build_segment(*iseg, true, phi_id, nGoodPhi==2)); + std::unique_ptr<MuonSegment> pseg(build_segment(*iseg, true, phi_id, nGoodPhi==2, ctx)); if (pseg) { ATH_MSG_DEBUG( " get2dMuonSegmentCombination:: MuonSegment time (phi) from build_segment is " << pseg->time() ); phisegs->push_back(std::move(pseg)); @@ -217,18 +217,18 @@ get2dMuonSegmentCombination( Identifier eta_id, Identifier phi_id, // local z = -38.51 -12.82 12.87 38.56 void CscSegmentUtilTool::fit_segment(const ICscSegmentFinder::TrkClusters& clus, const Amg::Vector3D& lpos000, double& s0, double& s1, double& d0, double& d1, double& d01, double& chsq, double& time, double& dtime, - double& zshift, int outlierHitLayer) const { + double& zshift, const EventContext& ctx, int outlierHitLayer) const { ATH_MSG_DEBUG ( " fit_segment called " ); bool measphi = false; fit_detailCalcPart1(clus, lpos000, s0, s1, d0, d1, d01, chsq, measphi, time, dtime, zshift, - false, outlierHitLayer); // IsSlopeGiven should be false + false, outlierHitLayer, ctx); // IsSlopeGiven should be false if (measphi) return; //No need to do the second try fit_detailCalcPart1(clus, lpos000, s0, s1, d0, d1, d01, chsq, measphi, time, dtime, zshift, - true, outlierHitLayer); // IsSlopeGiven should be true + true, outlierHitLayer, ctx); // IsSlopeGiven should be true return; } @@ -241,7 +241,7 @@ void CscSegmentUtilTool:: fit_detailCalcPart1(const ICscSegmentFinder::TrkClusters& clus, const Amg::Vector3D& lpos000, double& s0, double& s1, double& d0, double& d1, double& d01, double& chsq, bool& measphi, double& time, double& dtime, double& zshift, - bool IsSlopeGiven, int outlierHitLayer) const { + bool IsSlopeGiven, int outlierHitLayer, const EventContext& ctx) const { // if (IsSlopeGiven) // measure zshift @@ -338,7 +338,7 @@ fit_detailCalcPart1(const ICscSegmentFinder::TrkClusters& clus, const Amg::Vecto if ( IsSlopeGiven ) d = m_rotCreator->GetICscClusterFitter()->getCorrectedError(prd, s1); if ( outlierHitLayer == ( iclu - clus.begin() ) ) - d = getDefaultError(id, measphi, prd); + d = getDefaultError(id, measphi, prd, ctx); } d *= m_cluster_error_scaler; // This is for error scaler for cosmic!!! ATH_MSG_VERBOSE ( " +++fit_segment() x/y/d = " << x << " " << y << " " << d ); @@ -411,7 +411,7 @@ fit_detailCalcPart1(const ICscSegmentFinder::TrkClusters& clus, const Amg::Vecto //****************************************************************************** // int CscSegmentUtilTool:: -find_outlier_cluster(const ICscSegmentFinder::TrkClusters& clus, const Amg::Vector3D& lpos000, double& returned_chsq) const { +find_outlier_cluster(const ICscSegmentFinder::TrkClusters& clus, const Amg::Vector3D& lpos000, double& returned_chsq, const EventContext& ctx) const { int nunspoil = 0; double chsq_reference =10000; @@ -430,7 +430,7 @@ find_outlier_cluster(const ICscSegmentFinder::TrkClusters& clus, const Amg::Vect ATH_MSG_VERBOSE ( " find_outlier_cluster drop ire " << ire << " fitclus size " << fitclus.size() ); double s0, s1, d0, d1, d01, chsq, time, dtime, zshift; - fit_segment(fitclus, lpos000, s0, s1, d0, d1, d01, chsq, time, dtime, zshift); + fit_segment(fitclus, lpos000, s0, s1, d0, d1, d01, chsq, time, dtime, zshift, ctx); if (chsq < chsq_reference && isunspoiled) { // require outlier should be precision measurement chsq_reference =chsq; remclu_ind =ire; @@ -458,7 +458,7 @@ find_outlier_cluster(const ICscSegmentFinder::TrkClusters& clus, const Amg::Vect ATH_MSG_VERBOSE ( " final fit outlier_cluster drop cluster index " << remclu_ind << " fitclus.size " << fitclus.size() ); double s0, s1, d0, d1, d01, chsq, time, dtime, zshift; - fit_segment(fitclus, lpos000, s0, s1, d0, d1, d01, chsq, time, dtime, zshift, remclu_ind); + fit_segment(fitclus, lpos000, s0, s1, d0, d1, d01, chsq, time, dtime, zshift, ctx, remclu_ind); returned_chsq = chsq; } @@ -476,7 +476,7 @@ find_outlier_cluster(const ICscSegmentFinder::TrkClusters& clus, const Amg::Vect void CscSegmentUtilTool:: fit_residual(const ICscSegmentFinder::TrkClusters& clus, const Amg::Vector3D& lpos000, unsigned int irclu, - double& res, double& dres) const { + double& res, double& dres, const EventContext& ctx) const { ATH_MSG_DEBUG ( "CscSegmentUtilTool::fit_residual called " ); ICscSegmentFinder::TrkClusters fitclus; @@ -485,7 +485,7 @@ fit_residual(const ICscSegmentFinder::TrkClusters& clus, const Amg::Vector3D& lp } // Fit cluster. double s0, s1, d0, d1, d01, chsq, time, dtime, zshift; - fit_segment(fitclus, lpos000, s0, s1, d0, d1, d01, chsq, time, dtime, zshift); + fit_segment(fitclus, lpos000, s0, s1, d0, d1, d01, chsq, time, dtime, zshift, ctx); // Extract excluded cluster paramters. const CscClusterOnTrack *cot = clus[irclu].cl; @@ -808,12 +808,12 @@ spoiled_count(const ICscSegmentFinder::RioList& rios, int& nspoil, int& nunspoil // Use 0+/-1000 for the missing position and pi/2+/-1 for the missing direction. MuonSegment* CscSegmentUtilTool:: -build_segment(const ICscSegmentFinder::Segment& seg, bool measphi, Identifier chid, bool use2Lay) const { +build_segment(const ICscSegmentFinder::Segment& seg, bool measphi, Identifier chid, bool use2Lay, const EventContext& ctx) const { // chid from any last cluster in given chamber ATH_MSG_DEBUG ( "Building csc segment." ); - SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey, ctx}; const MuonGM::MuonDetectorManager* MuonDetMgr{*DetectorManagerHandle}; if(MuonDetMgr==nullptr){ ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); @@ -879,7 +879,7 @@ build_segment(const ICscSegmentFinder::Segment& seg, bool measphi, Identifier ch // Build list of RIO on track objects. ICscSegmentFinder::MbaseList* prios = new ICscSegmentFinder::MbaseList; - getRios(seg, prios, measphi); // if hit is in outlier, error is estimated in width/sqrt(12) + getRios(seg, prios, measphi, ctx); // if hit is in outlier, error is estimated in width/sqrt(12) // Fit quality. int ndof = int(prios->size()) - 2; @@ -981,7 +981,7 @@ build_segment(const ICscSegmentFinder::Segment& seg, bool measphi, Identifier ch ICscSegmentFinder::Segment seg_new; // Reconstruct segment in 2nd try with re-calibrated cluster position error seg_new.outlierid = seg.outlierid; - fit_segment(fitclus, lpos000, seg_new.s0, seg_new.s1, seg_new.d0, seg_new.d1, seg_new.d01, seg_new.chsq, seg_new.time, seg_new.dtime, seg_new.zshift, seg.outlierid); + fit_segment(fitclus, lpos000, seg_new.s0, seg_new.s1, seg_new.d0, seg_new.d1, seg_new.d01, seg_new.chsq, seg_new.time, seg_new.dtime, seg_new.zshift, ctx, seg.outlierid); ATH_MSG_DEBUG("build_segments:: " << seg_new.time << " " << seg_new.dtime << " fitclus size " << fitclus.size() ); if (seg.outlierid >= 0) @@ -1089,7 +1089,7 @@ void CscSegmentUtilTool:: find_2dsegments(bool measphi, int station, int eta, int phi, const ICscSegmentFinder::ChamberTrkClusters& chclus, const Amg::Vector3D& lpos000, ICscSegmentFinder::Segments& segs, - double lpos, double lslope) const { + double lpos, double lslope, const EventContext& ctx) const { if (msgLvl(MSG::DEBUG)) { ATH_MSG_DEBUG ( "find_2dsegments called!! ID: " << measphi_name(measphi) << " " << std::showpos << eta << " " << station_name(station) << " " << phi << " " ); @@ -1124,7 +1124,7 @@ find_2dsegments(bool measphi, int station, int eta, int phi, seg.s0 = lpos; seg.s1 = lslope; - fit_segment(fitclus, lpos000, seg.s0, seg.s1, seg.d0, seg.d1, seg.d01, seg.chsq, seg.time, seg.dtime, seg.zshift); + fit_segment(fitclus, lpos000, seg.s0, seg.s1, seg.d0, seg.d1, seg.d01, seg.chsq, seg.time, seg.dtime, seg.zshift, ctx); seg.clus[0] = *icl1; seg.clus[1] = *icl2; seg.clus[2] = *icl3; @@ -1154,7 +1154,7 @@ find_2dsegments(bool measphi, int station, int eta, int phi, if(!keep) { // chi2 after outlier removal on 4 hit segments. double outlierRemoved_chsq; - int ioutlierid = find_outlier_cluster(seg.clus, lpos000, outlierRemoved_chsq); + int ioutlierid = find_outlier_cluster(seg.clus, lpos000, outlierRemoved_chsq, ctx); if(ioutlierid>0&&outlierRemoved_chsq<m_max_chisquare_tight) { keep = true; seg.chsq = outlierRemoved_chsq; @@ -1440,7 +1440,7 @@ find_2dseg3hit(bool measphi, int station, int eta, int phi, const ICscSegmentFinder::ChamberTrkClusters& chclus, const Amg::Vector3D& lpos000, ICscSegmentFinder::Segments& segs, ICscSegmentFinder::Segments& segs4hit, - double lpos, double lslope) const { + double lpos, double lslope, const EventContext& ctx) const { ATH_MSG_DEBUG("find_2dseg3hit called"); @@ -1492,7 +1492,7 @@ find_2dseg3hit(bool measphi, int station, int eta, int phi, // Calculate chi2 for this segment. seg.s0 = lpos; seg.s1 = lslope; - fit_segment(fitclus, lpos000, seg.s0, seg.s1, seg.d0, seg.d1, seg.d01, seg.chsq, seg.time, seg.dtime, seg.zshift); + fit_segment(fitclus, lpos000, seg.s0, seg.s1, seg.d0, seg.d1, seg.d01, seg.chsq, seg.time, seg.dtime, seg.zshift, ctx); // Count number of unspoiled clusters int nunspoil=0; @@ -1522,7 +1522,7 @@ find_2dseg3hit(bool measphi, int station, int eta, int phi, if(!keep) { // chi2 after outlier removal on 3 hit segments. double outlierRemoved_chsq; - int ioutlierid = find_outlier_cluster(fitclus, lpos000, outlierRemoved_chsq); + int ioutlierid = find_outlier_cluster(fitclus, lpos000, outlierRemoved_chsq, ctx); if(ioutlierid>-1&&outlierRemoved_chsq<m_max_chisquare_tight) { keep = true; seg.chsq = outlierRemoved_chsq; @@ -1551,7 +1551,7 @@ void CscSegmentUtilTool:: find_2dseg2hit(bool measphi, int station, int eta, int phi, int layStat, const ICscSegmentFinder::ChamberTrkClusters& chclus, const Amg::Vector3D& lpos000, ICscSegmentFinder::Segments& segs, - double lpos, double lslope) const { + double lpos, double lslope, const EventContext& ctx) const { ATH_MSG_DEBUG("find_2dseg2hit called"); // List of possible combinations for three hits. @@ -1600,7 +1600,7 @@ find_2dseg2hit(bool measphi, int station, int eta, int phi, int layStat, ICscSegmentFinder::Segment seg; seg.s0 = lpos; seg.s1 = lslope; - fit_segment(fitclus, lpos000, seg.s0, seg.s1, seg.d0, seg.d1, seg.d01, seg.chsq, seg.time, seg.dtime, seg.zshift); + fit_segment(fitclus, lpos000, seg.s0, seg.s1, seg.d0, seg.d1, seg.d01, seg.chsq, seg.time, seg.dtime, seg.zshift, ctx); // Count number of unspoiled clusters int nunspoil=0; @@ -1692,7 +1692,7 @@ fit_detailCalcPart2(double q0, double q1, double q2, double q01, double q11, dou MuonSegmentCombination* CscSegmentUtilTool:: -get4dMuonSegmentCombination( const MuonSegmentCombination* insegs ) const { +get4dMuonSegmentCombination( const MuonSegmentCombination* insegs, const EventContext& ctx ) const { ATH_MSG_DEBUG("get4dMuonSegmentCombination called"); const ICscSegmentFinder::SegmentVec& rsegs = *insegs->stationSegments(0); @@ -1708,7 +1708,7 @@ get4dMuonSegmentCombination( const MuonSegmentCombination* insegs ) const { return pcol; } - SG::ReadHandle<xAOD::EventInfo> eventInfo(m_eventInfo); + SG::ReadHandle<xAOD::EventInfo> eventInfo(m_eventInfo, ctx); std::unique_ptr<ICscSegmentFinder::SegmentVec> pnewsegs(new ICscSegmentFinder::SegmentVec); if(insegs->useStripsInSegment(1) && insegs->useStripsInSegment(0)){ @@ -1802,15 +1802,15 @@ MuonSegmentCombination* CscSegmentUtilTool:: get4dMuonSegmentCombination( Identifier eta_id, Identifier phi_id, ICscSegmentFinder::ChamberTrkClusters& eta_clus, ICscSegmentFinder::ChamberTrkClusters& phi_clus, - const Amg::Vector3D& lpos000 ) const { + const Amg::Vector3D& lpos000, const EventContext& ctx ) const { ATH_MSG_DEBUG (" get4dMuonSegmentCombination called "); MuonSegmentCombination* Muon2dSegComb - = get2dMuonSegmentCombination(eta_id, phi_id, eta_clus, phi_clus,lpos000 ); + = get2dMuonSegmentCombination(eta_id, phi_id, eta_clus, phi_clus,lpos000, ctx ); MuonSegmentCombination* Muon4dSegComb - = get4dMuonSegmentCombination(Muon2dSegComb); + = get4dMuonSegmentCombination(Muon2dSegComb, ctx); delete Muon2dSegComb; @@ -2097,7 +2097,7 @@ get2dSegments( Identifier eta_id, Identifier phi_id, ICscSegmentFinder::ChamberTrkClusters& eta_clus, ICscSegmentFinder::ChamberTrkClusters& phi_clus, ICscSegmentFinder::Segments& eta_segs, ICscSegmentFinder::Segments& phi_segs, - const Amg::Vector3D& lpos000, int etaStat, int phiStat ) const { + const Amg::Vector3D& lpos000, const EventContext& ctx, int etaStat, int phiStat ) const { if( !eta_id.is_valid() && !phi_id.is_valid() ){ ATH_MSG_WARNING("in get2dSegments: got two invalid identifiers" ); @@ -2125,12 +2125,12 @@ get2dSegments( Identifier eta_id, Identifier phi_id, double slope_phi = -999; // Find 2D segments. - find_2dsegments(false, col_station, col_eta, col_phisec, eta_clus, lpos000, eta_segs, pos_eta, slope_eta); - find_2dsegments(true, col_station, col_eta, col_phisec, phi_clus, lpos000, phi_segs, pos_phi, slope_phi); + find_2dsegments(false, col_station, col_eta, col_phisec, eta_clus, lpos000, eta_segs, pos_eta, slope_eta, ctx); + find_2dsegments(true, col_station, col_eta, col_phisec, phi_clus, lpos000, phi_segs, pos_phi, slope_phi, ctx); // Find 3-hit 2D segments. - find_2dseg3hit(false, col_station, col_eta, col_phisec, eta_clus, lpos000, eta_segs3hit, eta_segs, pos_eta, slope_eta); - find_2dseg3hit(true, col_station, col_eta, col_phisec, phi_clus, lpos000, phi_segs3hit, phi_segs, pos_phi, slope_phi); + find_2dseg3hit(false, col_station, col_eta, col_phisec, eta_clus, lpos000, eta_segs3hit, eta_segs, pos_eta, slope_eta, ctx); + find_2dseg3hit(true, col_station, col_eta, col_phisec, phi_clus, lpos000, phi_segs3hit, phi_segs, pos_phi, slope_phi, ctx); // Add 3-hit segments to 4-hit segments. add_2dsegments(eta_segs, eta_segs3hit); @@ -2146,7 +2146,7 @@ get2dSegments( Identifier eta_id, Identifier phi_id, ICscSegmentFinder::Segments eta_segs2hit; ATH_MSG_VERBOSE ( " start find_2dseg2hit eta "); - find_2dseg2hit(false, col_station, col_eta, col_phisec, etaStat, eta_clus, lpos000, eta_segs2hit, pos_eta, slope_eta); + find_2dseg2hit(false, col_station, col_eta, col_phisec, etaStat, eta_clus, lpos000, eta_segs2hit, pos_eta, slope_eta, ctx); // store 2-hit segments ATH_MSG_VERBOSE ( " store 2hit eta segments"); @@ -2156,7 +2156,7 @@ get2dSegments( Identifier eta_id, Identifier phi_id, // Find 2-hit 2D segments for eta. ICscSegmentFinder::Segments phi_segs2hit; ATH_MSG_VERBOSE ( " start find_2dseg2hit phi "); - find_2dseg2hit(true, col_station, col_eta, col_phisec, phiStat, phi_clus, lpos000, phi_segs2hit, pos_phi, slope_phi); + find_2dseg2hit(true, col_station, col_eta, col_phisec, phiStat, phi_clus, lpos000, phi_segs2hit, pos_phi, slope_phi, ctx); ATH_MSG_VERBOSE ( " store 2hit phi segments"); add_2dseg2hits(phi_segs, phi_segs2hit, phiStat); } @@ -2200,7 +2200,7 @@ unique_hits(ICscSegmentFinder::TrkClusters& fitclus, ICscSegmentFinder::Segments ///////////////////////////////////// // if hit is in outlier, error is estimated in width/sqrt(12) void CscSegmentUtilTool::getRios(const ICscSegmentFinder::Segment& seg, - ICscSegmentFinder::MbaseList* prios, bool measphi) const { + ICscSegmentFinder::MbaseList* prios, bool measphi, const EventContext& ctx) const { // Getting CscPrepData for ( int iclu=0; iclu<seg.nclus; ++iclu ) { const CscClusterOnTrack* pclu = seg.clus[iclu].cl; @@ -2212,7 +2212,7 @@ void CscSegmentUtilTool::getRios(const ICscSegmentFinder::Segment& seg, // get prep raw data. const CscPrepData *prd = pclu->prepRawData(); - double err = getDefaultError(id, measphi, prd); + double err = getDefaultError(id, measphi, prd, ctx); Amg::MatrixX cov(1,1); cov(0,0) = err*err; @@ -2236,10 +2236,10 @@ void CscSegmentUtilTool::getRios(const ICscSegmentFinder::Segment& seg, /////////////////////////////// double CscSegmentUtilTool:: -getDefaultError (Identifier id, bool measphi, const CscPrepData *prd ) const { +getDefaultError (Identifier id, bool measphi, const CscPrepData *prd, const EventContext& ctx ) const { const std::vector<Identifier>& strip_ids = prd->rdoList(); unsigned int nstrip = strip_ids.size(); - SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey, ctx}; const MuonGM::MuonDetectorManager* MuonDetMgr{*DetectorManagerHandle}; if(MuonDetMgr==nullptr){ ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); @@ -2379,15 +2379,15 @@ double CscSegmentUtilTool::qratio_like(const double pdf_sig, const double pdf_bk return like; } -bool CscSegmentUtilTool::isGood(const uint32_t stripHashId) const { - unsigned int status = stripStatusBit(stripHashId); +bool CscSegmentUtilTool::isGood(const uint32_t stripHashId, const EventContext& ctx) const { + unsigned int status = stripStatusBit(stripHashId, ctx); bool is_good = !( (status & 0x1) || ((status >> 1) & 0x1) ); // test for hot/dead channel return is_good; } -int CscSegmentUtilTool::stripStatusBit (const uint32_t stripHashId ) const { +int CscSegmentUtilTool::stripStatusBit (const uint32_t stripHashId, const EventContext& ctx ) const { - SG::ReadCondHandle<CscCondDbData> readHandle{m_readKey}; + SG::ReadCondHandle<CscCondDbData> readHandle{m_readKey, ctx}; const CscCondDbData* readCdo{*readHandle}; int status = 0; diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/CscSegmentUtilTool.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/CscSegmentUtilTool.h index a6ad623a4f2e5739769adcf215acb6065e36c10e..7f9cbe35fa220b64ee437bcdfbbe7d8123bddbde 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/CscSegmentUtilTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/CscSegmentUtilTool.h @@ -51,7 +51,7 @@ public: getMuonSegments(Identifier eta_id, Identifier phi_id, ICscSegmentFinder::ChamberTrkClusters& eta_clus, ICscSegmentFinder::ChamberTrkClusters& phi_clus, - const Amg::Vector3D& lpos000 ) const; + const Amg::Vector3D& lpos000, const EventContext& ctx ) const; //////////////////////////////////////// // calls get2dMuonSegmentCombination and get4dMuonSegmentCombination with 2d segments!! @@ -59,10 +59,10 @@ public: get4dMuonSegmentCombination(Identifier eta_id, Identifier phi_id, ICscSegmentFinder::ChamberTrkClusters& eta_clus, ICscSegmentFinder::ChamberTrkClusters& phi_clus, - const Amg::Vector3D& lpos000) const; + const Amg::Vector3D& lpos000, const EventContext& ctx) const; Muon::MuonSegmentCombination* - get4dMuonSegmentCombination(const Muon::MuonSegmentCombination* Muon2dSegComb) const; + get4dMuonSegmentCombination(const Muon::MuonSegmentCombination* Muon2dSegComb, const EventContext& ctx) const; //get2dMuonSegmentCombination : get2dSegments does // -> (1) find_2dsegments (2) find_2dseg3hit (3) add_2dsegments @@ -70,7 +70,7 @@ public: get2dMuonSegmentCombination(Identifier eta_id, Identifier phi_id, ICscSegmentFinder::ChamberTrkClusters& eta_clus, ICscSegmentFinder::ChamberTrkClusters& phi_clus, - const Amg::Vector3D& lpos000, int etaStat=0, int phiStat=0 ) const; + const Amg::Vector3D& lpos000, const EventContext& ctx, int etaStat=0, int phiStat=0 ) const; // Return the counts of spoiled and unspoiled measurements from a list @@ -123,7 +123,7 @@ private: "Key of input MuonDetectorManager condition data"}; // Convert a local 2D segment to MuonSegment - Muon::MuonSegment* build_segment(const ICscSegmentFinder::Segment& seg, bool measphi, Identifier chid, bool use2Lay) const; + Muon::MuonSegment* build_segment(const ICscSegmentFinder::Segment& seg, bool measphi, Identifier chid, bool use2Lay, const EventContext& ctx) const; // Fit a list of RIO's to form a 2D segment. // The fit is relative to the passsed surface. called by fit_rio_residual @@ -137,7 +137,7 @@ private: // rslu is cluster for which residual is calculated // res, dres = residual and error in residual // looks obsolete void fit_residual(const ICscSegmentFinder::TrkClusters& clus, const Amg::Vector3D& lpos000, unsigned int irclu, - double& res, double& dres) const; + double& res, double& dres, const EventContext& ctx) const; // Find segments in a chamber. @@ -145,19 +145,19 @@ private: void find_2dsegments(bool measphi, int station, int eta, int phi, const ICscSegmentFinder::ChamberTrkClusters& clus, const Amg::Vector3D& lpos000, ICscSegmentFinder::Segments& segs, - double localPos, double localSlope) const; + double localPos, double localSlope, const EventContext& ctx) const; // Find 3 hit segments in a chamber. void find_2dseg3hit(bool measphi, int station, int eta, int phi, const ICscSegmentFinder::ChamberTrkClusters& clus, const Amg::Vector3D& lpos000, ICscSegmentFinder::Segments& segs, ICscSegmentFinder::Segments& segs4hit, - double localPos, double localSlope) const; + double localPos, double localSlope, const EventContext& ctx) const; // Find 2 hit segments in a chamber. void find_2dseg2hit(bool measphi, int station, int eta, int phi, int layStat, const ICscSegmentFinder::ChamberTrkClusters& clus, const Amg::Vector3D& lpos000, ICscSegmentFinder::Segments& segs, - double localPos, double localSlope) const; + double localPos, double localSlope, const EventContext& ctx) const; /** Adds 3-hit segments to 4-hit segments **/ void add_2dsegments(ICscSegmentFinder::Segments &segs4, ICscSegmentFinder::Segments &segs3) const; @@ -172,7 +172,7 @@ private: ICscSegmentFinder::ChamberTrkClusters& eta_clus, ICscSegmentFinder::ChamberTrkClusters& phi_clus, ICscSegmentFinder::Segments& etasegs, ICscSegmentFinder::Segments& phisegs, - const Amg::Vector3D& lpos000, int etaStat=0, int phiStat=0 ) const; + const Amg::Vector3D& lpos000, const EventContext& ctx, int etaStat=0, int phiStat=0 ) const; Muon::MuonSegment* make_4dMuonSegment(const Muon::MuonSegment& rsg, const Muon::MuonSegment& psg, bool use2LaySegsEta, bool use2LaySegsPhi) const; @@ -181,7 +181,7 @@ private: returns 'n' th cluster ( n = 0-3 ) Finding is proceeded only for N_unspoiled_clusters >=3 otherwise it returns -1 meaning N_unspoiled_clusters <= 2 */ - int find_outlier_cluster(const ICscSegmentFinder::TrkClusters& clus, const Amg::Vector3D& lpos000, double& returned_chsq) const; + int find_outlier_cluster(const ICscSegmentFinder::TrkClusters& clus, const Amg::Vector3D& lpos000, double& returned_chsq, const EventContext& ctx) const; /***** Fit a 2D segment. *****/ /* clus = input list of clusters @@ -194,7 +194,7 @@ private: // time/dtime is added in Feb 17, 2011 void fit_segment(const ICscSegmentFinder::TrkClusters& clus, const Amg::Vector3D& lpos000, double& s0, double& s1, double& d0, double& d1, double& d01, double& chsq, - double& time, double& dtime, double& zshift, + double& time, double& dtime, double& zshift, const EventContext& ctx, int outlierLayer=-1) const; @@ -203,14 +203,14 @@ private: void fit_detailCalcPart1(const ICscSegmentFinder::TrkClusters& clus, const Amg::Vector3D& lpos000, double& s0, double& s1, double& d0, double& d1, double& d01, double& chsq, bool& measphi, double& time, double& dtime, double& zshift, - bool IsSlopeGive, int outlierHitLayer) const; + bool IsSlopeGive, int outlierHitLayer, const EventContext& ctx) const; void fit_detailCalcPart2(double q0, double q1, double q2, double q01, double q11, double q02, double& s0, double& s1, double& d0, double& d1, double& d01, double& chsq) const; - double getDefaultError ( Identifier id, bool measphi, const Muon::CscPrepData *prd ) const; + double getDefaultError ( Identifier id, bool measphi, const Muon::CscPrepData *prd, const EventContext& ctx ) const; - void getRios(const ICscSegmentFinder::Segment& seg, ICscSegmentFinder::MbaseList* prios, bool measphi) const; + void getRios(const ICscSegmentFinder::Segment& seg, ICscSegmentFinder::MbaseList* prios, bool measphi, const EventContext& ctx) const; // if hit is in outlier, error is estimated in width/sqrt(12) // For future, error estimate should be from CscClusterUtilTool. @@ -228,8 +228,8 @@ private: // Likelihood function = psig/(psig +pbkg) double qratio_like(const double pdf_sig, const double pdf_bkg) const; - bool isGood(const uint32_t stripHashId) const; - int stripStatusBit(const uint32_t stripHashId) const; + bool isGood(const uint32_t stripHashId, const EventContext& ctx) const; + int stripStatusBit(const uint32_t stripHashId, const EventContext& ctx) const; }; diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/components/CscSegmentMakers_entries.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/components/CscSegmentMakers_entries.cxx index 1286df9216fa8ab7f5c4a0b25f6149242b1cb7c2..f4d9c2b719db87f6bbcaf73e1ee33c92033c8ce9 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/components/CscSegmentMakers_entries.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/components/CscSegmentMakers_entries.cxx @@ -1,9 +1,7 @@ -#include "../CscSegmentMaker.h" #include "../Csc2dSegmentMaker.h" #include "../Csc4dSegmentMaker.h" #include "../CscSegmentUtilTool.h" -DECLARE_COMPONENT( CscSegmentMaker ) DECLARE_COMPONENT( Csc2dSegmentMaker ) DECLARE_COMPONENT( Csc4dSegmentMaker ) DECLARE_COMPONENT( CscSegmentUtilTool ) diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonLayerSegmentMakerTools/src/MuonLayerSegmentFinderTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonLayerSegmentMakerTools/src/MuonLayerSegmentFinderTool.cxx index b04820e76eb7a3caab0c09f039a32574cf0eaf68..b6f029a30b2141d71c443df17f9cf0eacdac986a 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonLayerSegmentMakerTools/src/MuonLayerSegmentFinderTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonLayerSegmentMakerTools/src/MuonLayerSegmentFinderTool.cxx @@ -41,7 +41,7 @@ MuonLayerSegmentFinderTool::initialize() void MuonLayerSegmentFinderTool::find(const MuonSystemExtension::Intersection& intersection, std::vector<std::shared_ptr<const Muon::MuonSegment> >& segments, - MuonLayerPrepRawData& layerPrepRawData) const + MuonLayerPrepRawData& layerPrepRawData, const EventContext& ctx) const { ATH_MSG_VERBOSE(" Running segment finding in sector " @@ -55,7 +55,7 @@ MuonLayerSegmentFinderTool::find(const MuonSystemExtension::Intersection& << intersection.trackParameters->position().phi()); // run cluster hit based segment finding on PRDs - findClusterSegments(intersection, layerPrepRawData, segments); + findClusterSegments(intersection, layerPrepRawData, segments, ctx); ATH_MSG_VERBOSE(" findClusterSegments " << segments.size()); // run standard MDT/Trigger hit segment finding either from Hough or hits @@ -280,11 +280,11 @@ MuonLayerSegmentFinderTool::findMdtSegments(const MuonSystemExtension::Intersect void MuonLayerSegmentFinderTool::findClusterSegments(const MuonSystemExtension::Intersection& intersection, const MuonLayerPrepRawData& layerPrepRawData, - std::vector<std::shared_ptr<const Muon::MuonSegment> >& segments) const + std::vector<std::shared_ptr<const Muon::MuonSegment> >& segments, const EventContext& ctx) const { // if there are CSC hits run CSC segment finding - if (!layerPrepRawData.cscs.empty()) findCscSegments(layerPrepRawData, segments); + if (!layerPrepRawData.cscs.empty()) findCscSegments(layerPrepRawData, segments, ctx); // find TGC segments // if( !layerPrepRawData.tgcs.empty() && intersection.layerSurface.layerIndex == MuonStationIndex::Middle ) { @@ -333,15 +333,15 @@ MuonLayerSegmentFinderTool::findClusterSegments(const MuonSystemExtension::Inter void MuonLayerSegmentFinderTool::findCscSegments(const MuonLayerPrepRawData& layerPrepRawData, - std::vector<std::shared_ptr<const Muon::MuonSegment> >& segments) const + std::vector<std::shared_ptr<const Muon::MuonSegment> >& segments, const EventContext& ctx) const { // run 2d segment finder - std::unique_ptr<MuonSegmentCombinationCollection> combi2D = m_csc2dSegmentFinder->find(layerPrepRawData.cscs); + std::unique_ptr<MuonSegmentCombinationCollection> combi2D = m_csc2dSegmentFinder->find(layerPrepRawData.cscs, ctx); if (combi2D) { // run 4d segment finder - std::unique_ptr<MuonSegmentCombinationCollection> combi4D = m_csc4dSegmentFinder->find(*combi2D); + std::unique_ptr<MuonSegmentCombinationCollection> combi4D = m_csc4dSegmentFinder->find(*combi2D, ctx); if (combi4D) { // extract segments and clean-up memory diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonLayerSegmentMakerTools/src/MuonLayerSegmentFinderTool.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonLayerSegmentMakerTools/src/MuonLayerSegmentFinderTool.h index c229d8689cfab8920ba1565b3fb1eee67114accb..b00a493edfc9e860d7d99ffddc2cb6d80e8afd6b 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonLayerSegmentMakerTools/src/MuonLayerSegmentFinderTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonLayerSegmentMakerTools/src/MuonLayerSegmentFinderTool.h @@ -41,17 +41,17 @@ class MuonLayerSegmentFinderTool : virtual public IMuonLayerSegmentFinderTool, p /**IMuonLayerSegmentFinderTool interface: find */ void find(const MuonSystemExtension::Intersection& intersection, std::vector<std::shared_ptr<const Muon::MuonSegment> >& segments, - MuonLayerPrepRawData& layerPrepRawData) const; + MuonLayerPrepRawData& layerPrepRawData, const EventContext& ctx) const; private: /** find segments from PRD clusters */ void findClusterSegments(const MuonSystemExtension::Intersection& intersection, const MuonLayerPrepRawData& layerPrepRawData, - std::vector<std::shared_ptr<const Muon::MuonSegment> >& segments) const; + std::vector<std::shared_ptr<const Muon::MuonSegment> >& segments, const EventContext& ctx) const; /** find csc segments */ void findCscSegments(const MuonLayerPrepRawData& layerPrepRawData, - std::vector<std::shared_ptr<const Muon::MuonSegment> >& segments) const; + std::vector<std::shared_ptr<const Muon::MuonSegment> >& segments, const EventContext& ctx) const; /** find mdt segments from hits in the layer */ void findMdtSegments(const MuonSystemExtension::Intersection& intersection, diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMakerToolInterfaces/MuonSegmentMakerToolInterfaces/IMuonLayerSegmentFinderTool.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMakerToolInterfaces/MuonSegmentMakerToolInterfaces/IMuonLayerSegmentFinderTool.h index 15a4092507022b7c2590cdb40caac3c6341354d7..9ab570e9a99ae9ce5dbd57d5f3c982e13fd22bf8 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMakerToolInterfaces/MuonSegmentMakerToolInterfaces/IMuonLayerSegmentFinderTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMakerToolInterfaces/MuonSegmentMakerToolInterfaces/IMuonLayerSegmentFinderTool.h @@ -26,7 +26,7 @@ namespace Muon { /** @brief Find segments for a given MuonSystemExtension::Intersection */ virtual void find( const MuonSystemExtension::Intersection& intersection, std::vector< std::shared_ptr<const Muon::MuonSegment> >& segments, - MuonLayerPrepRawData& layerPrepRawData) const = 0; + MuonLayerPrepRawData& layerPrepRawData, const EventContext& ctx) const = 0; }; diff --git a/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedInDetExtensionAlg.cxx b/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedInDetExtensionAlg.cxx index 7c1300ffbc1709bbd8147fa2b8abf1b0550c8eae..a45343d9b6ca0cccda7c4086bb3cd295327a824e 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedInDetExtensionAlg.cxx +++ b/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedInDetExtensionAlg.cxx @@ -88,11 +88,11 @@ MuonCombinedInDetExtensionAlg::execute(const EventContext& ctx) const SG::ReadHandle<Muon::TgcPrepDataContainer> tgcPRDContainer(m_TGC_ContainerName, ctx); prdData.tgcPrds = tgcPRDContainer.cptr(); for (auto& tool : m_muonCombinedInDetExtensionTools) { - tool->extendWithPRDs(*indetCandidateCollection, tagMap.ptr(), prdData, combTracks, meTracks, segments); + tool->extendWithPRDs(*indetCandidateCollection, tagMap.ptr(), prdData, combTracks, meTracks, segments, ctx); } } else { for (auto& tool : m_muonCombinedInDetExtensionTools) { - tool->extend(*indetCandidateCollection, tagMap.ptr(), combTracks, meTracks, segments); + tool->extend(*indetCandidateCollection, tagMap.ptr(), combTracks, meTracks, segments, ctx); } } diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCaloTagTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCaloTagTool.cxx index ca60528fc6c9fb63ec0cacb786b90c7e85a6ad85..bb9f699334024ab3f2fcbe7ae6b100b7673711e9 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCaloTagTool.cxx +++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCaloTagTool.cxx @@ -87,26 +87,26 @@ namespace MuonCombined { } void MuonCaloTagTool::extendWithPRDs( const InDetCandidateCollection& inDetCandidates, InDetCandidateToTagMap* tagMap, IMuonCombinedInDetExtensionTool::MuonPrdData prdData, - TrackCollection* combTracks, TrackCollection* meTracks, Trk::SegmentCollection* segments) const { + TrackCollection* combTracks, TrackCollection* meTracks, Trk::SegmentCollection* segments, const EventContext& ctx) const { //shouldn't need this interface for this tool, I don't think if(!prdData.mdtPrds) ATH_MSG_DEBUG("calo-tagging doesn't need PRDs"); - extend(inDetCandidates, tagMap, combTracks, meTracks, segments); + extend(inDetCandidates, tagMap, combTracks, meTracks, segments, ctx); } void MuonCaloTagTool::extend( const InDetCandidateCollection& inDetCandidates, InDetCandidateToTagMap* tagMap, TrackCollection* combTracks, TrackCollection* meTracks, - Trk::SegmentCollection* segments) const { + Trk::SegmentCollection* segments, const EventContext& ctx) const { if(combTracks || meTracks || segments) ATH_MSG_DEBUG("track collections passed to MuonCaloTagTool?"); const xAOD::CaloClusterContainer* caloClusterCont=0; const CaloCellContainer* caloCellCont=0; if(m_doCaloLR){ //retrieve the xAOD::CaloClusterContainer - SG::ReadHandle<xAOD::CaloClusterContainer> clusters(m_caloClusterCont); + SG::ReadHandle<xAOD::CaloClusterContainer> clusters(m_caloClusterCont, ctx); if(!clusters.isValid()) ATH_MSG_WARNING("CaloClusterContainer "<<m_caloClusterCont.key()<<" not valid"); else if(!clusters.isPresent()) ATH_MSG_DEBUG("CaloClusterContainer "<<m_caloClusterCont.key()<<" not present"); else caloClusterCont=clusters.cptr(); } if(m_doOldExtrapolation){ //retrieve the CaloCellContainer - SG::ReadHandle<CaloCellContainer> cells(m_caloCellCont); + SG::ReadHandle<CaloCellContainer> cells(m_caloCellCont, ctx); if(!cells.isValid()) ATH_MSG_WARNING("CaloCellContainer "<<m_caloCellCont.key()<<" not valid"); else if(!cells.isPresent()) ATH_MSG_DEBUG("CaloCellContainer "<<m_caloCellCont.key()<<" not present"); else caloCellCont=cells.cptr(); diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCaloTagTool.h b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCaloTagTool.h index 53a5e3ffd7ddbdafca8f454a158909b280db7f22..133653479403171de34b382d135ff818a2821d22 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCaloTagTool.h +++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCaloTagTool.h @@ -47,7 +47,7 @@ namespace MuonCombined { /**IMuonCombinedInDetExtensionTool interface: extend ID candidate */ virtual void extend( const InDetCandidateCollection& inDetCandidates, InDetCandidateToTagMap* tagMap, TrackCollection* combTracks, TrackCollection* meTracks, - Trk::SegmentCollection* segments ) const override; + Trk::SegmentCollection* segments, const EventContext& ctx ) const override; virtual void extend( const InDetCandidateCollection& inDetCandidates, InDetCandidateToTagMap* tagMap, @@ -55,7 +55,7 @@ namespace MuonCombined { const xAOD::CaloClusterContainer* caloClusterContainer) const override; virtual void extendWithPRDs(const InDetCandidateCollection& inDetCandidates, InDetCandidateToTagMap* tagMap, IMuonCombinedInDetExtensionTool::MuonPrdData prdData, - TrackCollection* combTracks, TrackCollection* meTracks, Trk::SegmentCollection* segments) const override; + TrackCollection* combTracks, TrackCollection* meTracks, Trk::SegmentCollection* segments, const EventContext& ctx) const override; private: diff --git a/Reconstruction/MuonIdentification/MuonCombinedToolInterfaces/MuonCombinedToolInterfaces/IMuonCombinedInDetExtensionTool.h b/Reconstruction/MuonIdentification/MuonCombinedToolInterfaces/MuonCombinedToolInterfaces/IMuonCombinedInDetExtensionTool.h index e92c2f9eba6c47ff505c79f9a4f0dafb4439e7c5..8dfed7b8337b9a16f8f30874b4f5bbb2148f890c 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedToolInterfaces/MuonCombinedToolInterfaces/IMuonCombinedInDetExtensionTool.h +++ b/Reconstruction/MuonIdentification/MuonCombinedToolInterfaces/MuonCombinedToolInterfaces/IMuonCombinedInDetExtensionTool.h @@ -41,11 +41,11 @@ namespace MuonCombined { /**IMuonCombinedInDetExtensionTool interface: build combined muons from ID candidates */ virtual void extend( const InDetCandidateCollection& inDetCandidates, InDetCandidateToTagMap* tagMap, TrackCollection* combTracks, TrackCollection* meTracks, - Trk::SegmentCollection* segments) const = 0; + Trk::SegmentCollection* segments, const EventContext& ctx) const = 0; /*New interface including PRDs for MuGirl segment-finding*/ virtual void extendWithPRDs( const InDetCandidateCollection& inDetCandidates, InDetCandidateToTagMap* tagMap, IMuonCombinedInDetExtensionTool::MuonPrdData prdData, - TrackCollection* combTracks, TrackCollection* meTracks, Trk::SegmentCollection* segments) const = 0; + TrackCollection* combTracks, TrackCollection* meTracks, Trk::SegmentCollection* segments, const EventContext& ctx) const = 0; void cleanUp() const {}; diff --git a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonInsideOutRecoTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonInsideOutRecoTool.cxx index aa706e8ee277e77945e09ac8e687511143faedd8..dc13cf9f1dc544dcaebb748e8231d7e620907bed 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonInsideOutRecoTool.cxx +++ b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonInsideOutRecoTool.cxx @@ -40,25 +40,25 @@ namespace MuonCombined { } void MuonInsideOutRecoTool::extend( const InDetCandidateCollection& inDetCandidates, InDetCandidateToTagMap* tagMap, TrackCollection* combTracks, TrackCollection* meTracks, - Trk::SegmentCollection* segments) const { + Trk::SegmentCollection* segments, const EventContext& ctx) const { ATH_MSG_WARNING("This version is deprecated, please use extendWithPRDs for MuGirl"); IMuonCombinedInDetExtensionTool::MuonPrdData prdData; - extendWithPRDs(inDetCandidates,tagMap,prdData,combTracks,meTracks,segments); + extendWithPRDs(inDetCandidates,tagMap,prdData,combTracks,meTracks,segments, ctx); } void MuonInsideOutRecoTool::extendWithPRDs( const InDetCandidateCollection& inDetCandidates, InDetCandidateToTagMap* tagMap, IMuonCombinedInDetExtensionTool::MuonPrdData prdData, - TrackCollection* combTracks, TrackCollection* meTracks, Trk::SegmentCollection* segments) const { + TrackCollection* combTracks, TrackCollection* meTracks, Trk::SegmentCollection* segments, const EventContext& ctx) const { ATH_MSG_DEBUG(" extending " << inDetCandidates.size() ); InDetCandidateCollection::const_iterator it = inDetCandidates.begin(); InDetCandidateCollection::const_iterator it_end = inDetCandidates.end(); for( ; it!=it_end;++it ){ - handleCandidate( **it,tagMap,prdData,combTracks,meTracks,segments ); + handleCandidate( **it,tagMap,prdData,combTracks,meTracks,segments, ctx ); } } void MuonInsideOutRecoTool::handleCandidate( const InDetCandidate& indetCandidate, InDetCandidateToTagMap* tagMap, IMuonCombinedInDetExtensionTool::MuonPrdData prdData, - TrackCollection* combTracks, TrackCollection* meTracks, Trk::SegmentCollection* segColl) const { + TrackCollection* combTracks, TrackCollection* meTracks, Trk::SegmentCollection* segColl, const EventContext& ctx) const { if( m_ignoreSiAssocated && indetCandidate.isSiliconAssociated() ) { ATH_MSG_DEBUG(" skip silicon associated track for extension "); @@ -97,7 +97,7 @@ namespace MuonCombined { ATH_MSG_WARNING("Failed to get layer data"); continue; } - m_segmentFinder->find( *it, segments, layerPrepRawData ); + m_segmentFinder->find( *it, segments, layerPrepRawData, ctx ); if( segments.empty() ) continue; // fill validation content diff --git a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonInsideOutRecoTool.h b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonInsideOutRecoTool.h index ac6543de0f5af79c5fd34e9d4952122af554d5b2..e8e0bc92b21b46378a011e6d2bb3b41ff73f1b09 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonInsideOutRecoTool.h +++ b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonInsideOutRecoTool.h @@ -55,11 +55,11 @@ namespace MuonCombined { /**IMuonCombinedInDetExtensionTool interface: extend ID candidate with PRDs for segment-finding */ virtual void extendWithPRDs( const InDetCandidateCollection& inDetCandidates, InDetCandidateToTagMap* tagMap, IMuonCombinedInDetExtensionTool::MuonPrdData prdData, - TrackCollection* combTracks, TrackCollection* meTracks, Trk::SegmentCollection* segments) const override; + TrackCollection* combTracks, TrackCollection* meTracks, Trk::SegmentCollection* segments, const EventContext& ctx) const override; /**IMuonCombinedInDetExtensionTool interface: deprecated*/ virtual void extend(const InDetCandidateCollection& inDetCandidates, InDetCandidateToTagMap* tagMap, TrackCollection* combTracks, TrackCollection* meTracks, - Trk::SegmentCollection* segments) const override; + Trk::SegmentCollection* segments, const EventContext& ctx) const override; /** find the best candidate for a given set of segments */ std::pair<std::unique_ptr<const Muon::MuonCandidate>,Trk::Track*> @@ -70,7 +70,7 @@ namespace MuonCombined { private: /** handle a single candidate */ void handleCandidate( const InDetCandidate& inDetCandidate, InDetCandidateToTagMap* tagMap, IMuonCombinedInDetExtensionTool::MuonPrdData prdData, - TrackCollection* combTracks, TrackCollection* meTracks, Trk::SegmentCollection* segments) const; + TrackCollection* combTracks, TrackCollection* meTracks, Trk::SegmentCollection* segments, const EventContext& ctx) const; /** add muon candidate to indet candidate */ void addTag( const InDetCandidate& indetCandidate, InDetCandidateToTagMap* tagMap, diff --git a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonStauRecoTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonStauRecoTool.cxx index d6d2213be5d5b0f7bc2c22bd4bf1366cc31356bd..c2663c47ffb76497f02965e1bc41ee7ddb64d86e 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonStauRecoTool.cxx +++ b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonStauRecoTool.cxx @@ -73,15 +73,15 @@ namespace MuonCombined { } void MuonStauRecoTool::extendWithPRDs( const InDetCandidateCollection& inDetCandidates, InDetCandidateToTagMap* tagMap, IMuonCombinedInDetExtensionTool::MuonPrdData prdData, - TrackCollection* combTracks, TrackCollection* meTracks, Trk::SegmentCollection* segments) const { + TrackCollection* combTracks, TrackCollection* meTracks, Trk::SegmentCollection* segments, const EventContext& ctx) const { // Maybe we'll need this later, I wouldn't be surprised if the PRDs are retrieved somewhere down the chain // For now it's just a placeholder though if(!prdData.mdtPrds) ATH_MSG_DEBUG("empty PRDs passed"); - extend(inDetCandidates, tagMap, combTracks, meTracks, segments); + extend(inDetCandidates, tagMap, combTracks, meTracks, segments, ctx); } void MuonStauRecoTool::extend( const InDetCandidateCollection& inDetCandidates, InDetCandidateToTagMap* tagMap, TrackCollection* combTracks, TrackCollection* meTracks, - Trk::SegmentCollection* segments) const { + Trk::SegmentCollection* segments, const EventContext&) const { ATH_MSG_DEBUG(" extending " << inDetCandidates.size() ); if(meTracks) ATH_MSG_DEBUG("Not currently creating ME tracks for staus"); diff --git a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonStauRecoTool.h b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonStauRecoTool.h index 6883f6e0efc0ef924be90e33e717fffaf1d7c825..d582c6c2111b2f22374ccedb0d902cddd838afe8 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonStauRecoTool.h +++ b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonStauRecoTool.h @@ -143,10 +143,10 @@ namespace MuonCombined { /**IMuonCombinedInDetExtensionTool interface: extend ID candidate */ virtual void extend( const InDetCandidateCollection& inDetCandidates, InDetCandidateToTagMap* tagMap, TrackCollection* combTracks, TrackCollection* meTracks, - Trk::SegmentCollection* segments) const override; + Trk::SegmentCollection* segments, const EventContext& ctx) const override; virtual void extendWithPRDs(const InDetCandidateCollection& inDetCandidates, InDetCandidateToTagMap* tagMap, IMuonCombinedInDetExtensionTool::MuonPrdData prdData, - TrackCollection* combTracks, TrackCollection* meTracks, Trk::SegmentCollection* segments ) const override; + TrackCollection* combTracks, TrackCollection* meTracks, Trk::SegmentCollection* segments, const EventContext& ctx ) const override; private: /** handle a single candidate */ diff --git a/Trigger/TrigAlgorithms/TrigMuSuperEF/src/TrigMuSuperEF.cxx b/Trigger/TrigAlgorithms/TrigMuSuperEF/src/TrigMuSuperEF.cxx index dcecd4429a918e7ec49a186372e1f26ec6558298..ead6487ccbf53df509006ba7ede22117b18ad5c6 100644 --- a/Trigger/TrigAlgorithms/TrigMuSuperEF/src/TrigMuSuperEF.cxx +++ b/Trigger/TrigAlgorithms/TrigMuSuperEF/src/TrigMuSuperEF.cxx @@ -1069,7 +1069,7 @@ HLT::ErrorCode TrigMuSuperEF::runStandardChain(const HLT::TriggerElement* inputT m_muGirlTrkSegColl=new Trk::SegmentCollection(); addElement(m_segsCache,m_muGirlTrkSegColl); - m_muGirlTool->extend(inDetCandidates,mugirlTagMap,m_combTrkTrackColl,m_extrTrkTrackColl,m_muGirlTrkSegColl); + m_muGirlTool->extend(inDetCandidates,mugirlTagMap,m_combTrkTrackColl,m_extrTrkTrackColl,m_muGirlTrkSegColl, ctx); ++m_counter_TrigMuGirl.pass;//@todo fix this counter @@ -1939,7 +1939,7 @@ HLT::ErrorCode TrigMuSuperEF::rebuildCache(const IRoiDescriptor* muonRoI, HLT::T m_muGirlTrkSegColl=new Trk::SegmentCollection(); addElement(m_segsCache,m_muGirlTrkSegColl); - m_muGirlTool->extend(*inDetCandidates,mugirlTagMap,m_combTrkTrackColl,m_extrTrkTrackColl,m_muGirlTrkSegColl); + m_muGirlTool->extend(*inDetCandidates,mugirlTagMap,m_combTrkTrackColl,m_extrTrkTrackColl,m_muGirlTrkSegColl, ctx); ++m_counter_TrigMuGirl.pass;//@todo fix this counter if(m_doOutsideIn) { @@ -1991,7 +1991,8 @@ void TrigMuSuperEF::runMuGirl(const ElementLinkVector<xAOD::TrackParticleContain ++m_counter_TrigMuGirl.total; MuonCombined::InDetCandidateToTagMap* mugirlTagMap=new MuonCombined::InDetCandidateToTagMap(); m_tagMaps.push_back(mugirlTagMap); - m_muGirlTool->extend(*inDetCandidates,mugirlTagMap, m_combTrkTrackColl, m_extrTrkTrackColl, m_muGirlTrkSegColl); + const EventContext& ctx = getContext(); + m_muGirlTool->extend(*inDetCandidates,mugirlTagMap, m_combTrkTrackColl, m_extrTrkTrackColl, m_muGirlTrkSegColl, ctx); ++m_counter_TrigMuGirl.pass;//@todo fix this counter }