diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces/MuonRecToolInterfaces/IMuonSeededSegmentFinder.h b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces/MuonRecToolInterfaces/IMuonSeededSegmentFinder.h index 7cb06acb6eabb03f92cbe34acaca30c875a85151..cb856139d0f86d073c9ac3701f39c678c4d8586a 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces/MuonRecToolInterfaces/IMuonSeededSegmentFinder.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces/MuonRecToolInterfaces/IMuonSeededSegmentFinder.h @@ -44,7 +44,7 @@ namespace Muon { const std::set<IdentifierHash>& chIdHs) const = 0; /** @brief find segments in a set of MdtPrepData starting from seeding TrackParameters */ - virtual std::unique_ptr<Trk::SegmentCollection> find(const Trk::TrackParameters& pars, + virtual std::unique_ptr<Trk::SegmentCollection> find(const EventContext& ctx, const Trk::TrackParameters& pars, const std::vector<const MdtPrepData*>& mdtPrds) const = 0; /** @brief retrieve MDT PRD collections for the given hashes */ diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces/MuonRecToolInterfaces/IMuonSegmentMomentumEstimator.h b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces/MuonRecToolInterfaces/IMuonSegmentMomentumEstimator.h index 35859f5d43d84747c4516c66b8abb8108d073a97..f63f598936a22c8fd51d0482cee7cf7d3c69715f 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces/MuonRecToolInterfaces/IMuonSegmentMomentumEstimator.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces/MuonRecToolInterfaces/IMuonSegmentMomentumEstimator.h @@ -22,8 +22,8 @@ namespace Muon { static const InterfaceID& interfaceID(); /** Calculate Momentum Estimate for 2 segments */ - virtual void fitMomentum2Segments(const MuonSegment* segment1, const MuonSegment* segment2, double& signedMomentum) const = 0; - virtual void fitMomentumVectorSegments(const std::vector<const MuonSegment*>, double& signedMomentum) const = 0; + virtual void fitMomentum2Segments(const EventContext& ctx, const MuonSegment* segment1, const MuonSegment* segment2, double& signedMomentum) const = 0; + virtual void fitMomentumVectorSegments(const EventContext& ctx, const std::vector<const MuonSegment*>, double& signedMomentum) const = 0; }; inline const InterfaceID& IMuonSegmentMomentumEstimator::interfaceID() { return IID_IMuonSegmentMomentumEstimator; } diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMakerToolInterfaces/MuonSegmentMakerToolInterfaces/IMuonSegmentInOverlapResolvingTool.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMakerToolInterfaces/MuonSegmentMakerToolInterfaces/IMuonSegmentInOverlapResolvingTool.h index 848b5164de8d51e69cb63d0cc35a7c5da6be97b6..6f9629bd11ff18ea144170dee7a16602b17c7053 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMakerToolInterfaces/MuonSegmentMakerToolInterfaces/IMuonSegmentInOverlapResolvingTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMakerToolInterfaces/MuonSegmentMakerToolInterfaces/IMuonSegmentInOverlapResolvingTool.h @@ -153,7 +153,7 @@ namespace Muon { } /** @brief performance match and return result */ - virtual SegmentMatchResult matchResult(const MuonSegment& seg1, const MuonSegment& seg2) const = 0; + virtual SegmentMatchResult matchResult(const EventContext& ctx, const MuonSegment& seg1, const MuonSegment& seg2) const = 0; /** @brief calculate the position along a tube direction of the first segment that results in the smallest position residual in the precision plane of the second segment given diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMakerToolInterfaces/MuonSegmentMakerToolInterfaces/IMuonSegmentMatchingTool.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMakerToolInterfaces/MuonSegmentMakerToolInterfaces/IMuonSegmentMatchingTool.h index 766e4f360aa545ef41ed889dc7587a80a0863436..71b3a30e65af6f8c87c30ef6943c183cd8099f29 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMakerToolInterfaces/MuonSegmentMakerToolInterfaces/IMuonSegmentMatchingTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMakerToolInterfaces/MuonSegmentMakerToolInterfaces/IMuonSegmentMatchingTool.h @@ -33,7 +33,7 @@ namespace Muon { } /** @brief match two segments */ - virtual bool match(const MuonSegment& seg1, const MuonSegment& seg2) const = 0; + virtual bool match(const EventContext& ctx, const MuonSegment& seg1, const MuonSegment& seg2) const = 0; virtual ~IMuonSegmentMatchingTool() = default; }; diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMatchingTools/src/MuonSegmentInOverlapResolvingTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMatchingTools/src/MuonSegmentInOverlapResolvingTool.cxx index 6f613fdc96c35f66b418bd7137c594de9fe69254..40a3f3e94d9e93d158d2596ee8530c522232542a 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMatchingTools/src/MuonSegmentInOverlapResolvingTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMatchingTools/src/MuonSegmentInOverlapResolvingTool.cxx @@ -453,7 +453,7 @@ MuonSegmentInOverlapResolvingTool::segmentGeometrySummary(const MuonSegment& seg } MuonSegmentInOverlapResolvingTool::SegmentMatchResult -MuonSegmentInOverlapResolvingTool::matchResult(const MuonSegment& seg1, const MuonSegment& seg2) const +MuonSegmentInOverlapResolvingTool::matchResult(const EventContext& ctx, const MuonSegment& seg1, const MuonSegment& seg2) const { ATH_MSG_DEBUG(" First segment " << m_printer->print(seg1) << std::endl @@ -468,8 +468,8 @@ MuonSegmentInOverlapResolvingTool::matchResult(const MuonSegment& seg1, const Mu result.segmentResult2 = bestPositionAlongTubeMatch(seg2, seg1, result.phiResult.segmentDirection2); // calculate the average pull of the phi hits on the segments with the new parameters - result.averagePhiHitPullSegment1 = checkPhiHitConsistency(seg1, result.phiResult, result.segmentResult1); - result.averagePhiHitPullSegment2 = checkPhiHitConsistency(seg2, result.phiResult, result.segmentResult2); + result.averagePhiHitPullSegment1 = checkPhiHitConsistency(ctx, seg1, result.phiResult, result.segmentResult1); + result.averagePhiHitPullSegment2 = checkPhiHitConsistency(ctx, seg2, result.phiResult, result.segmentResult2); if (result.segmentResult1.goodMatch && result.segmentResult2.goodMatch) { @@ -489,7 +489,7 @@ MuonSegmentInOverlapResolvingTool::matchResult(const MuonSegment& seg1, const Mu double -MuonSegmentInOverlapResolvingTool::checkPhiHitConsistency(const Muon::MuonSegment& segment, +MuonSegmentInOverlapResolvingTool::checkPhiHitConsistency(const EventContext& ctx, const Muon::MuonSegment& segment, SegmentPhiMatchResult& phiMatchResult, SegmentPositionMatchResult& posMatchResult) const { @@ -517,7 +517,7 @@ MuonSegmentInOverlapResolvingTool::checkPhiHitConsistency(const Muon::MuonSegmen // propagate station parameters to segment std::unique_ptr<const Trk::TrackParameters> exPars { m_propagator->propagate( - Gaudi::Hive::currentContext(), + ctx, segPars, measSurf, Trk::anyDirection, diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMatchingTools/src/MuonSegmentInOverlapResolvingTool.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMatchingTools/src/MuonSegmentInOverlapResolvingTool.h index 4d505a5e9e78e8c4add557bc65ff13661ae523dc..ed5e47e8c749ae5cbe408c0a3adbcf6524e5a349 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMatchingTools/src/MuonSegmentInOverlapResolvingTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMatchingTools/src/MuonSegmentInOverlapResolvingTool.h @@ -50,7 +50,7 @@ class MuonSegmentInOverlapResolvingTool : virtual public IMuonSegmentInOverlapRe StatusCode initialize(); /** @brief performance match and return result */ - SegmentMatchResult matchResult(const MuonSegment& seg1, const MuonSegment& seg2) const; + SegmentMatchResult matchResult(const EventContext& ctx, const MuonSegment& seg1, const MuonSegment& seg2) const; /** @brief calculate the position along a tube direction of the first segment that results in the smallest position residual in the precision plane of the second segment given @@ -74,7 +74,7 @@ class MuonSegmentInOverlapResolvingTool : virtual public IMuonSegmentInOverlapRe private: /** compare phi hits with segment parameters, return average pull of the phi hits */ - double checkPhiHitConsistency(const Muon::MuonSegment& segment, SegmentPhiMatchResult& phiMatchResult, + double checkPhiHitConsistency(const EventContext& ctx, const Muon::MuonSegment& segment, SegmentPhiMatchResult& phiMatchResult, SegmentPositionMatchResult& matchResult) const; Amg::Vector3D estimateSegmentDirection(const MuonSegment& seg1, const MuonSegment& seg2, double& phi, diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMatchingTools/src/MuonSegmentMatchingTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMatchingTools/src/MuonSegmentMatchingTool.cxx index 81fd9ed6a0de5c6a558755e2d4cc6879f1f6092f..ff085d1c1d1a508a0b9668e73321ed2fa9e65659 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMatchingTools/src/MuonSegmentMatchingTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMatchingTools/src/MuonSegmentMatchingTool.cxx @@ -117,7 +117,7 @@ MuonSegmentMatchingTool::finalize() return StatusCode::SUCCESS; } bool -MuonSegmentMatchingTool::match(const MuonSegment& seg1, const MuonSegment& seg2) const { +MuonSegmentMatchingTool::match(const EventContext& ctx, const MuonSegment& seg1, const MuonSegment& seg2) const { ATH_MSG_VERBOSE(" match: segments " << std::endl << m_printer->print(seg1) << std::endl << m_printer->print(seg2)); @@ -146,7 +146,7 @@ MuonSegmentMatchingTool::match(const MuonSegment& seg1, const MuonSegment& seg2) && ( std::abs(phi1 - phi2) == 1 || (phi1 == 1 && phi2 == 16) || (phi1 == 16 && phi2 == 1))) { - return overlapMatch(seg1, seg2); + return overlapMatch(ctx, seg1, seg2); } else return false; } @@ -211,7 +211,7 @@ MuonSegmentMatchingTool::curvedMatch(const MuonSegment& seg1, const MuonSegment& } bool -MuonSegmentMatchingTool::overlapMatch(const MuonSegment& seg1, const MuonSegment& seg2) const +MuonSegmentMatchingTool::overlapMatch(const EventContext& ctx, const MuonSegment& seg1, const MuonSegment& seg2) const { ++m_overlapMatches; @@ -233,7 +233,7 @@ MuonSegmentMatchingTool::overlapMatch(const MuonSegment& seg1, const MuonSegment return true; } - IMuonSegmentInOverlapResolvingTool::SegmentMatchResult result = m_overlapResolvingTool->matchResult(seg1, seg2); + IMuonSegmentInOverlapResolvingTool::SegmentMatchResult result = m_overlapResolvingTool->matchResult(ctx, seg1, seg2); ATH_MSG_VERBOSE(result.toString()); diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMatchingTools/src/MuonSegmentMatchingTool.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMatchingTools/src/MuonSegmentMatchingTool.h index 5d85938f2a941c0c4b7a89dee0f84b7949b24861..f9596b34bef9bbc639c7e831ba1fd7e52f87be12 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMatchingTools/src/MuonSegmentMatchingTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMatchingTools/src/MuonSegmentMatchingTool.h @@ -45,7 +45,7 @@ class MuonSegmentMatchingTool : virtual public IMuonSegmentMatchingTool, public StatusCode finalize(); /** @brief match two segments */ - bool match(const MuonSegment& seg1, const MuonSegment& seg2) const; + bool match(const EventContext& ctx, const MuonSegment& seg1, const MuonSegment& seg2) const; private: /** @brief perform straight line matching using SL extrapolation */ @@ -55,7 +55,7 @@ class MuonSegmentMatchingTool : virtual public IMuonSegmentMatchingTool, public bool curvedMatch(const MuonSegment& seg1, const MuonSegment& seg2) const; /** @brief perform overlap matching */ - bool overlapMatch(const MuonSegment& seg1, const MuonSegment& seg2) const; + bool overlapMatch(const EventContext& ctx, const MuonSegment& seg1, const MuonSegment& seg2) const; /** @brief setup field */ bool initializeField() const; diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMomentum/src/MuonSegmentMomentum.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMomentum/src/MuonSegmentMomentum.cxx index fde9477050a6769a66e4e6a9a0c56abaf7afdb32..0e6739fb88d49b0c9bf7a5fdd08e095ab97db8e6 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMomentum/src/MuonSegmentMomentum.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMomentum/src/MuonSegmentMomentum.cxx @@ -15,7 +15,7 @@ MuonSegmentMomentum::MuonSegmentMomentum(const std::string& type,const std::stri declareInterface<IMuonSegmentMomentumEstimator>(this); } -void MuonSegmentMomentum::fitMomentumVectorSegments( const std::vector <const Muon::MuonSegment*> segments, double & signedMomentum ) const +void MuonSegmentMomentum::fitMomentumVectorSegments( const EventContext& ctx, const std::vector <const Muon::MuonSegment*> segments, double & signedMomentum ) const { /** Estimate signed momentum from vector of MDT/CSC segments @@ -34,7 +34,7 @@ void MuonSegmentMomentum::fitMomentumVectorSegments( const std::vector <const Mu for(it2 = it; it2 < it_end ; ++it2 ) { if (it == it2) continue; double smom; - fitMomentum2Segments(*it, *it2, smom); + fitMomentum2Segments(ctx, *it, *it2, smom); ATH_MSG_DEBUG(" Fit pair of segments signed momentum " << smom); if (fabs(smom) < fabs(pmin)) pmin = smom; } @@ -49,7 +49,7 @@ void MuonSegmentMomentum::fitMomentumVectorSegments( const std::vector <const Mu -void MuonSegmentMomentum::fitMomentum2Segments( const Muon::MuonSegment* segment1, const Muon::MuonSegment* segment2, double & signedMomentum ) const +void MuonSegmentMomentum::fitMomentum2Segments( const EventContext&, const Muon::MuonSegment* segment1, const Muon::MuonSegment* segment2, double & signedMomentum ) const { /** Estimate signed momentum for two segments diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMomentum/src/MuonSegmentMomentum.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMomentum/src/MuonSegmentMomentum.h index 498c83c680471d0e73a34df05b3aa65355c5be4e..bebee031a5ca424328a343f7b241dd39940766e9 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMomentum/src/MuonSegmentMomentum.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMomentum/src/MuonSegmentMomentum.h @@ -22,10 +22,10 @@ class MuonSegmentMomentum : public AthAlgTool, virtual public Muon::IMuonSegment MuonSegmentMomentum& operator= (const MuonSegmentMomentum& ) = delete; /** fits a momentum to 2 segments */ - virtual void fitMomentum2Segments( const Muon::MuonSegment* segment1, const Muon::MuonSegment* segment2, double & signedMomentum ) const override; + virtual void fitMomentum2Segments( const EventContext&, const Muon::MuonSegment* segment1, const Muon::MuonSegment* segment2, double & signedMomentum ) const override; /** fits a momentum to a vector of segments */ - virtual void fitMomentumVectorSegments( const std::vector <const Muon::MuonSegment*>, double & signedMomentum ) const override; + virtual void fitMomentumVectorSegments( const EventContext&, const std::vector <const Muon::MuonSegment*>, double & signedMomentum ) const override; private: /** flag for use of cosmics, straight line model will be used, no interaction point constraint */ diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMomentum/src/MuonSegmentMomentumFromField.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMomentum/src/MuonSegmentMomentumFromField.cxx index aad5b80ac18ef90556fb9d1ba64e2980b563a55b..030d1d9cf5f9bb055d184a3f66e5a073af18b6aa 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMomentum/src/MuonSegmentMomentumFromField.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMomentum/src/MuonSegmentMomentumFromField.cxx @@ -35,7 +35,7 @@ StatusCode MuonSegmentMomentumFromField::initialize() return StatusCode::SUCCESS; } -void MuonSegmentMomentumFromField::fitMomentumVectorSegments( const std::vector <const Muon::MuonSegment*> segments, double & signedMomentum ) const +void MuonSegmentMomentumFromField::fitMomentumVectorSegments( const EventContext& ctx, const std::vector <const Muon::MuonSegment*> segments, double & signedMomentum ) const { /** Estimate signed momentum from vector of MDT/CSC segments @@ -51,11 +51,11 @@ void MuonSegmentMomentumFromField::fitMomentumVectorSegments( const std::vector it2++; double maxintegral=0; while (it2!=it_end){ - double integral= m_doOld ? fieldIntegralEstimate_old(*it,*it2) : fieldIntegralEstimate(*it,*it2); + double integral= m_doOld ? fieldIntegralEstimate_old(ctx,*it,*it2) : fieldIntegralEstimate(ctx,*it,*it2); if (std::abs(integral)>maxintegral){ maxintegral=std::abs(integral); - if( m_doOld ) fitMomentum2Segments_old(*it, *it2, signedMomentum); - else fitMomentum2Segments(*it, *it2, signedMomentum); + if( m_doOld ) fitMomentum2Segments_old(ctx, *it, *it2, signedMomentum); + else fitMomentum2Segments(ctx, *it, *it2, signedMomentum); } it++; it2++; @@ -63,7 +63,7 @@ void MuonSegmentMomentumFromField::fitMomentumVectorSegments( const std::vector ATH_MSG_DEBUG( " Estimated signed momentum " << signedMomentum ); } -double MuonSegmentMomentumFromField::fieldIntegralEstimate( const Muon::MuonSegment* segment1, const Muon::MuonSegment* segment2) const +double MuonSegmentMomentumFromField::fieldIntegralEstimate( const EventContext& ctx, const Muon::MuonSegment* segment1, const Muon::MuonSegment* segment2) const { Amg::Vector3D pos1=segment1->globalPosition(); @@ -80,7 +80,7 @@ double MuonSegmentMomentumFromField::fieldIntegralEstimate( const Muon::MuonSegm Amg::Vector3D field1,field2,field3; MagField::AtlasFieldCache fieldCache; - SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCondObjInputKey, Gaudi::Hive::currentContext()}; + SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCondObjInputKey, ctx}; const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; if (!fieldCondObj) { throw std::runtime_error(Form("File: %s, Line: %d\nMuonSegmentMomentumFromField::fieldIntegralEstimate() - Failed to retrieve AtlasFieldCacheCondObj with key %s", __FILE__, __LINE__, (m_fieldCondObjInputKey.key()).c_str())); @@ -101,7 +101,7 @@ double MuonSegmentMomentumFromField::fieldIntegralEstimate( const Muon::MuonSegm return averagelcrossB*posdiff.mag(); } -void MuonSegmentMomentumFromField::fitMomentum2Segments( const Muon::MuonSegment* segment1, const Muon::MuonSegment* segment2, double & signedMomentum ) const +void MuonSegmentMomentumFromField::fitMomentum2Segments( const EventContext& ctx, const Muon::MuonSegment* segment1, const Muon::MuonSegment* segment2, double & signedMomentum ) const { /** Estimate signed momentum for two segments @@ -114,7 +114,7 @@ void MuonSegmentMomentumFromField::fitMomentum2Segments( const Muon::MuonSegment myseg1=segment2; myseg2=segment1; } - double fieldintegral=fieldIntegralEstimate(myseg1,myseg2); + double fieldintegral=fieldIntegralEstimate(ctx, myseg1,myseg2); double theta1=myseg1->globalDirection().theta(); double theta2=myseg2->globalDirection().theta(); double phi1=myseg1->globalDirection().phi(); @@ -192,8 +192,7 @@ void MuonSegmentMomentumFromField::fitMomentum2Segments( const Muon::MuonSegment Trk::AtaPlane startpar(bestseg->globalPosition(),bestseg->globalDirection().phi(), bestseg->globalDirection().theta(),1/signedMomentum,bestseg->associatedSurface()); auto par=m_propagator->propagateParameters( - Gaudi::Hive::currentContext(), - startpar,worstseg->associatedSurface(), + ctx, startpar,worstseg->associatedSurface(), (bestseg==myseg1) ? Trk::alongMomentum : Trk::oppositeMomentum,false, Trk::MagneticFieldProperties(Trk::FullField),jac,Trk::nonInteracting); ATH_MSG_DEBUG("par: " << par.get() << " jac: " << jac ); @@ -243,7 +242,7 @@ void MuonSegmentMomentumFromField::fitMomentum2Segments( const Muon::MuonSegment } -double MuonSegmentMomentumFromField::fieldIntegralEstimate_old( const Muon::MuonSegment* segment1, const Muon::MuonSegment* segment2) const +double MuonSegmentMomentumFromField::fieldIntegralEstimate_old( const EventContext& ctx, const Muon::MuonSegment* segment1, const Muon::MuonSegment* segment2) const { Amg::Vector3D pos1=segment1->globalPosition(); @@ -260,7 +259,7 @@ double MuonSegmentMomentumFromField::fieldIntegralEstimate_old( const Muon::Muon Amg::Vector3D field1,field2,field3; MagField::AtlasFieldCache fieldCache; - SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCondObjInputKey, Gaudi::Hive::currentContext()}; + SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCondObjInputKey, ctx}; const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; if (!fieldCondObj) { throw std::runtime_error(Form("File: %s, Line: %d\nMuonSegmentMomentumFromField::fieldIntegralEstimate_old() - Failed to retrieve AtlasFieldCacheCondObj with key %s", __FILE__, __LINE__, (m_fieldCondObjInputKey.key()).c_str())); @@ -276,7 +275,7 @@ double MuonSegmentMomentumFromField::fieldIntegralEstimate_old( const Muon::Muon return averageBcrossl*posdiff.mag(); } -void MuonSegmentMomentumFromField::fitMomentum2Segments_old( const Muon::MuonSegment* segment1, const Muon::MuonSegment* segment2, double & signedMomentum ) const +void MuonSegmentMomentumFromField::fitMomentum2Segments_old( const EventContext& ctx, const Muon::MuonSegment* segment1, const Muon::MuonSegment* segment2, double & signedMomentum ) const { /** Estimate signed momentum for two segments @@ -289,7 +288,7 @@ void MuonSegmentMomentumFromField::fitMomentum2Segments_old( const Muon::MuonSeg myseg1=segment2; myseg2=segment1; } - double fieldintegral=fieldIntegralEstimate(myseg1,myseg2); + double fieldintegral=fieldIntegralEstimate(ctx, myseg1,myseg2); double theta1=myseg1->globalDirection().theta(); double theta2=myseg2->globalDirection().theta(); double phi1=myseg1->globalDirection().phi(); @@ -349,8 +348,7 @@ void MuonSegmentMomentumFromField::fitMomentum2Segments_old( const Muon::MuonSeg 1/signedMomentum,bestseg->associatedSurface()); Trk::TransportJacobian *jac=nullptr; auto par=m_propagator->propagateParameters( - Gaudi::Hive::currentContext(), - startpar,worstseg->associatedSurface(), + ctx,startpar,worstseg->associatedSurface(), (bestseg==myseg1) ? Trk::alongMomentum : Trk::oppositeMomentum,false, Trk::MagneticFieldProperties(Trk::FullField),jac,Trk::nonInteracting); if (par && jac && (*jac)(1,4)!=0){ diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMomentum/src/MuonSegmentMomentumFromField.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMomentum/src/MuonSegmentMomentumFromField.h index 84fe76202c3ec12890bf8a8ebb6e82923aca16ab..43501187ec5e5ec38f4b4ab7004737b501d4b49a 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMomentum/src/MuonSegmentMomentumFromField.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMomentum/src/MuonSegmentMomentumFromField.h @@ -31,14 +31,14 @@ class MuonSegmentMomentumFromField : public AthAlgTool, virtual public Muon::IMu virtual StatusCode initialize(); /** fits a momentum to 2 segments */ - virtual void fitMomentum2Segments( const Muon::MuonSegment* segment1, const Muon::MuonSegment* segment2, double & signedMomentum ) const; - virtual void fitMomentum2Segments_old( const Muon::MuonSegment* segment1, const Muon::MuonSegment* segment2, double & signedMomentum ) const; + virtual void fitMomentum2Segments( const EventContext& ctx, const Muon::MuonSegment* segment1, const Muon::MuonSegment* segment2, double & signedMomentum ) const; + virtual void fitMomentum2Segments_old( const EventContext& ctx, const Muon::MuonSegment* segment1, const Muon::MuonSegment* segment2, double & signedMomentum ) const; /** fits a momentum to a vector of segments */ - virtual void fitMomentumVectorSegments( const std::vector <const Muon::MuonSegment*>, double & signedMomentum ) const; + virtual void fitMomentumVectorSegments( const EventContext&, const std::vector <const Muon::MuonSegment*>, double & signedMomentum ) const; private: - double fieldIntegralEstimate(const Muon::MuonSegment* segment1, const Muon::MuonSegment* segment2) const; - double fieldIntegralEstimate_old(const Muon::MuonSegment* segment1, const Muon::MuonSegment* segment2) const; + double fieldIntegralEstimate(const EventContext& ctx, const Muon::MuonSegment* segment1, const Muon::MuonSegment* segment2) const; + double fieldIntegralEstimate_old(const EventContext& ctx, const Muon::MuonSegment* segment1, const Muon::MuonSegment* segment2) const; ToolHandle<Trk::IPropagator> m_propagator{this, "PropagatorTool", "Trk::STEP_Propagator/MuonPropagator"}; diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSeededSegmentFinder.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSeededSegmentFinder.cxx index a523944f4149a21b56fcd39fed8ea200f2f8e779..72eb619dc1ded2a013c8fcc9c27a6b10493e357a 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSeededSegmentFinder.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSeededSegmentFinder.cxx @@ -54,7 +54,7 @@ namespace Muon { } // find segments - return find(pars, mdtPrds); + return find(ctx, pars, mdtPrds); } std::unique_ptr<Trk::SegmentCollection> MuonSeededSegmentFinder::find(const EventContext& ctx, const Trk::TrackParameters& pars, @@ -68,10 +68,10 @@ namespace Muon { } // find segments - return find(pars, mdtPrds); + return find(ctx, pars, mdtPrds); } - std::unique_ptr<Trk::SegmentCollection> MuonSeededSegmentFinder::find(const Trk::TrackParameters& pars, + std::unique_ptr<Trk::SegmentCollection> MuonSeededSegmentFinder::find(const EventContext& ctx, const Trk::TrackParameters& pars, const std::vector<const MdtPrepData*>& mdtPrds) const { // are we close to the chamber edge? bool doHoleSearch = true; @@ -79,7 +79,7 @@ namespace Muon { // select and calibrate the MdtPrepData std::vector<const MdtDriftCircleOnTrack*> mdtROTs; mdtROTs.reserve(mdtPrds.size()); - selectAndCalibrate(pars, mdtPrds, mdtROTs, doHoleSearch); + selectAndCalibrate(ctx, pars, mdtPrds, mdtROTs, doHoleSearch); if (mdtROTs.empty()) { ATH_MSG_DEBUG(" no MdtDriftCircles selected "); @@ -355,7 +355,7 @@ namespace Muon { } } - void MuonSeededSegmentFinder::selectAndCalibrate(const Trk::TrackParameters& pars, const std::vector<const MdtPrepData*>& mdtPrdCols, + void MuonSeededSegmentFinder::selectAndCalibrate(const EventContext& ctx, const Trk::TrackParameters& pars, const std::vector<const MdtPrepData*>& mdtPrdCols, std::vector<const MdtDriftCircleOnTrack*>& mdtROTs, bool& doHoleSearch) const { ATH_MSG_VERBOSE(" in selectAndCalibrate, get PRDs " << mdtPrdCols.size()); @@ -365,7 +365,7 @@ namespace Muon { for (; mit != mit_end; ++mit) { if ((*mit)->status() != 1) continue; // calibrate MDT - const MdtDriftCircleOnTrack* mdt = handleMdtPrd(pars, **mit, doHoleSearch); + const MdtDriftCircleOnTrack* mdt = handleMdtPrd(ctx, pars, **mit, doHoleSearch); // not selected if (!mdt) continue; @@ -375,7 +375,7 @@ namespace Muon { ATH_MSG_VERBOSE(" calibrated " << mdtROTs.size() << " prds out of " << mdtPrdCols.size()); } - const MdtDriftCircleOnTrack* MuonSeededSegmentFinder::handleMdtPrd(const Trk::TrackParameters& pars, const MdtPrepData& mdtPrd, + const MdtDriftCircleOnTrack* MuonSeededSegmentFinder::handleMdtPrd(const EventContext& ctx, const Trk::TrackParameters& pars, const MdtPrepData& mdtPrd, bool& doHoleSearch) const { // skip noise hits if (mdtPrd.adc() < m_adcCut) return nullptr; @@ -387,8 +387,7 @@ namespace Muon { // propagate segment parameters to first measurement // retain ownership; this code deleted the exPars before - auto exPars = m_propagator->propagate(Gaudi::Hive::currentContext(), - pars, surf, Trk::anyDirection, false, m_magFieldProperties); + auto exPars = m_propagator->propagate(ctx, pars, surf, Trk::anyDirection, false, m_magFieldProperties); if (!exPars) { ATH_MSG_DEBUG(" Propagation failed!! "); return nullptr; diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSeededSegmentFinder.h b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSeededSegmentFinder.h index 63661e6e51d6efc420b22ffb4f3b4aeb1187856b..509b33bdf9e277a0101b9e1ccad7638afa21c61d 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSeededSegmentFinder.h +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSeededSegmentFinder.h @@ -49,7 +49,7 @@ namespace Muon { std::unique_ptr<Trk::SegmentCollection> find(const EventContext& ctx, const Trk::TrackParameters& pars, const std::set<IdentifierHash>& chIdHs) const; /** @brief find segments in a set of MdtPrepData starting from seeding TrackParameters */ - std::unique_ptr<Trk::SegmentCollection> find(const Trk::TrackParameters& pars, + std::unique_ptr<Trk::SegmentCollection> find(const EventContext& ctx, const Trk::TrackParameters& pars, const std::vector<const MdtPrepData*>& mdtPrds) const; /** @brief retrieve MDT PRD collections for the given hashes */ @@ -80,11 +80,11 @@ namespace Muon { std::vector<const MdtPrepData*> extractPrds(const EventContext& ctx, const std::set<IdentifierHash>& chIdHs) const; /** @brief select a set of Mdt hits and calibrate them */ - void selectAndCalibrate(const Trk::TrackParameters& pars, const std::vector<const MdtPrepData*>& mdtPrdCols, + void selectAndCalibrate(const EventContext& ctx, const Trk::TrackParameters& pars, const std::vector<const MdtPrepData*>& mdtPrdCols, std::vector<const MdtDriftCircleOnTrack*>& mdtROTs, bool& doHoleSearch) const; /** @brief select and calibrate a single MdtPrepData */ - const MdtDriftCircleOnTrack* handleMdtPrd(const Trk::TrackParameters& pars, const MdtPrepData& mdtPrd, bool& doHoleSearch) const; + const MdtDriftCircleOnTrack* handleMdtPrd(const EventContext& ctx, const Trk::TrackParameters& pars, const MdtPrepData& mdtPrd, bool& doHoleSearch) const; SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey{this, "DetectorManagerKey", "MuonDetectorManager", "Key of input MuonDetectorManager condition data"}; diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSegmentRegionRecoveryTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSegmentRegionRecoveryTool.cxx index f5864e21655129d51003ea3c89ad8b6018231196..c3b2fd5e5afa2c2a5a0501d1d131a9337b746e0c 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSegmentRegionRecoveryTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSegmentRegionRecoveryTool.cxx @@ -774,7 +774,7 @@ namespace Muon { } } if (prds && exParsFirst) { - std::unique_ptr<Trk::SegmentCollection> segments = m_seededSegmentFinder->find(*exParsFirst, *prds); + std::unique_ptr<Trk::SegmentCollection> segments = m_seededSegmentFinder->find(ctx, *exParsFirst, *prds); if (segments) { if (!segments->empty()) ATH_MSG_DEBUG("found segments " << segments->size()); diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackExtrapolationTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackExtrapolationTool.cxx index 347eafdb55956efa59a266121c0ed89bddd354db..056a993621931907c029f4a49f19bb2a65715670 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackExtrapolationTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackExtrapolationTool.cxx @@ -46,7 +46,7 @@ namespace Muon { return StatusCode::SUCCESS; } - const Trk::TrackParameters *MuonTrackExtrapolationTool::extrapolateToMuonEntryRecord(const EventContext& ctx ,const Trk::TrackParameters &pars, + const Trk::TrackParameters *MuonTrackExtrapolationTool::extrapolateToMuonEntryRecord(const EventContext& ctx, const Trk::TrackParameters &pars, Trk::ParticleHypothesis particleHypo) const { if (m_muonExtrapolator.empty()) return nullptr; const Trk::TrackingVolume *msEntrance = getVolume(m_msEntranceName, ctx); diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.cxx index c948f0028b46d341d381ced8f9a7528574df42e7..97d5b85d64ac7127b6f10b598d367374d7adb823 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.cxx @@ -168,7 +168,7 @@ namespace Muon { return StatusCode::SUCCESS; } - bool MooCandidateMatchingTool::match(const EventContext& , const MuPatSegment& entry1, const MuPatSegment& entry2, bool useTightCuts) const { + bool MooCandidateMatchingTool::match(const EventContext& ctx, const MuPatSegment& entry1, const MuPatSegment& entry2, bool useTightCuts) const { ++m_segmentMatches; // same segments should never be matched! @@ -226,9 +226,9 @@ namespace Muon { // call segment matching tool bool match = true; if (useTightCuts) { - match = m_segmentMatchingToolTight->match(*entry1.segment, *entry2.segment); + match = m_segmentMatchingToolTight->match(ctx, *entry1.segment, *entry2.segment); } else { - match = m_segmentMatchingTool->match(*entry1.segment, *entry2.segment); + match = m_segmentMatchingTool->match(ctx, *entry1.segment, *entry2.segment); } if (match) { ++m_goodSegmentMatches; @@ -249,7 +249,7 @@ namespace Muon { ATH_MSG_VERBOSE("Failed to create track candidate"); return false; } - std::unique_ptr<MuPatSegment> segInfo(m_candidateTool->createSegInfo(segment, trash_bin)); + std::unique_ptr<MuPatSegment> segInfo(m_candidateTool->createSegInfo(ctx, segment, trash_bin)); if (!segInfo) { ATH_MSG_VERBOSE("Failed to create segment candidate"); return false; @@ -309,7 +309,7 @@ namespace Muon { MooTrackSegmentMatchResult info; calculateTrackSegmentMatchResult(ctx, entry1, entry2, info); TrackSegmentMatchCuts cuts = getMatchingCuts(entry1, entry2, useTightCuts); - haveMatch = applyTrackSegmentCuts(info, cuts); + haveMatch = applyTrackSegmentCuts(ctx, info, cuts); // update counters if (haveMatch) { ++m_reasonsForMatchOk[info.reason]; @@ -380,7 +380,7 @@ namespace Muon { return cuts; } - bool MooCandidateMatchingTool::applyTrackSegmentCuts(MooTrackSegmentMatchResult& info, const TrackSegmentMatchCuts& cuts) const { + bool MooCandidateMatchingTool::applyTrackSegmentCuts(const EventContext& ctx, MooTrackSegmentMatchResult& info, const TrackSegmentMatchCuts& cuts) const { if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << MSG::DEBUG << "track segment match:"; if (info.reason == TrackSegmentMatchResult::NoMomentumWithMagField) { @@ -406,9 +406,9 @@ namespace Muon { } else { // closestSegment // call segment matching tool if (cuts.useTightCuts) { - info.matchOK = m_segmentMatchingToolTight->match(*(closestSegment->segment), *(info.segment)); + info.matchOK = m_segmentMatchingToolTight->match(ctx, *(closestSegment->segment), *(info.segment)); } else { - info.matchOK = m_segmentMatchingTool->match(*(closestSegment->segment), *(info.segment)); + info.matchOK = m_segmentMatchingTool->match(ctx, *(closestSegment->segment), *(info.segment)); } if (msgLvl(MSG::DEBUG)) { if (info.matchOK) { diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.h b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.h index 39c96840102d126ae9cf21ee2fb1193ddc3729ee..911911b0be059879852c21f523a223d676c4a49e 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.h @@ -93,7 +93,7 @@ namespace Muon { TrackSegmentMatchCuts getMatchingCuts(const MuPatTrack& entry1, const MuPatSegment& entry2, bool useTightCuts) const; - bool applyTrackSegmentCuts(MooTrackSegmentMatchResult& info, const TrackSegmentMatchCuts& cuts) const; + bool applyTrackSegmentCuts(const EventContext& ctx, MooTrackSegmentMatchResult& info, const TrackSegmentMatchCuts& cuts) const; /** @brief check whether two segments are on the same side of the point of closest approach to the perigee of the connecting track, or on the same diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackBuilder.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackBuilder.cxx index 171a364bb48839324229ebb92581800bd5e2ff89..47637ed7bb5d2d92e6b0ee4a86b1607eb7b602d9 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackBuilder.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackBuilder.cxx @@ -149,9 +149,9 @@ namespace Muon { GarbageContainer trash_bin; // convert segments - std::unique_ptr<MuPatSegment> segInfo1{m_candidateHandler->createSegInfo(seg1, trash_bin)}; + std::unique_ptr<MuPatSegment> segInfo1{m_candidateHandler->createSegInfo(ctx, seg1, trash_bin)}; if (!segInfo1) return nullptr; - std::unique_ptr<MuPatSegment> segInfo2{m_candidateHandler->createSegInfo(seg2, trash_bin)}; + std::unique_ptr<MuPatSegment> segInfo2{m_candidateHandler->createSegInfo(ctx, seg2, trash_bin)}; if (!segInfo2) { return nullptr; } // call fit() @@ -334,7 +334,7 @@ namespace Muon { std::unique_ptr<Trk::Track> inTrack = std::make_unique<Trk::Track>(track); std::unique_ptr<MuPatTrack> candidate(m_candidateHandler->createCandidate(inTrack, trash_bin)); if (!candidate) return nullptr; - std::unique_ptr<MuPatSegment> segInfo(m_candidateHandler->createSegInfo(seg, trash_bin)); + std::unique_ptr<MuPatSegment> segInfo(m_candidateHandler->createSegInfo(ctx, seg, trash_bin)); if (!segInfo) { return nullptr; } // call fit() @@ -353,7 +353,7 @@ namespace Muon { std::unique_ptr<MuPatTrack> candidate = m_candidateHandler->createCandidate(inTrack, trash_bin); if (!candidate) return emptyVec; - std::unique_ptr<MuPatSegment> segInfo(m_candidateHandler->createSegInfo(seg, trash_bin)); + std::unique_ptr<MuPatSegment> segInfo(m_candidateHandler->createSegInfo(ctx, seg, trash_bin)); if (!segInfo) return emptyVec; // call fit() return combineWithSegmentFinding(ctx, *candidate, *segInfo, trash_bin, externalPhiHits); @@ -615,7 +615,7 @@ namespace Muon { msg(MSG::DEBUG) << endmsg; } } - std::unique_ptr<MuPatSegment> segInfo{m_candidateHandler->createSegInfo(*mseg, trash_bin)}; + std::unique_ptr<MuPatSegment> segInfo{m_candidateHandler->createSegInfo(ctx, *mseg, trash_bin)}; if (!m_candidateMatchingTool->match(ctx, candidate, *segInfo, true)) { continue; } @@ -1116,7 +1116,7 @@ namespace Muon { return candidates; } - bool MooTrackBuilder::isSplitTrack(const Trk::Track& track1, const Trk::Track& track2) const { + bool MooTrackBuilder::isSplitTrack(const EventContext& ctx, const Trk::Track& track1, const Trk::Track& track2) const { // some loose association cuts const DataVector<const Trk::TrackParameters>* parsVec1 = track1.trackParameters(); if (!parsVec1 || parsVec1->empty()) { @@ -1257,8 +1257,8 @@ namespace Muon { if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << m_idHelperSvc->toString(id); // unique ptr ownership retained. Original code deleted impactPars auto impactPars = - m_propagator->propagate(Gaudi::Hive::currentContext(), - *closestPars, meas->associatedSurface(), Trk::anyDirection, false, m_magFieldProperties); + m_propagator->propagate(ctx, *closestPars, meas->associatedSurface(), + Trk::anyDirection, false, m_magFieldProperties); if (impactPars) { double residual = 1e10; double pull = 1e10; @@ -1354,7 +1354,7 @@ namespace Muon { // compare them to all good tracks and look for split tracks for (std::pair<bool, std::unique_ptr<Trk::Track>>& good_trk : goodTracks) { // check whether track is split - bool isSplit = isSplitTrack(*good_trk.second, *in_track); + bool isSplit = isSplitTrack(ctx, *good_trk.second, *in_track); if (isSplit) { // if we found a potential split track, try to combine them std::unique_ptr<Trk::Track> track1 = std::make_unique<Trk::Track>(*good_trk.second); diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackBuilder.h b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackBuilder.h index 87350a8a10e9a31ea62ccb0b42e7d90469343edd..666a898ece8753184ea5933e07b648cffd25a386 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackBuilder.h +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackBuilder.h @@ -227,7 +227,7 @@ namespace Muon { std::pair<std::unique_ptr<Trk::Track>, std::unique_ptr<Trk::Track> > splitTrack(const EventContext& ctx, const Trk::Track& track) const; /** @brief identify whether two track are split */ - bool isSplitTrack(const Trk::Track& track1, const Trk::Track& track2) const; + bool isSplitTrack(const EventContext& ctx, const Trk::Track& track1, const Trk::Track& track2) const; /** @brief look for split tracks in collection and merge them */ TrackCollection* mergeSplitTracks(const EventContext& ctx, const TrackCollection& tracks, GarbageContainer& trash_bin) const; diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackFitter.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackFitter.cxx index 36c3002d6c3147eb89b8282c4258b593c4e68a82..ed043c53f318a157517ce95c18e52011a00e071d 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackFitter.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackFitter.cxx @@ -182,7 +182,7 @@ namespace Muon { FitterData fitterData; // extract hits and geometrical information - if (!extractData(entry1, entry2, fitterData, localGarbage)) { + if (!extractData(ctx, entry1, entry2, fitterData, localGarbage)) { ATH_MSG_DEBUG(" Failed to extract data for initial fit"); return nullptr; } @@ -205,7 +205,7 @@ namespace Muon { ++m_nfailedParsInital; // clean phi hits and reevaluate hits. Do not run for cosmics - bool hasCleaned = m_cleanPhiHits ? cleanPhiHits(startPars->momentum().mag(), fitterData, externalPhiHits, localGarbage) : true; + bool hasCleaned = m_cleanPhiHits ? cleanPhiHits(ctx, startPars->momentum().mag(), fitterData, externalPhiHits, localGarbage) : true; if (hasCleaned) { ATH_MSG_DEBUG(" Cleaned phi hits, re-extracting hits"); bool usePrecise = m_usePreciseHits ? true : (fitterData.firstHasMomentum || fitterData.secondHasMomentum); @@ -217,7 +217,7 @@ namespace Muon { ++m_nfailedExtractCleaning; // check whether there are enough phi constraints, if not add fake phi hits - if (!addFakePhiHits(fitterData, startPars, localGarbage)) { + if (!addFakePhiHits(ctx, fitterData, startPars, localGarbage)) { ATH_MSG_DEBUG(" Failed to add fake phi hits for precise fit"); return nullptr; } @@ -278,7 +278,7 @@ namespace Muon { ++m_nfailedExtractPrecise; // check whether there are enough phi constraints, if not add fake phi hits - if (!addFakePhiHits(fitterDataRefit, startPars, localGarbage)) { + if (!addFakePhiHits(ctx, fitterDataRefit, startPars, localGarbage)) { ATH_MSG_DEBUG(" Failed to add fake phi hits for precise fit"); return nullptr; } @@ -321,7 +321,7 @@ namespace Muon { return track; } - bool MooTrackFitter::extractData(const MuPatCandidateBase& entry1, const MuPatCandidateBase& entry2, + bool MooTrackFitter::extractData(const EventContext& ctx, const MuPatCandidateBase& entry1, const MuPatCandidateBase& entry2, MooTrackFitter::FitterData& fitterData, GarbageContainer& garbage) const { // sanity checks on the entries if (corruptEntry(entry1)) { @@ -366,7 +366,7 @@ namespace Muon { copyHitList(entry1.hitList(), fitterData.copyHitList1, garbage); copyHitList(entry2.hitList(), fitterData.copyHitList2, garbage); - if (!m_hitHandler->merge(fitterData.copyHitList1, fitterData.copyHitList2, hitList)) return false; + if (!m_hitHandler->merge(ctx, fitterData.copyHitList1, fitterData.copyHitList2, hitList)) return false; bool usePrecise = m_usePreciseHits ? true : (fitterData.firstHasMomentum || fitterData.secondHasMomentum); if (msgLvl(MSG::DEBUG)) { @@ -536,10 +536,9 @@ namespace Muon { return true; } - bool MooTrackFitter::addFakePhiHits(MooTrackFitter::FitterData& fitterData, const Trk::TrackParameters* startpar, + bool MooTrackFitter::addFakePhiHits(const EventContext& ctx, MooTrackFitter::FitterData& fitterData, const Trk::TrackParameters* startpar, GarbageContainer& garbage) const { - const EventContext& ctx = Gaudi::Hive::currentContext(); // check whether we have enough phi constraints unsigned nphiConstraints = hasPhiConstrain(fitterData); @@ -614,7 +613,7 @@ namespace Muon { ATH_MSG_VERBOSE(" Special treatment for tracks with one station, a SL overlap and no phi hits "); IMuonSegmentInOverlapResolvingTool::SegmentMatchResult result = - m_overlapResolver->matchResult(*segInfo1->segment, *segInfo2->segment); + m_overlapResolver->matchResult(ctx, *segInfo1->segment, *segInfo2->segment); if (!result.goodMatch()) { ATH_MSG_VERBOSE(" Match failed "); @@ -1412,7 +1411,7 @@ namespace Muon { segments.push_back(segSecond); double momentum = 1.; - m_momentumEstimator->fitMomentumVectorSegments(segments, momentum); + m_momentumEstimator->fitMomentumVectorSegments(ctx, segments, momentum); // momentum = restrictedMomentum(momentum); if (momentum == 0.) return 0.; @@ -1421,7 +1420,7 @@ namespace Muon { return qOverP; } - double MooTrackFitter::phiSeeding(MooTrackFitter::FitterData& fitterData) const { + double MooTrackFitter::phiSeeding(const EventContext& ctx, MooTrackFitter::FitterData& fitterData) const { if (m_cosmics) { // check whether the first entry is a track, if not consider the second entry for phi seeding if (!dynamic_cast<const MuPatTrack*>(fitterData.firstEntry)) { @@ -1440,7 +1439,7 @@ namespace Muon { Identifier chId = m_edmHelperSvc->chamberId(*segInfo1->segment); if (m_idHelperSvc->isMdt(chId)) { IMuonSegmentInOverlapResolvingTool::SegmentMatchResult result = - m_overlapResolver->matchResult(*segInfo1->segment, *segInfo2->segment); + m_overlapResolver->matchResult(ctx, *segInfo1->segment, *segInfo2->segment); if (!result.goodMatch()) { ATH_MSG_VERBOSE(" Match failed "); @@ -1679,7 +1678,7 @@ namespace Muon { return perigee; } - Trk::Perigee* MooTrackFitter::createPerigee(const Trk::TrackParameters& firstPars, const Trk::MeasurementBase& firstMeas) const { + Trk::Perigee* MooTrackFitter::createPerigee(const EventContext& ctx, const Trk::TrackParameters& firstPars, const Trk::MeasurementBase& firstMeas) const { // const Amg::Vector3D& firstPos = firstMeas.globalPosition(); Amg::Vector3D perpos(0., 0., 0.); @@ -1690,8 +1689,7 @@ namespace Muon { if (m_seedAtStartOfTrack) { // not sure whats going on with ownership here, so let this code take care of it exPars = - m_propagator->propagate(Gaudi::Hive::currentContext(), - firstPars, firstMeas.associatedSurface(), Trk::anyDirection, false, m_magFieldProperties).release(); + m_propagator->propagate(ctx, firstPars, firstMeas.associatedSurface(), Trk::anyDirection, false, m_magFieldProperties).release(); if (!exPars) { ATH_MSG_DEBUG(" Propagation failed in createPerigee!! "); return nullptr; @@ -1765,7 +1763,7 @@ namespace Muon { if (dist < 0.) { ATH_MSG_DEBUG(" start parameters after first hit, shifting them.... "); - Trk::Perigee* perigee = createPerigee(startPars, *hits.front()); + Trk::Perigee* perigee = createPerigee(ctx, startPars, *hits.front()); if (perigee) { garbage.push_back(perigee); pars = perigee; @@ -1823,7 +1821,7 @@ namespace Muon { return track; } - bool MooTrackFitter::cleanPhiHits(double momentum, MooTrackFitter::FitterData& fitterData, + bool MooTrackFitter::cleanPhiHits(const EventContext& ctx, double momentum, MooTrackFitter::FitterData& fitterData, const std::vector<const Trk::PrepRawData*>* patternPhiHits, GarbageContainer& garbage) const { ATH_MSG_VERBOSE(" cleaning phi hits "); @@ -1984,8 +1982,8 @@ namespace Muon { if (!measurementsToBeAdded.empty()) { ATH_MSG_VERBOSE(" adding measurements "); MuPatHitList newHitList; - m_hitHandler->create(fitterData.firstEntry->entryPars(), measurementsToBeAdded, newHitList, garbage); - m_hitHandler->merge(newHitList, fitterData.hitList); + m_hitHandler->create(ctx, fitterData.firstEntry->entryPars(), measurementsToBeAdded, newHitList, garbage); + m_hitHandler->merge(ctx, newHitList, fitterData.hitList); } ATH_MSG_VERBOSE(" done cleaning "); diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackFitter.h b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackFitter.h index ffb169ae441c45793c319f1a6da926445f4679e3..39f9f24d0309ce94227e26f5bffe31981e65c9cc 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackFitter.h +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackFitter.h @@ -177,7 +177,7 @@ namespace Muon { double restrictedMomentum(double momentum) const; /** create perigee parameter to initialize fit */ - Trk::Perigee* createPerigee(const Trk::TrackParameters& firstPars, const Trk::MeasurementBase& firstMeas) const; + Trk::Perigee* createPerigee(const EventContext& ctx, const Trk::TrackParameters& firstPars, const Trk::MeasurementBase& firstMeas) const; /** fit track */ std::unique_ptr<Trk::Track> fit(const EventContext& ctx, const Trk::Perigee& startPars, MeasVec& hits, GarbageContainer& garbage, @@ -203,14 +203,14 @@ namespace Muon { std::unique_ptr<Trk::Track> cleanAndEvaluateTrack(const EventContext& ctx, Trk::Track& track, const std::set<Identifier>& excludedChambers) const; /** extract all information needed for the fit from the track */ - bool extractData(const MuPatCandidateBase& entry1, const MuPatCandidateBase& entry2, FitterData& fitterData, + bool extractData(const EventContext& ctx, const MuPatCandidateBase& entry1, const MuPatCandidateBase& entry2, FitterData& fitterData, GarbageContainer& garbage) const; /** extract all information from the HitList of a FitterData object */ bool extractData(FitterData& fitterData, bool usePreciseHits) const; /** check fitterData, add fake phi hits if needed. If provided the reference parameter will be used to calcualte the fake hits */ - bool addFakePhiHits(FitterData& fitterData, const Trk::TrackParameters* referenceParameter, GarbageContainer& garbage) const; + bool addFakePhiHits(const EventContext& ctx, FitterData& fitterData, const Trk::TrackParameters* referenceParameter, GarbageContainer& garbage) const; /** sanity check for entries */ bool corruptEntry(const MuPatCandidateBase& entry) const; @@ -242,13 +242,13 @@ namespace Muon { GarbageContainer& garbage) const; /** calculate phi used to for seeding the fit */ - double phiSeeding(FitterData& fitterData) const; + double phiSeeding(const EventContext& ctx, FitterData& fitterData) const; /** calculate theta used for seeding the fit */ double thetaSeeding(const MuPatCandidateBase& entry, MeasVec& etaHits) const; /** clean phi hits, returns true if anything happened during the cleaning */ - bool cleanPhiHits(double momentum, FitterData& phiHits, const PrepVec* patternPhiHits, GarbageContainer& garbage) const; + bool cleanPhiHits(const EventContext& ctx, double momentum, FitterData& phiHits, const PrepVec* patternPhiHits, GarbageContainer& garbage) const; /** check whether mometum of start parameter is ok */ bool validMomentum(const Trk::TrackParameters& pars) const; diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatCandidateTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatCandidateTool.cxx index cdf7a2d9922397f6e184b3ca7ddc2ced4411c2c4..416da9bc855465fd6dbbbc5d90f13378b73d33cd 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatCandidateTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatCandidateTool.cxx @@ -56,7 +56,7 @@ namespace Muon { return StatusCode::SUCCESS; } - std::unique_ptr<MuPatSegment> MuPatCandidateTool::createSegInfo(const MuonSegment& segment, GarbageContainer& trash_bin) const { + std::unique_ptr<MuPatSegment> MuPatCandidateTool::createSegInfo(const EventContext& ctx, const MuonSegment& segment, GarbageContainer& trash_bin) const { Identifier chid = m_edmHelperSvc->chamberId(segment); if (m_idHelperSvc->isTrigger(chid)) { ATH_MSG_WARNING("Trigger hit only segments not supported " << m_idHelperSvc->toStringChamber(chid)); @@ -88,7 +88,7 @@ namespace Muon { if (!info->segPars) { ATH_MSG_WARNING(" failed to create track parameter for segment "); } updateHits(*info, info->segment->containedMeasurements(), trash_bin, m_doMdtRecreation, m_doCscRecreation, true); - m_hitHandler->create(segment, info->hitList(), trash_bin); + m_hitHandler->create(ctx, segment, info->hitList(), trash_bin); return info; } diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatCandidateTool.h b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatCandidateTool.h index 866c9bbb6a29fd8205f9f6359bf16c74114363a7..d22e3dc9cd3d7855846fd67dacd8220b7ccb3e0d 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatCandidateTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatCandidateTool.h @@ -118,7 +118,7 @@ namespace Muon { @param[in] segment input segment @param[out] the MuPatSegment object, ownership is passed to caller */ - std::unique_ptr<MuPatSegment> createSegInfo(const MuonSegment& segment, GarbageContainer& trash_bin) const; + std::unique_ptr<MuPatSegment> createSegInfo(const EventContext& ctx, const MuonSegment& segment, GarbageContainer& trash_bin) const; /** @brief get list of the readout elements of the hits on the entry */ std::set<const MuonGM::MuonReadoutElement*> readoutElements(const MuPatCandidateBase& entry) const; diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatHitTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatHitTool.cxx index 38a5a09db68b4dc582d14da5dfb72dc1915f9027..9fcf56fdf8af480c4927f77928c9e9e0be6d66be 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatHitTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatHitTool.cxx @@ -55,7 +55,7 @@ namespace Muon { } bool MuPatHitTool::insert(MuPatHit* /*hit*/, MuPatHitList& /*hitList*/) const { return true; } - bool MuPatHitTool::create(const MuonSegment& seg, MuPatHitList& hitList, GarbageContainer& hitsToBeDeleted) const { + bool MuPatHitTool::create(const EventContext& ctx, const MuonSegment& seg, MuPatHitList& hitList, GarbageContainer& hitsToBeDeleted) const { ATH_MSG_DEBUG(" creating hit list from segment " << std::endl << m_printer->print(seg)); // create parameters with very large momentum and no charge @@ -67,12 +67,12 @@ namespace Muon { return false; } - bool result = create(*pars, seg.containedMeasurements(), hitList, hitsToBeDeleted); + bool result = create(ctx, *pars, seg.containedMeasurements(), hitList, hitsToBeDeleted); return result; } - bool MuPatHitTool::create(const Trk::TrackParameters& pars, const std::vector<const Trk::MeasurementBase*>& measVec, + bool MuPatHitTool::create(const EventContext& ctx, const Trk::TrackParameters& pars, const std::vector<const Trk::MeasurementBase*>& measVec, MuPatHitList& hitList, GarbageContainer& hitsToBeDeleted) const { // store position of the current hit to speed up insertion MuPatHitIt currentHitIt = hitList.begin(); @@ -110,8 +110,8 @@ namespace Muon { ATH_MSG_VERBOSE(" start parameters and measurement expressed at same surface, cloning parameters "); } else { // this code does its own manual garbage collection which can probably be omitted now - exPars = m_propagator->propagate(Gaudi::Hive::currentContext(), - pars, meas.associatedSurface(), Trk::anyDirection, false, m_magFieldProperties); + exPars = m_propagator->propagate(ctx, pars, meas.associatedSurface(), + Trk::anyDirection, false, m_magFieldProperties); if (!exPars) { if (!wasPrinted) { @@ -188,14 +188,14 @@ namespace Muon { return true; } - bool MuPatHitTool::merge(const MuPatHitList& hitList1, const MuPatHitList& hitList2, MuPatHitList& outList) const { + bool MuPatHitTool::merge(const EventContext& ctx, const MuPatHitList& hitList1, const MuPatHitList& hitList2, MuPatHitList& outList) const { // copy first list into outList outList = hitList1; - return merge(hitList2, outList); + return merge(ctx, hitList2, outList); } - bool MuPatHitTool::merge(const MuPatHitList& hitList1, MuPatHitList& hitList2) const { + bool MuPatHitTool::merge(const EventContext& ctx, const MuPatHitList& hitList1, MuPatHitList& hitList2) const { // The hits in the first list are most likely expressed with respect to a different set of track parameters // as the ones in the second list. They cannot be merged. To allow merging a new set of track parameters is // calculated for the hits in the first list by extrapolation of parameters of hits in the second list. This is only @@ -260,8 +260,7 @@ namespace Muon { // this code does its own garbage collection, but this can prob. be simplified now exPars = - m_propagator->propagate(Gaudi::Hive::currentContext(), - stPars, meas.associatedSurface(), + m_propagator->propagate(ctx, stPars, meas.associatedSurface(), Trk::anyDirection, false, m_magFieldProperties); // if failed keep old parameters diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatHitTool.h b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatHitTool.h index 13e1ad8f8e45b2d2542f6b59f9a91bd0ed404ec6..d867c46ab0119574a47e66660db4fd40ad9c5252 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatHitTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatHitTool.h @@ -61,7 +61,7 @@ namespace Muon { @param hitList the list to be filled @return true if creation succeded */ - bool create(const MuonSegment& seg, MuPatHitList& hitList, GarbageContainer& hitsToBeDeleted) const; + bool create(const EventContext& ctx, const MuonSegment& seg, MuPatHitList& hitList, GarbageContainer& hitsToBeDeleted) const; /** @brief create a MuPatHitList from a Track @param track the input track @@ -76,7 +76,7 @@ namespace Muon { @param hitList the list to be filled @return true if creation succeded */ - bool create(const Trk::TrackParameters& pars, const std::vector<const Trk::MeasurementBase*>& measVec, MuPatHitList& hitList, + bool create(const EventContext& ctx, const Trk::TrackParameters& pars, const std::vector<const Trk::MeasurementBase*>& measVec, MuPatHitList& hitList, GarbageContainer& hitsToBeDeleted) const; /** @brief merge two MuPatHitLists into a new one @@ -85,14 +85,14 @@ namespace Muon { @param outList the resulting list @return true if merge succeded */ - bool merge(const MuPatHitList& hitList1, const MuPatHitList& hitList2, MuPatHitList& outList) const; + bool merge(const EventContext& ctx, const MuPatHitList& hitList1, const MuPatHitList& hitList2, MuPatHitList& outList) const; /** @brief merge two MuPatHitLists into a new one. The first list will be added to the second @param hitList1 the first list @param hitList2 the second list @return true if merge succeded */ - bool merge(const MuPatHitList& hitList1, MuPatHitList& hitList2) const; + bool merge(const EventContext& ctx, const MuPatHitList& hitList1, MuPatHitList& hitList2) const; /** @brief extract a sorted vector of MeasurementBase objects @param hitList the input list diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuonTrackSteering.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuonTrackSteering.cxx index df0e34735311922dd8a2d02d9072745b0d718d10..0db33fafe5e6373a5cf4d1aa0a15cbc4166a82b3 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuonTrackSteering.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuonTrackSteering.cxx @@ -122,7 +122,7 @@ namespace Muon { // Sort the input collection by chamber & station IDs for (const MuonSegment* segment : theSegments) { ATH_MSG_DEBUG("Adding segment "); - std::unique_ptr<MuPatSegment> aSeg = m_candidateTool->createSegInfo(*segment, trash_bin); + std::unique_ptr<MuPatSegment> aSeg = m_candidateTool->createSegInfo(ctx, *segment, trash_bin); ATH_MSG_DEBUG(" -> MuPatSegment " << m_candidateTool->print(*aSeg)); MuonStationIndex::ChIndex chIndex = aSeg->chIndex; @@ -245,7 +245,7 @@ namespace Muon { ATH_MSG_DEBUG("bad fit quality, dropping segment " << fq->chiSquared() / fq->numberDoF()); continue; } - std::unique_ptr<MuPatSegment> segInfo = m_candidateTool->createSegInfo(*newseg, trash_bin); + std::unique_ptr<MuPatSegment> segInfo = m_candidateTool->createSegInfo(ctx, *newseg, trash_bin); // check whether segment of good quality AND that its quality is equal or better than the input segments if (segInfo->quality < 2 || (segInfo->quality < sit1->quality || segInfo->quality < sit2->quality)) { ATH_MSG_VERBOSE("resolveSLOverlaps::bad segment " << std::endl << m_printer->print(*segInfo->segment)); diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonSegmentTagTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonSegmentTagTool.cxx index d83d7a9e7e7da461561675f70920db16055f117f..01161c80d95822d2d9f8e337afd163c809d0ddfa 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonSegmentTagTool.cxx +++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonSegmentTagTool.cxx @@ -594,7 +594,7 @@ namespace MuonCombined { ATH_MSG_DEBUG("number of accepted tracks " << m_naccepted << " segmentsInfo size " << segmentsInfo.size()); std::vector<MuonCombined::MuonSegmentInfo> segmentsInfoSolved = - m_MuTagAmbiguitySolverTool->selectBestMuTaggedSegments(segmentsInfo); + m_MuTagAmbiguitySolverTool->selectBestMuTaggedSegments(ctx, segmentsInfo); segmentsInfoSelected.reserve(segmentsInfoSolved.size()); for (const auto& x : segmentsInfoSolved) segmentsInfoSelected.push_back(x); ATH_MSG_DEBUG("segmentsInfoSelected size " << segmentsInfoSelected.size()); @@ -603,7 +603,7 @@ namespace MuonCombined { } // end loop over tracks ATH_MSG_DEBUG("segmentsInfoSelected size after track loop " << segmentsInfoSelected.size()); - std::vector<MuonCombined::MuonSegmentInfo> segmentsInfoFinal = m_MuTagAmbiguitySolverTool->solveAmbiguities(segmentsInfoSelected); + std::vector<MuonCombined::MuonSegmentInfo> segmentsInfoFinal = m_MuTagAmbiguitySolverTool->solveAmbiguities(ctx, segmentsInfoSelected); ATH_MSG_DEBUG("segmentsInfoFinal size " << segmentsInfoFinal.size()); if (msgLevel(MSG::DEBUG)) { diff --git a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonLayerAmbiguitySolverTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonLayerAmbiguitySolverTool.cxx index d50c626f37e4e12c0d1f3a5d69d7e07e397afb85..c7be035dc9781cf5a1695b1f5a33a20f97474dcf 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonLayerAmbiguitySolverTool.cxx +++ b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonLayerAmbiguitySolverTool.cxx @@ -57,7 +57,7 @@ namespace Muon { // create first candidate from seed and extend it std::vector<MuonLayerIntersection> layerIntersections = {layerIntersection}; std::vector<MuonCandidate> candidates = {MuonCandidate(std::move(layerIntersections))}; - if (extendCandidatesWithLayers(candidates, muonLayerDataHashVec, inverseSeedLayerOrder)) { + if (extendCandidatesWithLayers(ctx, candidates, muonLayerDataHashVec, inverseSeedLayerOrder)) { // add candidates to output list ATH_MSG_DEBUG(" Completed seed extension " << candidates.size()); if (msgLvl(MSG::VERBOSE)) { @@ -84,7 +84,8 @@ namespace Muon { } bool MuonLayerAmbiguitySolverTool::extendCandidatesWithLayers( - std::vector<MuonCandidate>& candidates, const std::vector<std::vector<MuonLayerIntersection> >& muonLayerDataHashVec, + const EventContext& ctx, std::vector<MuonCandidate>& candidates, + const std::vector<std::vector<MuonLayerIntersection> >& muonLayerDataHashVec, const std::vector<MuonStationIndex::StIndex>& inverseSeedLayerOrder) const { // break recursive call chain once we processed all layers if (inverseSeedLayerOrder.empty()) return true; @@ -106,7 +107,7 @@ namespace Muon { // loop over data in layer for (const auto& layerIntersection : layerIntersections) { // match segment to candidate - if (match(candidate, layerIntersection)) { + if (match(ctx, candidate, layerIntersection)) { // if first add to existing candidate, else create a new candidate if (selectedSegmentsInLayer == 0) { candidate.layerIntersections.push_back(layerIntersection); @@ -131,13 +132,13 @@ namespace Muon { // remove the current layer and call extendCandidatesWithLayers for the next layer std::vector<MuonStationIndex::StIndex> newInverseSeedLayerOrder = inverseSeedLayerOrder; newInverseSeedLayerOrder.pop_back(); - return extendCandidatesWithLayers(candidates, muonLayerDataHashVec, newInverseSeedLayerOrder); + return extendCandidatesWithLayers(ctx, candidates, muonLayerDataHashVec, newInverseSeedLayerOrder); } - bool MuonLayerAmbiguitySolverTool::match(const MuonCandidate& candidate, const MuonLayerIntersection& layerIntersection) const { + bool MuonLayerAmbiguitySolverTool::match(const EventContext& ctx, const MuonCandidate& candidate, const MuonLayerIntersection& layerIntersection) const { // loop over layers and match each segment to the new one, if any fails, fail the combination for (const auto& layer : candidate.layerIntersections) { - if (!m_segmentMatchingTool->match(*layer.segment, *layerIntersection.segment)) return false; + if (!m_segmentMatchingTool->match(ctx, *layer.segment, *layerIntersection.segment)) return false; } return true; } @@ -239,7 +240,7 @@ namespace Muon { if (quality1 < m_seedQualityThreshold && quality2 < m_seedQualityThreshold) continue; // match segments - if (!m_segmentMatchingTool->match(*layerIntersection1.segment, *layerIntersection2.segment)) continue; + if (!m_segmentMatchingTool->match(ctx, *layerIntersection1.segment, *layerIntersection2.segment)) continue; // build new segment std::shared_ptr<const MuonSegment> newseg{ diff --git a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonLayerAmbiguitySolverTool.h b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonLayerAmbiguitySolverTool.h index 8e90579f6bf7433999cd4d334dbaf8358e675ad4..458bb8f24cb615437227212cda37dedd90e9bc79 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonLayerAmbiguitySolverTool.h +++ b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonLayerAmbiguitySolverTool.h @@ -40,14 +40,14 @@ namespace Muon { std::set<const MuonSegment*>& usedSegments, std::vector<MuonStationIndex::StIndex>& inverseSeedLayerOrder, MuonLayerIntersection& layerIntersection) const; - bool extendCandidatesWithLayers(std::vector<MuonCandidate>& candidates, + bool extendCandidatesWithLayers(const EventContext& ctx, std::vector<MuonCandidate>& candidates, const std::vector<std::vector<MuonLayerIntersection> >& muonLayerRecoDataHashVec, const std::vector<MuonStationIndex::StIndex>& inverseSeedLayerOrder) const; void resolveSmallLargeOverlaps(const EventContext& ctx, std::vector<MuonLayerIntersection>& existingLayerIntersections, const std::vector<MuonLayerIntersection>& newLayerIntersections) const; - bool match(const MuonCandidate& candidate, const MuonLayerIntersection& layerIntersection) const; + bool match(const EventContext& ctx, const MuonCandidate& candidate, const MuonLayerIntersection& layerIntersection) const; ToolHandle<IMuonSegmentSelectionTool> m_segmentSelector{this, "MuonSegmentSelectionTool", "Muon::MuonSegmentSelectionTool/MuonSegmentSelectionTool"}; diff --git a/Reconstruction/MuonIdentification/MuonSegmentTaggers/MuonSegmentTaggerToolInterfaces/MuonSegmentTaggerToolInterfaces/IMuTagAmbiguitySolverTool.h b/Reconstruction/MuonIdentification/MuonSegmentTaggers/MuonSegmentTaggerToolInterfaces/MuonSegmentTaggerToolInterfaces/IMuTagAmbiguitySolverTool.h index 9d8ba3cd3ca67f6be65c65afb9abae15d475895e..c2e02120589d2a5798c2e497e41b8db22f70de4e 100644 --- a/Reconstruction/MuonIdentification/MuonSegmentTaggers/MuonSegmentTaggerToolInterfaces/MuonSegmentTaggerToolInterfaces/IMuTagAmbiguitySolverTool.h +++ b/Reconstruction/MuonIdentification/MuonSegmentTaggers/MuonSegmentTaggerToolInterfaces/MuonSegmentTaggerToolInterfaces/IMuTagAmbiguitySolverTool.h @@ -29,10 +29,10 @@ class IMuTagAmbiguitySolverTool : virtual public IAlgTool { public: static const InterfaceID& interfaceID(); - virtual std::vector<MuonCombined::MuonSegmentInfo> solveAmbiguities(std::vector<MuonCombined::MuonSegmentInfo> mtos) const = 0; + virtual std::vector<MuonCombined::MuonSegmentInfo> solveAmbiguities(const EventContext& ctx, std::vector<MuonCombined::MuonSegmentInfo> mtos) const = 0; virtual std::vector<MuonCombined::MuonSegmentInfo> selectBestMuTaggedSegments( - std::vector<MuonCombined::MuonSegmentInfo> mtss) const = 0; + const EventContext& ctx, std::vector<MuonCombined::MuonSegmentInfo> mtss) const = 0; virtual double Rseg(unsigned int nseg) const = 0; }; diff --git a/Reconstruction/MuonIdentification/MuonSegmentTaggers/MuonSegmentTaggerTools/src/MuTagAmbiguitySolverTool.cxx b/Reconstruction/MuonIdentification/MuonSegmentTaggers/MuonSegmentTaggerTools/src/MuTagAmbiguitySolverTool.cxx index 649f90cc7d88149866b058e33d51186996803184..1b5de9a2eea0e030d19e5f389aa6e31d14e9fed3 100644 --- a/Reconstruction/MuonIdentification/MuonSegmentTaggers/MuonSegmentTaggerTools/src/MuTagAmbiguitySolverTool.cxx +++ b/Reconstruction/MuonIdentification/MuonSegmentTaggers/MuonSegmentTaggerTools/src/MuTagAmbiguitySolverTool.cxx @@ -37,7 +37,7 @@ StatusCode MuTagAmbiguitySolverTool::initialize() { } std::vector<MuonCombined::MuonSegmentInfo> MuTagAmbiguitySolverTool::solveAmbiguities( - std::vector<MuonCombined::MuonSegmentInfo> mtos) const { + const EventContext& ctx, std::vector<MuonCombined::MuonSegmentInfo> mtos) const { ATH_MSG_DEBUG("mtos size before any cuts " << mtos.size()); // Store the number of segments associated to one track (pointer) for (unsigned int ns1 = 0; ns1 < mtos.size(); ns1++) { @@ -75,7 +75,7 @@ std::vector<MuonCombined::MuonSegmentInfo> MuTagAmbiguitySolverTool::solveAmbigu << " stationLayer " << mtos[ns1].stationLayer << " selected " << mtos[ns1].selected); for (unsigned int ns2 = ns1 + 1; ns2 < mtos.size(); ns2++) { - if (mtos[ns1].segment == mtos[ns2].segment || ambiguousSegment(*mtos[ns1].segment, *mtos[ns2].segment)) { + if (mtos[ns1].segment == mtos[ns2].segment || ambiguousSegment(ctx, *mtos[ns1].segment, *mtos[ns2].segment)) { double R1 = std::abs(mtos[ns1].pullCY * Rseg(mtos[ns1].nsegments)); double R2 = std::abs(mtos[ns2].pullCY * Rseg(mtos[ns2].nsegments)); ATH_MSG_DEBUG(" Ambiguous segment at index " << ns1 << " and " << ns2); @@ -235,7 +235,7 @@ std::vector<MuonCombined::MuonSegmentInfo> MuTagAmbiguitySolverTool::solveAmbigu return mtosOutput; } -int MuTagAmbiguitySolverTool::ambiguousSegment(const Muon::MuonSegment& seg1, const Muon::MuonSegment& seg2) const { +int MuTagAmbiguitySolverTool::ambiguousSegment(const EventContext& ctx, const Muon::MuonSegment& seg1, const Muon::MuonSegment& seg2) const { // first check pointer if (&seg1 == &seg2) return 1; @@ -262,7 +262,7 @@ int MuTagAmbiguitySolverTool::ambiguousSegment(const Muon::MuonSegment& seg1, co if (sectorOk) { // check whether the two segments actually belong to the same particle - bool match = p_segmentMatchingTool->match(seg1, seg2); + bool match = p_segmentMatchingTool->match(ctx, seg1, seg2); if (match) { ATH_MSG_VERBOSE("Found matching segment pair: " << std::endl << p_muonPrinter->print(seg1) << std::endl @@ -299,7 +299,7 @@ int MuTagAmbiguitySolverTool::ambiguousSegment(const Muon::MuonSegment& seg1, co } std::vector<MuonCombined::MuonSegmentInfo> MuTagAmbiguitySolverTool::selectBestMuTaggedSegments( - std::vector<MuonCombined::MuonSegmentInfo> mtss) const { + const EventContext& ctx, std::vector<MuonCombined::MuonSegmentInfo> mtss) const { ATH_MSG_DEBUG("cleaning set of MTSs"); std::vector<MuonCombined::MuonSegmentInfo> outputMTSs; @@ -329,7 +329,7 @@ std::vector<MuonCombined::MuonSegmentInfo> MuTagAmbiguitySolverTool::selectBestM int eta2 = m_idHelperSvc->stationEta(ch2); if (eta1 != eta2) continue; - if (ambiguousSegment(*museg1, *museg2)) { + if (ambiguousSegment(ctx, *museg1, *museg2)) { if (museg1->numberOfContainedROTs() > museg2->numberOfContainedROTs() - 1) { ATH_MSG_DEBUG("segments in the same station with rots keep First " << museg1->numberOfContainedROTs() << " and " << museg2->numberOfContainedROTs()); diff --git a/Reconstruction/MuonIdentification/MuonSegmentTaggers/MuonSegmentTaggerTools/src/MuTagAmbiguitySolverTool.h b/Reconstruction/MuonIdentification/MuonSegmentTaggers/MuonSegmentTaggerTools/src/MuTagAmbiguitySolverTool.h index 0afdf179d898aa07e47a05947e531ebd21e279ab..a141ffe54a26fa06f92a24c4f15f5b96c525ff2b 100644 --- a/Reconstruction/MuonIdentification/MuonSegmentTaggers/MuonSegmentTaggerTools/src/MuTagAmbiguitySolverTool.h +++ b/Reconstruction/MuonIdentification/MuonSegmentTaggers/MuonSegmentTaggerTools/src/MuTagAmbiguitySolverTool.h @@ -36,13 +36,13 @@ public: virtual StatusCode initialize(); - std::vector<MuonCombined::MuonSegmentInfo> solveAmbiguities(std::vector<MuonCombined::MuonSegmentInfo> mtos) const; + std::vector<MuonCombined::MuonSegmentInfo> solveAmbiguities(const EventContext& ctx, std::vector<MuonCombined::MuonSegmentInfo> mtos) const; - std::vector<MuonCombined::MuonSegmentInfo> selectBestMuTaggedSegments(std::vector<MuonCombined::MuonSegmentInfo> mtss) const; + std::vector<MuonCombined::MuonSegmentInfo> selectBestMuTaggedSegments(const EventContext& ctx, std::vector<MuonCombined::MuonSegmentInfo> mtss) const; private: /////////////////////////////////// - int ambiguousSegment(const Muon::MuonSegment& seg1, const Muon::MuonSegment& seg2) const; + int ambiguousSegment(const EventContext& ctx, const Muon::MuonSegment& seg1, const Muon::MuonSegment& seg2) const; double Rseg(unsigned int nseg) const; ServiceHandle<Muon::IMuonEDMHelperSvc> m_edmHelperSvc{