diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentCombinationFinder.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentCombinationFinder.cxx index 73720c06f418d97da57ac7e774bf7ef6d111d18c..9b31d8a01faea7ae80e0bbf1e231a9419bd85b4b 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) + Muon::IMooSegmentCombinationFinder::Output& output) 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 @@ -231,7 +231,7 @@ Muon::MooSegmentCombinationFinder::findSegments(const std::vector<const MdtPrepD void Muon::MooSegmentCombinationFinder::postProcess(MuonSegmentCombinationCollection* col, - MuonSegmentCombPatternCombAssociationMap& segmentPatternMap) + MuonSegmentCombPatternCombAssociationMap& segmentPatternMap) const { MuonSegmentCombinationCollection::const_iterator cit = col->begin(); MuonSegmentCombinationCollection::const_iterator cit_end = col->end(); diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentCombinationFinder.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentCombinationFinder.h index 1df43bd8ba6878d92d92b6f5480fa1657cc8f0e5..0552dbf6a3f20fdcb78331522dd700b50a9b3a26 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); + IMooSegmentCombinationFinder::Output& output) const; private: /** helper functions to print summary output for the different stages */ @@ -76,7 +76,7 @@ class MooSegmentCombinationFinder : virtual public IMooSegmentCombinationFinder, /** helper functions to write out intermediate results */ void postProcess(MuonSegmentCombinationCollection* col, - MuonSegmentCombPatternCombAssociationMap& segmentPatternMap); + MuonSegmentCombPatternCombAssociationMap& segmentPatternMap) const; /** extract a segment collection from a segment combination collection */ void extractSegmentCollection(const MuonSegmentCombinationCollection* combiCol, diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentFinderAlg.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentFinderAlg.cxx index 3113a49fb2ed64dd0f8601d05e8c01f5d09cdb59..dc8c4fe1707398cb645499259645417d7d794e56 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentFinderAlg.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentFinderAlg.cxx @@ -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 */ #include "MooSegmentFinderAlg.h" @@ -10,7 +10,7 @@ #include "MuonSegmentMakerToolInterfaces/IMuonSegmentOverlapRemovalTool.h" MooSegmentFinderAlg::MooSegmentFinderAlg(const std::string& name, ISvcLocator* pSvcLocator) - : AthAlgorithm(name, pSvcLocator), + : AthReentrantAlgorithm(name, pSvcLocator), m_keyTgc("TGC_Measurements"), m_keyTgcPriorBC("TGC_MeasurementsPriorBC"), m_keyTgcNextBC("TGC_MeasurementsNextBC"), @@ -70,23 +70,23 @@ MooSegmentFinderAlg::initialize() } StatusCode -MooSegmentFinderAlg::execute() +MooSegmentFinderAlg::execute(const EventContext& ctx) const { std::vector<const Muon::MdtPrepDataCollection*> mdtCols; std::vector<const Muon::CscPrepDataCollection*> cscCols; std::vector<const Muon::TgcPrepDataCollection*> tgcCols; std::vector<const Muon::RpcPrepDataCollection*> rpcCols; - if (m_useMdt) retrieveCollections(mdtCols, m_keyMdt); - if (m_useCsc) retrieveCollections(cscCols, m_keyCsc); - if (m_useTgc) retrieveCollections(tgcCols, m_keyTgc); - if (m_useTgcPriorBC) retrieveCollections(tgcCols, m_keyTgcPriorBC); - if (m_useTgcNextBC) retrieveCollections(tgcCols, m_keyTgcNextBC); - if (m_useRpc) retrieveCollections(rpcCols, m_keyRpc); + if (m_useMdt) retrieveCollections(mdtCols, m_keyMdt, ctx); + if (m_useCsc) retrieveCollections(cscCols, m_keyCsc, ctx); + if (m_useTgc) retrieveCollections(tgcCols, m_keyTgc, ctx); + if (m_useTgcPriorBC) retrieveCollections(tgcCols, m_keyTgcPriorBC, ctx); + if (m_useTgcNextBC) retrieveCollections(tgcCols, m_keyTgcNextBC, ctx); + if (m_useRpc) retrieveCollections(rpcCols, m_keyRpc, ctx); Muon::IMooSegmentCombinationFinder::Output output; - SG::WriteHandle<Trk::SegmentCollection> segHandle(m_segmentLocation); + SG::WriteHandle<Trk::SegmentCollection> segHandle(m_segmentLocation, ctx); if (segHandle.record(std::make_unique<Trk::SegmentCollection>()).isSuccess()) { ATH_MSG_VERBOSE("stored MuonSegmentCollection at " << m_segmentLocation.key()); @@ -95,7 +95,7 @@ MooSegmentFinderAlg::execute() } output.segmentCollection = segHandle.ptr(); - SG::WriteHandle<MuonPatternCombinationCollection> patHandle(m_patternCombiLocation); + SG::WriteHandle<MuonPatternCombinationCollection> patHandle(m_patternCombiLocation, ctx); m_segmentFinder->findSegments(mdtCols, cscCols, tgcCols, rpcCols, output); @@ -117,7 +117,7 @@ MooSegmentFinderAlg::execute() // write hough data to SG if (output.houghDataPerSectorVec) { - SG::WriteHandle<Muon::HoughDataPerSectorVec> handle{m_houghDataPerSectorVecKey}; + SG::WriteHandle<Muon::HoughDataPerSectorVec> handle{m_houghDataPerSectorVecKey, ctx}; ATH_CHECK(handle.record(std::move(output.houghDataPerSectorVec))); } else { ATH_MSG_VERBOSE("HoughDataPerSectorVec was empty, key: " << m_houghDataPerSectorVecKey.key()); @@ -128,12 +128,12 @@ MooSegmentFinderAlg::execute() const PRD_MultiTruthCollection* tgcTruthColl = 0; const PRD_MultiTruthCollection* rpcTruthColl = 0; if (m_doClusterTruth) { - SG::ReadHandle<PRD_MultiTruthCollection> tgcTruth(m_tgcTruth); - SG::ReadHandle<PRD_MultiTruthCollection> rpcTruth(m_rpcTruth); + SG::ReadHandle<PRD_MultiTruthCollection> tgcTruth(m_tgcTruth, ctx); + SG::ReadHandle<PRD_MultiTruthCollection> rpcTruth(m_rpcTruth, ctx); tgcTruthColl = tgcTruth.cptr(); rpcTruthColl = rpcTruth.cptr(); } - SG::ReadHandle<Muon::MdtPrepDataContainer> mdth(m_keyMdt); + SG::ReadHandle<Muon::MdtPrepDataContainer> mdth(m_keyMdt, ctx); m_clusterSegMaker->getClusterSegments(mdth.cptr(), m_doTGCClust ? &tgcCols : 0, m_doRPCClust ? &rpcCols : 0, tgcTruthColl, rpcTruthColl, segHandle.ptr()); } diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentFinderAlg.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentFinderAlg.h index 615533b9b0f940428a7b54dc99bbc5dc205b2b0d..c444267edebeb189b67f050057ed5f9e50fb996f 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentFinderAlg.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentFinderAlg.h @@ -1,11 +1,11 @@ /* - 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 MOOSEGMENTFINDERS_MOOSEGMENTFINDERALGS_H #define MOOSEGMENTFINDERS_MOOSEGMENTFINDERALGS_H -#include "AthenaBaseComps/AthAlgorithm.h" +#include "AthenaBaseComps/AthReentrantAlgorithm.h" #include "GaudiKernel/ToolHandle.h" #include "MuonPattern/MuonPatternCombinationCollection.h" #include "MuonPrepRawData/CscPrepDataCollection.h" @@ -26,19 +26,19 @@ class IMooSegmentCombinationFinder; class IMuonSegmentOverlapRemovalTool; } // namespace Muon -class MooSegmentFinderAlg : public AthAlgorithm { +class MooSegmentFinderAlg : public AthReentrantAlgorithm { public: MooSegmentFinderAlg(const std::string& name, ISvcLocator* pSvcLocator); virtual ~MooSegmentFinderAlg(); virtual StatusCode initialize() override; - virtual StatusCode execute() override; + virtual StatusCode execute(const EventContext& ctx) const; virtual StatusCode finalize() override; private: template <class T, class Y> - void retrieveCollections(std::vector<const T*>& cols, SG::ReadHandleKey<Y>& key); + void retrieveCollections(std::vector<const T*>& cols, const SG::ReadHandleKey<Y>& key, const EventContext& ctx) const; /** extract segments from a MuonSegmentCombinationCollection */ Trk::SegmentCollection* extractSegmentCollection(const MuonSegmentCombinationCollection& segmentCombinations) const; @@ -94,10 +94,10 @@ class MooSegmentFinderAlg : public AthAlgorithm { template <class T, class Y> void -MooSegmentFinderAlg::retrieveCollections(std::vector<const T*>& cols, SG::ReadHandleKey<Y>& key) + MooSegmentFinderAlg::retrieveCollections(std::vector<const T*>& cols, const SG::ReadHandleKey<Y>& key, const EventContext& ctx) const { - SG::ReadHandle<Y> cscPrds(key); + SG::ReadHandle<Y> cscPrds(key, ctx); if (cscPrds.isValid() == false) { ATH_MSG_ERROR("Cannot retrieve Container " << key.key() << " accessing via collections "); diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MuonSegmentFinderAlg.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MuonSegmentFinderAlg.cxx index 347c29c018069de255bd4fddcdec6bc1255e8e98..60bf0301fb2daeabdbcde31eafec66c34354d3b3 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MuonSegmentFinderAlg.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MuonSegmentFinderAlg.cxx @@ -22,7 +22,7 @@ using HepGeom::Transform3D; MuonSegmentFinderAlg::MuonSegmentFinderAlg(const std::string& name, ISvcLocator* pSvcLocator) - : AthAlgorithm(name, pSvcLocator) + : AthReentrantAlgorithm(name, pSvcLocator) { declareProperty("PrintSummary", m_printSummary = false); // @@ -76,19 +76,19 @@ MuonSegmentFinderAlg::initialize() } StatusCode -MuonSegmentFinderAlg::execute() +MuonSegmentFinderAlg::execute(const EventContext& ctx) const { // vector to hold segments - SG::WriteHandle<Trk::SegmentCollection> handle(m_segmentCollectionKey); + SG::WriteHandle<Trk::SegmentCollection> handle(m_segmentCollectionKey, ctx); ATH_CHECK(handle.record(std::make_unique<Trk::SegmentCollection>())); - SG::ReadHandle<Muon::TgcPrepDataContainer> tgcPrds(m_tgcPrdsKey); + SG::ReadHandle<Muon::TgcPrepDataContainer> tgcPrds(m_tgcPrdsKey, ctx); const Muon::TgcPrepDataContainer* tgcPrdCont = tgcPrds.cptr(); - SG::ReadHandle<Muon::RpcPrepDataContainer> rpcPrds(m_rpcPrdsKey); + SG::ReadHandle<Muon::RpcPrepDataContainer> rpcPrds(m_rpcPrdsKey, ctx); const Muon::RpcPrepDataContainer* rpcPrdCont = rpcPrds.cptr(); - SG::ReadHandle<MuonPatternCombinationCollection> patternColl(m_patternCollKey); + SG::ReadHandle<MuonPatternCombinationCollection> patternColl(m_patternCollKey, ctx); if (!patternColl.isValid()) { ATH_MSG_FATAL("Could not to retrieve the PatternCombinations from StoreGate"); return StatusCode::FAILURE; @@ -120,12 +120,12 @@ MuonSegmentFinderAlg::execute() // do cluster based segment finding if (m_doTGCClust || m_doRPCClust) { - SG::ReadHandle<Muon::MdtPrepDataContainer> mdtPrds(m_mdtPrdsKey); + SG::ReadHandle<Muon::MdtPrepDataContainer> mdtPrds(m_mdtPrdsKey, ctx); const PRD_MultiTruthCollection* tgcTruthColl = 0; const PRD_MultiTruthCollection* rpcTruthColl = 0; if (m_doClusterTruth) { - SG::ReadHandle<PRD_MultiTruthCollection> tgcTruth(m_tgcTruth); - SG::ReadHandle<PRD_MultiTruthCollection> rpcTruth(m_rpcTruth); + SG::ReadHandle<PRD_MultiTruthCollection> tgcTruth(m_tgcTruth, ctx); + SG::ReadHandle<PRD_MultiTruthCollection> rpcTruth(m_rpcTruth, ctx); tgcTruthColl = tgcTruth.cptr(); rpcTruthColl = rpcTruth.cptr(); } @@ -149,7 +149,7 @@ MuonSegmentFinderAlg::execute() std::vector<const Muon::CscPrepDataCollection*> cscCols; - SG::ReadHandle<Muon::CscPrepDataContainer> cscPrds(m_cscPrdsKey); + SG::ReadHandle<Muon::CscPrepDataContainer> cscPrds(m_cscPrdsKey, ctx); if (cscPrds.isValid()) { @@ -210,15 +210,9 @@ MuonSegmentFinderAlg::execute() } // execute -StatusCode -MuonSegmentFinderAlg::finalize() -{ - return AthAlgorithm::finalize(); -} - void MuonSegmentFinderAlg::createSegmentsFromClusters(const Muon::MuonPatternCombination* patt, - Trk::SegmentCollection* segments) + Trk::SegmentCollection* segments) const { // turn the PRD into MuonCluster std::map<int, std::vector<const Muon::MuonClusterOnTrack*> > clustersPerSector; @@ -266,7 +260,7 @@ MuonSegmentFinderAlg::createSegmentsFromClusters(const Muon::MuonPatternCombinat void MuonSegmentFinderAlg::createSegmentsWithMDTs(const Muon::MuonPatternCombination* patcomb, Trk::SegmentCollection* segs, const std::vector<const Muon::RpcPrepDataCollection*> rpcCols, - const std::vector<const Muon::TgcPrepDataCollection*> tgcCols) + const std::vector<const Muon::TgcPrepDataCollection*> tgcCols) const { if (m_idHelperSvc->hasMM() && m_idHelperSvc->hasSTgc()) { diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MuonSegmentFinderAlg.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MuonSegmentFinderAlg.h index 45a787505413089762f81205cbfe07d1c4af451f..78766e5103fea17ad8beb59d54f2146b8bcdfd8e 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MuonSegmentFinderAlg.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MuonSegmentFinderAlg.h @@ -5,7 +5,7 @@ #ifndef MOOSEGMENTFINDERS_MUOSEGMENTFINDERALGS_H #define MOOSEGMENTFINDERS_MUOSEGMENTFINDERALGS_H -#include "AthenaBaseComps/AthAlgorithm.h" +#include "AthenaBaseComps/AthReentrantAlgorithm.h" #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" #include "MuonIdHelpers/IMuonIdHelperSvc.h" @@ -33,15 +33,14 @@ class IMuonClusterSegmentFinder; class MsgStream; class ICscSegmentFinder; -class MuonSegmentFinderAlg : public AthAlgorithm { +class MuonSegmentFinderAlg : public AthReentrantAlgorithm { public: MuonSegmentFinderAlg(const std::string& name, ISvcLocator* pSvcLocator); virtual ~MuonSegmentFinderAlg(); virtual StatusCode initialize() override; - virtual StatusCode execute() override; - virtual StatusCode finalize() override; + virtual StatusCode execute(const EventContext& ctx) const; private: @@ -164,8 +163,8 @@ class MuonSegmentFinderAlg : public AthAlgorithm { void createSegmentsWithMDTs(const Muon::MuonPatternCombination* patt, Trk::SegmentCollection* segs, const std::vector<const Muon::RpcPrepDataCollection*> rpcCols, - const std::vector<const Muon::TgcPrepDataCollection*> tgcCols); - void createSegmentsFromClusters(const Muon::MuonPatternCombination* patt, Trk::SegmentCollection* segments); + const std::vector<const Muon::TgcPrepDataCollection*> tgcCols) const; + void createSegmentsFromClusters(const Muon::MuonPatternCombination* patt, Trk::SegmentCollection* segments) const; bool m_printSummary; diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonCurvedSegmentCombiner/MuonCurvedSegmentCombiner/MuonCurvedSegmentCombiner.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonCurvedSegmentCombiner/MuonCurvedSegmentCombiner/MuonCurvedSegmentCombiner.h index b4f8083de24cd55532f7dc49055bbdf3bc9be72b..0108c3abe1124583ee64241ed10c016963467cce 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonCurvedSegmentCombiner/MuonCurvedSegmentCombiner/MuonCurvedSegmentCombiner.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonCurvedSegmentCombiner/MuonCurvedSegmentCombiner/MuonCurvedSegmentCombiner.h @@ -44,29 +44,30 @@ class MuonCurvedSegmentCombiner : virtual public IMuonCurvedSegmentCombiner, /** INSERT main method here.*/ std::unique_ptr<MuonSegmentCombinationCollection> combineSegments( const MuonSegmentCombinationCollection& mdtCombiColl, const MuonSegmentCombinationCollection& csc4DCombiColl, - const MuonSegmentCombinationCollection& csc2DCombiColl, MuonSegmentCombPatternCombAssociationMap* segPattMap); + const MuonSegmentCombinationCollection& csc2DCombiColl, MuonSegmentCombPatternCombAssociationMap* segPattMap) const; - void trackParameters(Muon::MuonSegment& seg, double& theta, double& curvature, int& imeth); - // void fulltrackParameters( const Muon::MuonSegment& seg ,HepMatrix & T , HepMatrix & CovT ,int &imeth ); - void extrapolateSegment(Muon::MuonSegment& seg, Muon::MuonSegment& sege, Amg::VectorX& Res, Amg::VectorX& Pull); - - void fit2Segments(Muon::MuonSegment& seg, Muon::MuonSegment& sege, Amg::VectorX& Res, Amg::VectorX& Pull); - void fit2SegmentsC(Muon::MuonSegment& seg, Muon::MuonSegment& sege, Amg::VectorX& Res, Amg::VectorX& Pull); - void fit2SegmentsSL(Muon::MuonSegment& seg, Muon::MuonSegment& sege, Amg::VectorX& Res, Amg::VectorX& Pull); private: - std::unique_ptr<MuonSegmentCombinationCollection> processCombinationCollection( - const MuonSegmentCombinationCollection& mdtCombiCol, MuonSegmentCombPatternCombAssociationMap* segPattMap); + typedef std::map<Muon::MuonSegment*, Muon::MCSCSegmentInfo> SegInfoMap; + void trackParameters(Muon::MuonSegment& seg, double& theta, double& curvature, int& imeth, SegInfoMap segInfoMap) const; + void extrapolateSegment(Muon::MuonSegment& seg, Muon::MuonSegment& sege, Amg::VectorX& Res, Amg::VectorX& Pull, SegInfoMap segInfoMap) const; + + void fit2Segments(Muon::MuonSegment& seg, Muon::MuonSegment& sege, Amg::VectorX& Res, Amg::VectorX& Pull, SegInfoMap segInfoMap) const; + void fit2SegmentsC(Muon::MuonSegment& seg, Muon::MuonSegment& sege, Amg::VectorX& Res, Amg::VectorX& Pull, SegInfoMap segInfoMap) const; + void fit2SegmentsSL(Muon::MuonSegment& seg, Muon::MuonSegment& sege, Amg::VectorX& Res, Amg::VectorX& Pull, SegInfoMap segInfoMap) const; + std::unique_ptr<MuonSegmentCombinationCollection> processCombinationCollection(const MuonSegmentCombinationCollection& mdtCombiCol, + MuonSegmentCombPatternCombAssociationMap* segPattMap, SegInfoMap seg2DCscInfoMap, SegInfoMap seg4DCscInfoMap, SegInfoMap &segInfoMap, std::map<Muon::MuonSegment*, const MuonPatternCombination*> &segAssoMap, int &segmentIndex) const; void processCscCombinationCollection(const MuonSegmentCombinationCollection& cscCombiCol, - MuonSegmentCombPatternCombAssociationMap* segPattMap); - void process2DCscCombinationCollection(const MuonSegmentCombinationCollection& csc2DcombiCol); + MuonSegmentCombPatternCombAssociationMap* segPattMap, SegInfoMap segInfoMap, SegInfoMap &seg4DCscInfoMap, std::set<Identifier> &cscIdSet, std::map<Muon::MuonSegment*, const MuonPatternCombination*> &segAssoMap, int &segmentIndex) const; + void process2DCscCombinationCollection(const MuonSegmentCombinationCollection& csc2DcombiCol, SegInfoMap segInfoMap, std::set<Identifier> cscIdSet, SegInfoMap &seg2DCscInfoMap, std::map<Muon::MuonSegment*, const MuonPatternCombination*> &segAssoMap, int &segmentIndex) const; void muonCurvedSegmentCombinations(MuonSegmentCombinationCollection* curvedCombiCol, - MuonSegmentCombPatternCombAssociationMap* segPattMap); + MuonSegmentCombPatternCombAssociationMap* segPattMap, SegInfoMap segInfoMap, + std::map<Muon::MuonSegment*, const MuonPatternCombination*> segAssoMap) const; - Muon::MCSCSegmentInfo segInfo(Muon::MuonSegment* seg); + Muon::MCSCSegmentInfo segInfo(Muon::MuonSegment* seg, SegInfoMap segInfoMap, std::map<Muon::MuonSegment*, const MuonPatternCombination*> segAssoMap) const; - unsigned int missedHits(Muon::MuonSegment* segment); + unsigned int missedHits(Muon::MuonSegment* segment) const; private: ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{ @@ -94,17 +95,8 @@ class MuonCurvedSegmentCombiner : virtual public IMuonCurvedSegmentCombiner, double m_phiAssociationCut2; bool m_addUnassociatedMiddleEndcapSegments; - typedef std::map<Muon::MuonSegment*, Muon::MCSCSegmentInfo> SegInfoMap; typedef SegInfoMap::iterator SegInfoIt; - int m_segmentIndex; - SegInfoMap m_segInfoMap; - - SegInfoMap m_seg2DCscInfoMap; - SegInfoMap m_seg4DCscInfoMap; - SegInfoMap m_segMdtInfoMap; - std::map<Muon::MuonSegment*, const MuonPatternCombination*> m_segAssoMap; - std::set<Identifier> m_cscIdSet; }; } // namespace Muon diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonCurvedSegmentCombiner/src/MuonCurvedSegmentCombiner.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonCurvedSegmentCombiner/src/MuonCurvedSegmentCombiner.cxx index 2f1052f3b85386332d9bf276932c89591d5d4d62..f299ecf8c90f2c8079a8394abfd8a06b51df6fef 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonCurvedSegmentCombiner/src/MuonCurvedSegmentCombiner.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonCurvedSegmentCombiner/src/MuonCurvedSegmentCombiner.cxx @@ -72,16 +72,15 @@ std::unique_ptr<MuonSegmentCombinationCollection> Muon::MuonCurvedSegmentCombiner::combineSegments(const MuonSegmentCombinationCollection& mdtCombiColl, const MuonSegmentCombinationCollection& csc4DCombiColl, const MuonSegmentCombinationCollection& csc2DCombiColl, - MuonSegmentCombPatternCombAssociationMap* segPattMap) + MuonSegmentCombPatternCombAssociationMap* segPattMap) const { - m_segInfoMap.clear(); - m_seg2DCscInfoMap.clear(); - m_seg4DCscInfoMap.clear(); - m_segMdtInfoMap.clear(); - m_cscIdSet.clear(); - m_segAssoMap.clear(); + SegInfoMap segInfoMap; + SegInfoMap seg2DCscInfoMap; + SegInfoMap seg4DCscInfoMap; + std::set<Identifier> cscIdSet; + std::map<Muon::MuonSegment*, const MuonPatternCombination*> segAssoMap; - m_segmentIndex = 0; + int segmentIndex = 0; if (msgLvl(MSG::DEBUG) || m_summary) { if (mdtCombiColl.empty()) @@ -104,7 +103,7 @@ Muon::MuonCurvedSegmentCombiner::combineSegments(const MuonSegmentCombinationCol ATH_MSG_INFO(" summarizing input: Csc MuonSegment combinations " << std::endl << m_printer->print(csc4DCombiColl)); } - processCscCombinationCollection(csc4DCombiColl, segPattMap); + processCscCombinationCollection(csc4DCombiColl, segPattMap, segInfoMap, seg4DCscInfoMap, cscIdSet, segAssoMap, segmentIndex); // Csc 2D segments @@ -116,21 +115,24 @@ Muon::MuonCurvedSegmentCombiner::combineSegments(const MuonSegmentCombinationCol << std::endl << m_printer->print(csc2DCombiColl)); } - process2DCscCombinationCollection(csc2DCombiColl); + process2DCscCombinationCollection(csc2DCombiColl, segInfoMap, cscIdSet, seg2DCscInfoMap, segAssoMap, segmentIndex); } - return processCombinationCollection(mdtCombiColl, segPattMap); + return processCombinationCollection(mdtCombiColl, segPattMap, seg2DCscInfoMap, seg4DCscInfoMap, segInfoMap, segAssoMap, segmentIndex); } std::unique_ptr<MuonSegmentCombinationCollection> Muon::MuonCurvedSegmentCombiner::processCombinationCollection(const MuonSegmentCombinationCollection& mdtCol, - MuonSegmentCombPatternCombAssociationMap* segPattMap) + MuonSegmentCombPatternCombAssociationMap* segPattMap, SegInfoMap seg2DCscInfoMap, + SegInfoMap seg4DCscInfoMap, SegInfoMap &segInfoMap, + std::map<Muon::MuonSegment*, const MuonPatternCombination*> &segAssoMap, int &segmentIndex) const { std::unique_ptr<MuonSegmentCombinationCollection> curvedCombiCol(new MuonSegmentCombinationCollection); + SegInfoMap segMdtInfoMap; int nmdtsegments = 0; - int ncscsegments = m_seg2DCscInfoMap.size() + m_seg4DCscInfoMap.size(); + int ncscsegments = seg2DCscInfoMap.size() + seg4DCscInfoMap.size(); if (m_debug) std::cout << " in processCombinationCollection " << std::endl; @@ -165,16 +167,16 @@ Muon::MuonCurvedSegmentCombiner::processCombinationCollection(const MuonSegmentC ATH_MSG_INFO(" This MuonSegPatAssMap for MDTs should only have one entry!! "); } // Take 2D Csc segments - m_segInfoMap = m_seg2DCscInfoMap; - SegInfoIt seg_it = m_seg4DCscInfoMap.begin(); - SegInfoIt seg_it_end = m_seg4DCscInfoMap.end(); + segInfoMap = seg2DCscInfoMap; + SegInfoIt seg_it = seg4DCscInfoMap.begin(); + SegInfoIt seg_it_end = seg4DCscInfoMap.end(); for (; seg_it != seg_it_end; ++seg_it) { Muon::MuonSegment* segm = seg_it->first; - if (m_seg4DCscInfoMap[segm].contains(pattern)) { + if (seg4DCscInfoMap[segm].contains(pattern)) { // Add 4D Csc segment associated to this pattern Muon::MCSCSegmentInfo info = seg_it->second; info.patPoint = pattern; - m_segInfoMap[segm] = info; + segInfoMap[segm] = info; } } bool addedMdtSegments = false; @@ -195,25 +197,25 @@ Muon::MuonCurvedSegmentCombiner::processCombinationCollection(const MuonSegmentC } if (is_mdt == false) continue; std::map<Muon::MuonSegment*, const MuonPatternCombination*>::iterator it = - m_segAssoMap.find(segs[si].get()); + segAssoMap.find(segs[si].get()); nmdtsegments++; - if (it == m_segAssoMap.end()) { - m_segAssoMap[segs[si].get()] = pattern; + if (it == segAssoMap.end()) { + segAssoMap[segs[si].get()] = pattern; } else { if (it->second != pattern) ATH_MSG_INFO(" MDT Segment pointers should only be found once!! "); it->second = pattern; } - Muon::MCSCSegmentInfo info = segInfo(segs[si].get()); + Muon::MCSCSegmentInfo info = segInfo(segs[si].get(), segInfoMap, segAssoMap); // Add Mdt segment associated to this pattern - m_segmentIndex++; - info.index = m_segmentIndex; - m_segInfoMap[segs[si].get()] = info; - m_segMdtInfoMap[segs[si].get()] = info; + segmentIndex++; + info.index = segmentIndex; + segInfoMap[segs[si].get()] = info; + segMdtInfoMap[segs[si].get()] = info; addedMdtSegments = true; } } - if (addedMdtSegments) muonCurvedSegmentCombinations(curvedCombiCol.get(), segPattMap); + if (addedMdtSegments) muonCurvedSegmentCombinations(curvedCombiCol.get(), segPattMap, segInfoMap, segAssoMap); } if (m_debug) std::cout << " First stage muonCurvedSegmentCombinations " << curvedCombiCol->size() << " Mdt segments " @@ -229,7 +231,7 @@ Muon::MuonCurvedSegmentCombiner::processCombinationCollection(const MuonSegmentC if (m_debug) std::cout << " merging patterns " << std::endl; // Clear segment association map - m_segAssoMap.clear(); + segAssoMap.clear(); cit = mdtCol.begin(); for (; cit != cit_end; ++cit) { const Muon::MuonSegmentCombination* combi = *cit; @@ -247,9 +249,7 @@ Muon::MuonCurvedSegmentCombiner::processCombinationCollection(const MuonSegmentC ATH_MSG_INFO(" This MuonSegPatAssMap for MDTs should only have one entry!! "); } - // Leave out 2D Csc segments - // m_segInfoMap = m_seg2DCscInfoMap; - m_segInfoMap.clear(); + segInfoMap.clear(); MuonSegmentCombinationCollection::const_iterator cit1 = cit; for (; cit1 != cit_end; ++cit1) { @@ -378,16 +378,16 @@ Muon::MuonCurvedSegmentCombiner::processCombinationCollection(const MuonSegmentC // Take 2D Csc segments - m_segInfoMap = m_seg2DCscInfoMap; - SegInfoIt seg_it = m_seg4DCscInfoMap.begin(); - SegInfoIt seg_it_end = m_seg4DCscInfoMap.end(); + segInfoMap = seg2DCscInfoMap; + SegInfoIt seg_it = seg4DCscInfoMap.begin(); + SegInfoIt seg_it_end = seg4DCscInfoMap.end(); for (; seg_it != seg_it_end; ++seg_it) { Muon::MuonSegment* segm = seg_it->first; - if (m_seg4DCscInfoMap[segm].contains(pattern) || m_seg4DCscInfoMap[segm].contains(pattern1)) { + if (seg4DCscInfoMap[segm].contains(pattern) || seg4DCscInfoMap[segm].contains(pattern1)) { // Add 4D Csc segment associated to this pattern Muon::MCSCSegmentInfo info = seg_it->second; info.patPoint = patternSelect; - m_segInfoMap[segm] = info; + segInfoMap[segm] = info; } } bool addedMdtSegments = false; @@ -409,16 +409,16 @@ Muon::MuonCurvedSegmentCombiner::processCombinationCollection(const MuonSegmentC if (is_mdt == false) continue; std::map<Muon::MuonSegment*, const MuonPatternCombination*>::iterator it = - m_segAssoMap.find(segs[si].get()); - if (it == m_segAssoMap.end()) { - m_segAssoMap[segs[si].get()] = patternSelect; + segAssoMap.find(segs[si].get()); + if (it == segAssoMap.end()) { + segAssoMap[segs[si].get()] = patternSelect; } else { it->second = patternSelect; } - Muon::MCSCSegmentInfo info = segInfo(segs[si].get()); + Muon::MCSCSegmentInfo info = segInfo(segs[si].get(), segInfoMap, segAssoMap); // Add Mdt segment associated to this pattern - m_segInfoMap[segs[si].get()] = info; - m_segMdtInfoMap[segs[si].get()] = info; + segInfoMap[segs[si].get()] = info; + segMdtInfoMap[segs[si].get()] = info; addedMdtSegments = true; } } @@ -440,21 +440,21 @@ Muon::MuonCurvedSegmentCombiner::processCombinationCollection(const MuonSegmentC } if (is_mdt == false) continue; std::map<Muon::MuonSegment*, const MuonPatternCombination*>::iterator it = - m_segAssoMap.find(segs[si].get()); - if (it == m_segAssoMap.end()) { - m_segAssoMap[segs[si].get()] = patternSelect; + segAssoMap.find(segs[si].get()); + if (it == segAssoMap.end()) { + segAssoMap[segs[si].get()] = patternSelect; } else { it->second = patternSelect; } - Muon::MCSCSegmentInfo info = segInfo(segs[si].get()); + Muon::MCSCSegmentInfo info = segInfo(segs[si].get(), segInfoMap, segAssoMap); // Add Mdt segment associated to this pattern - m_segInfoMap[segs[si].get()] = info; - m_segMdtInfoMap[segs[si].get()] = info; + segInfoMap[segs[si].get()] = info; + segMdtInfoMap[segs[si].get()] = info; addedMdtSegments = true; } } - if (addedMdtSegments) muonCurvedSegmentCombinations(curvedCombiCol.get(), segPattMap); + if (addedMdtSegments) muonCurvedSegmentCombinations(curvedCombiCol.get(), segPattMap, segInfoMap, segAssoMap); } } if (m_debug) std::cout << " Second stage muonCurvedSegmentCombinations " << curvedCombiCol->size() << std::endl; @@ -472,7 +472,9 @@ Muon::MuonCurvedSegmentCombiner::processCombinationCollection(const MuonSegmentC void Muon::MuonCurvedSegmentCombiner::processCscCombinationCollection(const MuonSegmentCombinationCollection& combiCol, - MuonSegmentCombPatternCombAssociationMap* segPattMap) + MuonSegmentCombPatternCombAssociationMap* segPattMap, + SegInfoMap segInfoMap, SegInfoMap &seg4DCscInfoMap, std::set<Identifier> &cscIdSet, + std::map<Muon::MuonSegment*, const MuonPatternCombination*> &segAssoMap, int &segmentIndex) const { MuonSegmentCombinationCollection::const_iterator cit = combiCol.begin(); MuonSegmentCombinationCollection::const_iterator cit_end = combiCol.end(); @@ -507,28 +509,28 @@ Muon::MuonCurvedSegmentCombiner::processCscCombinationCollection(const MuonSegme for (unsigned int ri = 0; ri < segs[si]->numberOfContainedROTs(); ri++) { if (m_idHelperSvc->isCsc(segs[si]->rioOnTrack(ri)->identify())) { is_csc = true; - m_cscIdSet.insert(segs[si]->rioOnTrack(ri)->identify()); - if (m_debug) std::cout << " csc hits on 4d segment " << m_cscIdSet.size() << std::endl; + cscIdSet.insert(segs[si]->rioOnTrack(ri)->identify()); + if (m_debug) std::cout << " csc hits on 4d segment " << cscIdSet.size() << std::endl; } } if (is_csc == false) continue; std::map<Muon::MuonSegment*, const MuonPatternCombination*>::iterator it = - m_segAssoMap.find(segs[si].get()); - if (it == m_segAssoMap.end()) { - m_segAssoMap[segs[si].get()] = pattern; + segAssoMap.find(segs[si].get()); + if (it == segAssoMap.end()) { + segAssoMap[segs[si].get()] = pattern; } else { it->second = pattern; } // 4D Csc segments can be on more than 1 pattern - Muon::MCSCSegmentInfo info = segInfo(segs[si].get()); - m_segmentIndex++; - info.index = m_segmentIndex; + Muon::MCSCSegmentInfo info = segInfo(segs[si].get(), segInfoMap, segAssoMap); + segmentIndex++; + info.index = segmentIndex; MuonSegmentCombPatternCombAssociationMap::const_iterator ia_it = range.first; MuonSegmentCombPatternCombAssociationMap::const_iterator ia_it_end = range.second; for (; ia_it != ia_it_end; ++ia_it) { info.patPointers.push_back((*ia_it).second); } - m_seg4DCscInfoMap[segs[si].get()] = info; + seg4DCscInfoMap[segs[si].get()] = info; if (m_debug) std::cout << " Store Csc segment " << " associated pattern size " << info.patPointers.size() << std::endl; @@ -539,7 +541,9 @@ Muon::MuonCurvedSegmentCombiner::processCscCombinationCollection(const MuonSegme } void -Muon::MuonCurvedSegmentCombiner::process2DCscCombinationCollection(const MuonSegmentCombinationCollection& combiCol) +Muon::MuonCurvedSegmentCombiner::process2DCscCombinationCollection(const MuonSegmentCombinationCollection& combiCol, SegInfoMap segInfoMap, + std::set<Identifier> cscIdSet, SegInfoMap &seg2DCscInfoMap, + std::map<Muon::MuonSegment*, const MuonPatternCombination*> &segAssoMap, int &segmentIndex) const { MuonSegmentCombinationCollection::const_iterator cit = combiCol.begin(); MuonSegmentCombinationCollection::const_iterator cit_end = combiCol.end(); @@ -564,7 +568,7 @@ Muon::MuonCurvedSegmentCombiner::process2DCscCombinationCollection(const MuonSeg { is_csc = true; ncsc++; - if (m_cscIdSet.find(segs[si]->rioOnTrack(ri)->identify()) != m_cscIdSet.end()) ncscmatched++; + if (cscIdSet.find(segs[si]->rioOnTrack(ri)->identify()) != cscIdSet.end()) ncscmatched++; } } if (is_csc == false) continue; @@ -573,11 +577,11 @@ Muon::MuonCurvedSegmentCombiner::process2DCscCombinationCollection(const MuonSeg // 2D Csc segments are NOT associated to Pattern - m_segAssoMap[segs[si].get()] = 0; - Muon::MCSCSegmentInfo info = segInfo(segs[si].get()); - m_segmentIndex++; - info.index = m_segmentIndex; - m_seg2DCscInfoMap[segs[si].get()] = info; + segAssoMap[segs[si].get()] = 0; + Muon::MCSCSegmentInfo info = segInfo(segs[si].get(), segInfoMap, segAssoMap); + segmentIndex++; + info.index = segmentIndex; + seg2DCscInfoMap[segs[si].get()] = info; // if(m_debug) std::cout << " Store Csc eta segment " << " associated pattern size " << // combiAssos.size() << std::endl; } @@ -587,7 +591,8 @@ Muon::MuonCurvedSegmentCombiner::process2DCscCombinationCollection(const MuonSeg void Muon::MuonCurvedSegmentCombiner::muonCurvedSegmentCombinations(MuonSegmentCombinationCollection* curvedCombiCol, - MuonSegmentCombPatternCombAssociationMap* segPattMap) + MuonSegmentCombPatternCombAssociationMap* segPattMap, SegInfoMap segInfoMap, + std::map<Muon::MuonSegment*, const MuonPatternCombination*> segAssoMap) const { // Strategy for makening trackcandidates: combinations of segments @@ -616,14 +621,14 @@ Muon::MuonCurvedSegmentCombiner::muonCurvedSegmentCombinations(MuonSegmentCombin // CSC -> 0 or more patterns std::map<int, int> segmentsChamber; - SegInfoIt seg_it = m_segInfoMap.begin(); - SegInfoIt seg_it_end = m_segInfoMap.end(); + SegInfoIt seg_it = segInfoMap.begin(); + SegInfoIt seg_it_end = segInfoMap.end(); int nSegments = 0; for (; seg_it != seg_it_end; ++seg_it) { Muon::MuonSegment* segm = seg_it->first; int npSize = 0; - if (m_segAssoMap.count(segm) > 0) { - npSize = npSize + m_segAssoMap.count(segm); + if (segAssoMap.count(segm) > 0) { + npSize = npSize + segAssoMap.count(segm); } else { npSize = 1; } @@ -654,13 +659,13 @@ Muon::MuonCurvedSegmentCombiner::muonCurvedSegmentCombinations(MuonSegmentCombin // std::map<const Muon::MuonPatternCombination*, int> patIndex; - seg_it = m_segInfoMap.begin(); - seg_it_end = m_segInfoMap.end(); + seg_it = segInfoMap.begin(); + seg_it_end = segInfoMap.end(); int patIn = -1; int patInlast = -1; for (; seg_it != seg_it_end; ++seg_it) { Muon::MuonSegment* segm = seg_it->first; - const Muon::MCSCSegmentInfo& info = m_segInfoMap[segm]; + const Muon::MCSCSegmentInfo& info = segInfoMap[segm]; if (info.patPoint != 0) { if (patIndex.count(info.patPoint) != 1) { patInlast++; @@ -713,7 +718,7 @@ Muon::MuonCurvedSegmentCombiner::muonCurvedSegmentCombinations(MuonSegmentCombin } checkSegmentsIndex[indexSegment] = segm; if (checkSegments.count(key) == 1) { - const Muon::MCSCSegmentInfo& info2 = m_segInfoMap[checkSegments[key]]; + const Muon::MCSCSegmentInfo& info2 = segInfoMap[checkSegments[key]]; double theta2 = checkSegments[key]->globalDirection().theta(); std::string st = info.station; if (m_debug) @@ -736,7 +741,7 @@ Muon::MuonCurvedSegmentCombiner::muonCurvedSegmentCombinations(MuonSegmentCombin std::cout << " Check Input Segments " << checkSegments.size() << std::endl; for (; ic_it != ic_it_end; ++ic_it) { Muon::MuonSegment* seg = ic_it->second; - const Muon::MCSCSegmentInfo& info = m_segInfoMap[seg]; + const Muon::MCSCSegmentInfo& info = segInfoMap[seg]; std::string st = info.station; int code = info.stationCode; double theta = seg->globalDirection().theta(); @@ -753,7 +758,7 @@ Muon::MuonCurvedSegmentCombiner::muonCurvedSegmentCombinations(MuonSegmentCombin ic_it = checkSegments.begin(); for (; ic_it != ic_it_end; ++ic_it) { Muon::MuonSegment* segm = ic_it->second; - const Muon::MCSCSegmentInfo& info = m_segInfoMap[segm]; + const Muon::MCSCSegmentInfo& info = segInfoMap[segm]; // Built key from ordered segments per station and missed hits @@ -818,7 +823,7 @@ Muon::MuonCurvedSegmentCombiner::muonCurvedSegmentCombinations(MuonSegmentCombin int code0 = 0; for (; io_it != io_it_end; ++io_it) { Muon::MuonSegment* seg = io_it->second; - const Muon::MCSCSegmentInfo& info = m_segInfoMap[seg]; + const Muon::MCSCSegmentInfo& info = segInfoMap[seg]; std::string st = info.station; segment[i] = seg; station[i] = st; @@ -902,14 +907,14 @@ Muon::MuonCurvedSegmentCombiner::muonCurvedSegmentCombinations(MuonSegmentCombin // Csc 4D segments check all patternpointers if (st1[0] == 'C') { selectPair = false; - if (m_segInfoMap[segment[i]].contains(patPoint[j])) { + if (segInfoMap[segment[i]].contains(patPoint[j])) { // Overwrite = store correct pointer! patPoint[i] = patPoint[j]; selectPair = true; } } else if (st2[0] == 'C') { selectPair = false; - if (m_segInfoMap[segment[j]].contains(patPoint[i])) { + if (segInfoMap[segment[j]].contains(patPoint[i])) { // Overwrite = store correct pointer! patPoint[j] = patPoint[i]; selectPair = true; @@ -1097,24 +1102,24 @@ Muon::MuonCurvedSegmentCombiner::muonCurvedSegmentCombinations(MuonSegmentCombin if (st1[2] != st2[2] && st1[0] == st2[0] && st1[1] == st2[1]) { if (m_debug) std::cout << " Start SL fit 0 " << std::endl; - fit2SegmentsSL(*segment[i], *segment[j], Res, Pull); + fit2SegmentsSL(*segment[i], *segment[j], Res, Pull, segInfoMap); // if (m_doCosmics) fit2SegmentsC(segment[i],segment[j], Res, Pull); } else if ((st1[0] == 'E' || st1[0] == 'F') && (st2[0] == 'E' || st2[0] == 'F') && ((st1[1] == 'O' && st2[1] == 'M') || (st2[1] == 'O' && st1[1] == 'M'))) { if (m_debug) std::cout << " Start SL fit 1 " << std::endl; - fit2SegmentsSL(*segment[i], *segment[j], Res, Pull); + fit2SegmentsSL(*segment[i], *segment[j], Res, Pull, segInfoMap); // if (m_doCosmics) fit2SegmentsC(segment[i],segment[j], Res, Pull); } else { if (m_debug) std::cout << " Start full fit " << std::endl; - if (!m_doCosmics) fit2Segments(*segment[i], *segment[j], Res, Pull); + if (!m_doCosmics) fit2Segments(*segment[i], *segment[j], Res, Pull, segInfoMap); if (m_doCosmics) { if (dphis > 0.) { - fit2SegmentsC(*segment[i], *segment[j], Res, Pull); + fit2SegmentsC(*segment[i], *segment[j], Res, Pull, segInfoMap); if (fabs(Pull[0]) > m_pullAssociationCut || fabs(Pull[1]) > m_pullAssociationCut || fabs(Pull[2]) > m_pullAssociationCut || fabs(Pull[3]) > m_pullAssociationCut) { - fit2SegmentsSL(*segment[i], *segment[j], Res, Pull); + fit2SegmentsSL(*segment[i], *segment[j], Res, Pull, segInfoMap); } } else { if (m_debug) std::cout << " not doing any fit " << std::endl; @@ -1335,7 +1340,6 @@ Muon::MuonCurvedSegmentCombiner::muonCurvedSegmentCombinations(MuonSegmentCombin if (patPoint[combi[k]]) patc = patPoint[combi[k]]; if (m_debug) { Muon::MuonSegment* seg = segment[combi[k]]; - // const Muon::MCSCSegmentInfo& info = m_segInfoMap[seg]; double phisp = atan2(seg->globalPosition().y(), seg->globalPosition().x()); std::cout << " Segment position x " << seg->globalPosition().x() << " y " << seg->globalPosition().y() << " z " << seg->globalPosition().z() << " phi " @@ -1378,7 +1382,7 @@ Muon::MuonCurvedSegmentCombiner::muonCurvedSegmentCombinations(MuonSegmentCombin } unsigned int -Muon::MuonCurvedSegmentCombiner::missedHits(Muon::MuonSegment* seg) +Muon::MuonCurvedSegmentCombiner::missedHits(Muon::MuonSegment* seg) const { // try to dynamic_cast to MdtSegmentQuality in order to obtain quality @@ -1403,7 +1407,8 @@ Muon::MuonCurvedSegmentCombiner::missedHits(Muon::MuonSegment* seg) } Muon::MCSCSegmentInfo -Muon::MuonCurvedSegmentCombiner::segInfo(Muon::MuonSegment* seg) +Muon::MuonCurvedSegmentCombiner::segInfo(Muon::MuonSegment* seg, SegInfoMap segInfoMap, + std::map<Muon::MuonSegment*, const MuonPatternCombination*> segAssoMap) const { Muon::MCSCSegmentInfo info; @@ -1615,8 +1620,8 @@ Muon::MuonCurvedSegmentCombiner::segInfo(Muon::MuonSegment* seg) double patternMomentum = -1.; info.patPoint = 0; - // Navigate to FIRST pattern stored in m_segAssoMap - const Muon::MuonPatternCombination* patP = m_segAssoMap[seg]; + // Navigate to FIRST pattern stored in segAssoMap + const Muon::MuonPatternCombination* patP = segAssoMap[seg]; if (patP != 0) { // Set pattern pointer info.patPoint = patP; @@ -1666,7 +1671,7 @@ Muon::MuonCurvedSegmentCombiner::segInfo(Muon::MuonSegment* seg) double theta; double invcurvature; int imeth; - trackParameters(*seg, theta, invcurvature, imeth); + trackParameters(*seg, theta, invcurvature, imeth, segInfoMap); info.invcurvature = invcurvature; return info; @@ -1674,7 +1679,7 @@ Muon::MuonCurvedSegmentCombiner::segInfo(Muon::MuonSegment* seg) void Muon::MuonCurvedSegmentCombiner::trackParameters(Muon::MuonSegment& seg, double& theta, double& invcurvature, - int& imeth) + int& imeth, SegInfoMap segInfoMap) const { // Determine track parameters in Rz plane (theta and inverse curvature) from the input segment @@ -1705,7 +1710,7 @@ Muon::MuonCurvedSegmentCombiner::trackParameters(Muon::MuonSegment& seg, double& double sign = 1; if (zs < 0) sign = -1.; - const Muon::MCSCSegmentInfo& info = m_segInfoMap[&seg]; + const Muon::MCSCSegmentInfo& info = segInfoMap[&seg]; std::string st = info.station; bool barrel = false; if (st[0] == 'B') barrel = true; @@ -1804,7 +1809,7 @@ Muon::MuonCurvedSegmentCombiner::trackParameters(Muon::MuonSegment& seg, double& void Muon::MuonCurvedSegmentCombiner::fit2SegmentsSL(Muon::MuonSegment& seg, Muon::MuonSegment& sege, Amg::VectorX& Res, - Amg::VectorX& Pull) + Amg::VectorX& Pull, SegInfoMap segInfoMap) const { @@ -1829,7 +1834,7 @@ Muon::MuonCurvedSegmentCombiner::fit2SegmentsSL(Muon::MuonSegment& seg, Muon::Mu // int imeth; // First Segment - const Muon::MCSCSegmentInfo& info1 = m_segInfoMap[&seg]; + const Muon::MCSCSegmentInfo& info1 = segInfoMap[&seg]; double thetas = seg.globalDirection().theta(); double rs = seg.globalPosition().perp(); double zs = seg.globalPosition().z(); @@ -1839,7 +1844,7 @@ Muon::MuonCurvedSegmentCombiner::fit2SegmentsSL(Muon::MuonSegment& seg, Muon::Mu if (info1.nMult1 == 0 || info1.nMult2 == 0) era1 = 0.002; if (info1.nCsc > 0) era1 = 0.002; // Second Segment - const Muon::MCSCSegmentInfo& info2 = m_segInfoMap[&sege]; + const Muon::MCSCSegmentInfo& info2 = segInfoMap[&sege]; double thetase = sege.globalDirection().theta(); if (m_debug) std::cout << " thetase " << thetase << std::endl; double rse = sege.globalPosition().perp(); @@ -2024,7 +2029,7 @@ Muon::MuonCurvedSegmentCombiner::fit2SegmentsSL(Muon::MuonSegment& seg, Muon::Mu void Muon::MuonCurvedSegmentCombiner::fit2Segments(Muon::MuonSegment& seg, Muon::MuonSegment& sege, Amg::VectorX& Res, - Amg::VectorX& Pull) + Amg::VectorX& Pull, SegInfoMap segInfoMap) const { @@ -2053,7 +2058,7 @@ Muon::MuonCurvedSegmentCombiner::fit2Segments(Muon::MuonSegment& seg, Muon::Muon int imeth; // First Segment - const Muon::MCSCSegmentInfo& info1 = m_segInfoMap[&seg]; + const Muon::MCSCSegmentInfo& info1 = segInfoMap[&seg]; double thetas = seg.globalDirection().theta(); double rs = seg.globalPosition().perp(); double zs = seg.globalPosition().z(); @@ -2065,7 +2070,7 @@ Muon::MuonCurvedSegmentCombiner::fit2Segments(Muon::MuonSegment& seg, Muon::Muon if (info1.nMult1 == 0 || info1.nMult2 == 0) era1 = 0.002; if (info1.nCsc > 0) era1 = 0.002; // Second Segment - const Muon::MCSCSegmentInfo& info2 = m_segInfoMap[&sege]; + const Muon::MCSCSegmentInfo& info2 = segInfoMap[&sege]; double thetase = sege.globalDirection().theta(); double rse = sege.globalPosition().perp(); double zse = sege.globalPosition().z(); @@ -2269,7 +2274,7 @@ Muon::MuonCurvedSegmentCombiner::fit2Segments(Muon::MuonSegment& seg, Muon::Muon void Muon::MuonCurvedSegmentCombiner::fit2SegmentsC(Muon::MuonSegment& seg, Muon::MuonSegment& sege, Amg::VectorX& Res, - Amg::VectorX& Pull) + Amg::VectorX& Pull, SegInfoMap segInfoMap) const { // Fit two segments for cosmics with loose IP constraint and free curvature @@ -2297,7 +2302,7 @@ Muon::MuonCurvedSegmentCombiner::fit2SegmentsC(Muon::MuonSegment& seg, Muon::Muo int imeth; // First Segment - const Muon::MCSCSegmentInfo& info1 = m_segInfoMap[&seg]; + const Muon::MCSCSegmentInfo& info1 = segInfoMap[&seg]; double thetas = seg.globalDirection().theta(); double rs = seg.globalPosition().perp(); double zs = seg.globalPosition().z(); @@ -2307,7 +2312,7 @@ Muon::MuonCurvedSegmentCombiner::fit2SegmentsC(Muon::MuonSegment& seg, Muon::Muo if (info1.nMult1 == 0 || info1.nMult2 == 0) era1 = 0.002; if (info1.nCsc > 0) era1 = 0.002; // Second Segment - const Muon::MCSCSegmentInfo& info2 = m_segInfoMap[&sege]; + const Muon::MCSCSegmentInfo& info2 = segInfoMap[&sege]; double thetase = sege.globalDirection().theta(); double rse = sege.globalPosition().perp(); double zse = sege.globalPosition().z(); @@ -2520,7 +2525,7 @@ Muon::MuonCurvedSegmentCombiner::fit2SegmentsC(Muon::MuonSegment& seg, Muon::Muo void Muon::MuonCurvedSegmentCombiner::extrapolateSegment(Muon::MuonSegment& seg, Muon::MuonSegment& sege, Amg::VectorX& Res, - Amg::VectorX& Pull) + Amg::VectorX& Pull, SegInfoMap segInfoMap) const { // extrapolate segment seg* to segment sege* and determine residuals and pulls @@ -2568,8 +2573,8 @@ Muon::MuonCurvedSegmentCombiner::extrapolateSegment(Muon::MuonSegment& seg, Muon double sign = 1; if (zs < 0) sign = -1.; - const Muon::MCSCSegmentInfo& info1 = m_segInfoMap[&seg]; - const Muon::MCSCSegmentInfo& info2 = m_segInfoMap[&sege]; + const Muon::MCSCSegmentInfo& info1 = segInfoMap[&seg]; + const Muon::MCSCSegmentInfo& info2 = segInfoMap[&sege]; std::string st1 = info1.station; std::string st2 = info2.station; diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonSegmentCombinerToolInterfaces/MuonSegmentCombinerToolInterfaces/IMooSegmentCombinationFinder.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonSegmentCombinerToolInterfaces/MuonSegmentCombinerToolInterfaces/IMooSegmentCombinationFinder.h index 5d771614e6a2dc7c87a3fcb87c760ea44cdeccc1..7551c0b331fb5ed72a255b030c0bf66a47f0629c 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonSegmentCombinerToolInterfaces/MuonSegmentCombinerToolInterfaces/IMooSegmentCombinationFinder.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonSegmentCombinerToolInterfaces/MuonSegmentCombinerToolInterfaces/IMooSegmentCombinationFinder.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 */ /////////////////////////////////////////////////////////////////// @@ -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) = 0; + Output& output) const = 0; }; diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonSegmentCombinerToolInterfaces/MuonSegmentCombinerToolInterfaces/IMuonCurvedSegmentCombiner.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonSegmentCombinerToolInterfaces/MuonSegmentCombinerToolInterfaces/IMuonCurvedSegmentCombiner.h index 4b7a65a771111aa6e431f1c4210a4aa23aaac5b1..684935c1015699973e571e494708b12658c436df 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonSegmentCombinerToolInterfaces/MuonSegmentCombinerToolInterfaces/IMuonCurvedSegmentCombiner.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonSegmentCombinerToolInterfaces/MuonSegmentCombinerToolInterfaces/IMuonCurvedSegmentCombiner.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 */ /////////////////////////////////////////////////////////////////// @@ -23,7 +23,7 @@ namespace Muon virtual std::unique_ptr<MuonSegmentCombinationCollection> combineSegments( const MuonSegmentCombinationCollection& mdtCombiColl, const MuonSegmentCombinationCollection& csc4DCombiColl, const MuonSegmentCombinationCollection& csc2DCombiColl, - MuonSegmentCombPatternCombAssociationMap* segPattMap)=0; + MuonSegmentCombPatternCombAssociationMap* segPattMap) const =0; }; inline const InterfaceID& Muon::IMuonCurvedSegmentCombiner::interfaceID() diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonSegmentCombinerToolInterfaces/MuonSegmentCombinerToolInterfaces/IMuonSegmentCombinationCleanerTool.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonSegmentCombinerToolInterfaces/MuonSegmentCombinerToolInterfaces/IMuonSegmentCombinationCleanerTool.h index 4c11ab76a695aaddaf9744048bbc69970a1095e9..6581d3080334c39fc31242465a2f158eeecbe7cd 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonSegmentCombinerToolInterfaces/MuonSegmentCombinerToolInterfaces/IMuonSegmentCombinationCleanerTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonSegmentCombinerToolInterfaces/MuonSegmentCombinerToolInterfaces/IMuonSegmentCombinationCleanerTool.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_IMUONSEGMENTCOMBINATIONCLEANERTOOL_H @@ -26,7 +26,7 @@ namespace Muon { static const InterfaceID& interfaceID(); /** clean phi hits on a segment combination */ - virtual std::unique_ptr<MuonSegmentCombinationCollection> clean( const MuonSegmentCombinationCollection& combiCol, MuonSegmentCombPatternCombAssociationMap* segPattMap ) = 0; + virtual std::unique_ptr<MuonSegmentCombinationCollection> clean( const MuonSegmentCombinationCollection& combiCol, MuonSegmentCombPatternCombAssociationMap* segPattMap ) const = 0; }; diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMakerToolInterfaces/MuonSegmentMakerToolInterfaces/IMuonSegmentPairFittingTool.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMakerToolInterfaces/MuonSegmentMakerToolInterfaces/IMuonSegmentPairFittingTool.h index 94dff3b0d54e2db1b0efbcc1fa3e85f514406141..811c16bae6920c5013e542b111640d2b52c594b5 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMakerToolInterfaces/MuonSegmentMakerToolInterfaces/IMuonSegmentPairFittingTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMakerToolInterfaces/MuonSegmentMakerToolInterfaces/IMuonSegmentPairFittingTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUON_IMUONSEGMENTPAITFITTER_H @@ -27,14 +27,6 @@ namespace Muon { /** @brief access to tool interface */ static const InterfaceID& interfaceID() { return IID_IMuonSegmentPairFittingTool; } - - virtual void trackParameters( Muon::MuonSegment& seg ,double &theta,double &curvature,int &imeth ) = 0; - virtual void extrapolateSegment( Muon::MuonSegment& seg , Muon::MuonSegment& sege, Amg::VectorX& Res, Amg::VectorX& Pull ) = 0; - - virtual void fit2Segments( Muon::MuonSegment& seg , Muon::MuonSegment& sege, Amg::VectorX& Res, Amg::VectorX& Pull ) = 0; - virtual void fit2SegmentsC( Muon::MuonSegment& seg , Muon::MuonSegment& sege, Amg::VectorX& Res, Amg::VectorX& Pull ) = 0; - virtual void fit2SegmentsSL( Muon::MuonSegment& seg , Muon::MuonSegment& sege, Amg::VectorX& Res, Amg::VectorX& Pull ) = 0; - }; } diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentOverlapRemovalTools/src/MuonSegmentCombinationCleanerTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentOverlapRemovalTools/src/MuonSegmentCombinationCleanerTool.cxx index 079a2338e0caec4c0da65c9cac541bd6afb68684..742031d12b246e4abff0ef29a478bce5637001da 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentOverlapRemovalTools/src/MuonSegmentCombinationCleanerTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentOverlapRemovalTools/src/MuonSegmentCombinationCleanerTool.cxx @@ -45,7 +45,7 @@ MuonSegmentCombinationCleanerTool::initialize() std::unique_ptr<MuonSegmentCombinationCollection> MuonSegmentCombinationCleanerTool::clean(const MuonSegmentCombinationCollection& combiCol, - MuonSegmentCombPatternCombAssociationMap* segPattMap) + MuonSegmentCombPatternCombAssociationMap* segPattMap) const { std::unique_ptr<MuonSegmentCombinationCollection> combiCleanCol(new MuonSegmentCombinationCollection); @@ -58,7 +58,7 @@ MuonSegmentCombinationCleanerTool::clean(const MuonSegmentCombinationCollection& void MuonSegmentCombinationCleanerTool::cleanAndMergeCombis(const MuonSegmentCombinationCollection& combiCol, MuonSegmentCombinationCollection* combiCleanCol, - MuonSegmentCombPatternCombAssociationMap* segPattMap) + MuonSegmentCombPatternCombAssociationMap* segPattMap) const { ATH_MSG_DEBUG(" cleaning combis " << combiCol.size()); diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentOverlapRemovalTools/src/MuonSegmentCombinationCleanerTool.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentOverlapRemovalTools/src/MuonSegmentCombinationCleanerTool.h index e707b85173cfd463793dd1663f0e04f0eea6918b..295382a8c486a9fed0d521c5fa0fb0b26a085e92 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentOverlapRemovalTools/src/MuonSegmentCombinationCleanerTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentOverlapRemovalTools/src/MuonSegmentCombinationCleanerTool.h @@ -39,7 +39,7 @@ class MuonSegmentCombinationCleanerTool : virtual public IMuonSegmentCombination /** clean segment combination collections */ std::unique_ptr<MuonSegmentCombinationCollection> clean(const MuonSegmentCombinationCollection& combiCol, - MuonSegmentCombPatternCombAssociationMap* segPattMap); + MuonSegmentCombPatternCombAssociationMap* segPattMap) const; /** remove duplicates from a segment combination, returns a pointer to the original combi if unchanged */ MuonSegmentCombination* removeDuplicateSegments(MuonSegmentCombination& combi) const; @@ -48,7 +48,7 @@ class MuonSegmentCombinationCleanerTool : virtual public IMuonSegmentCombination /** remove overlaps between combination and merge combinations with large overlap */ void cleanAndMergeCombis(const MuonSegmentCombinationCollection& combiCol, MuonSegmentCombinationCollection* combiCleanCol, - MuonSegmentCombPatternCombAssociationMap* segPattMap); + MuonSegmentCombPatternCombAssociationMap* segPattMap) const; /** check whether current summary is a subset of the previous once */ bool subSetOfPrevious(MuonSegmentCombiSummary& summary, std::vector<MuonSegmentCombiSummary>& summaries) const;