From 2ee7ad1202bf0c80caf002fa03d5a8eb3622f64c Mon Sep 17 00:00:00 2001 From: Pascal Boeschoten <pascal.boeschoten@cern.ch> Date: Thu, 28 Nov 2019 17:52:57 +0100 Subject: [PATCH 1/4] Private tool migration for MuidTrackBuilder --- .../MuidTrackBuilder/MuidMuonRecovery.h | 28 +++++-------- .../MuidTrackBuilder/MuonMatchQuality.h | 13 ++---- .../MuidTrackBuilder/MuonTrackQuery.h | 16 ++++--- .../OutwardsCombinedMuonTrackBuilder.h | 16 ++++--- .../src/CombinedMuonTrackBuilder.cxx | 38 ++++++++--------- .../MuidTrackBuilder/src/MuidMuonRecovery.cxx | 42 +++++++------------ .../MuidTrackBuilder/src/MuonMatchQuality.cxx | 6 --- .../MuidTrackBuilder/src/MuonTrackQuery.cxx | 23 ++++------ .../src/OutwardsCombinedMuonTrackBuilder.cxx | 15 ------- 9 files changed, 73 insertions(+), 124 deletions(-) diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/MuidMuonRecovery.h b/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/MuidMuonRecovery.h index f4de998a9da9..35f7a3b38878 100644 --- a/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/MuidMuonRecovery.h +++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/MuidMuonRecovery.h @@ -20,25 +20,18 @@ #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" +#include "MuidInterfaces/ICombinedMuonTrackBuilder.h" #include "MuidInterfaces/IMuidMuonRecovery.h" #include "MuonRecHelperTools/IMuonEDMHelperSvc.h" +#include "MuonRecHelperTools/MuonEDMPrinterTool.h" +#include "TrkExInterfaces/IExtrapolator.h" +#include "TrkToolInterfaces/IResidualPullCalculator.h" //<<<<<< CLASS DECLARATIONS >>>>>> -namespace Muon -{ - class MuonEDMPrinterTool; - class MuonIdHelperTool; -} -namespace Trk -{ - class IExtrapolator; - class IResidualPullCalculator; -} namespace Rec { - class ICombinedMuonTrackBuilder; class MuidMuonRecovery: public AthAlgTool, virtual public IMuidMuonRecovery @@ -60,14 +53,15 @@ public: private: // helpers, managers, tools - ToolHandle<Trk::IExtrapolator> m_extrapolator; - ServiceHandle<Muon::IMuonEDMHelperSvc> m_edmHelperSvc {this, "edmHelper", + ToolHandle<Trk::IExtrapolator> m_extrapolator {this, "Extrapolator", "Trk::Extrapolator/AtlasExtrapolator", "Extrapolator tool"}; + ServiceHandle<Muon::IMuonEDMHelperSvc> m_edmHelperSvc {this, "edmHelper", "Muon::MuonEDMHelperSvc/MuonEDMHelperSvc", "Handle to the service providing the IMuonEDMHelperSvc interface" }; //<! multipurpose helper tool - ToolHandle<Muon::MuonIdHelperTool> m_idHelper; //<! tool to assist with Identifiers - ToolHandle<Muon::MuonEDMPrinterTool> m_printer; //<! tool to print EDM objects - ToolHandle<Trk::IResidualPullCalculator> m_residualCalculator; - ToolHandle<ICombinedMuonTrackBuilder> m_trackBuilder; + ServiceHandle<Muon::IMuonIdHelperSvc> m_muonIdHelperSvc{this, "idHelper", + "Muon::MuonIdHelperSvc/MuonIdHelperSvc", "Handle to the service providing the IMuonIdHelperSvc interface"}; //<! tool to assist with Identifiers + ToolHandle<Muon::MuonEDMPrinterTool> m_printer {this, "Printer", "Muon::MuonEDMPrinterTool/MuonEDMPrinterTool", "Tool to print EDM objects"}; //<! tool to print EDM objects + ToolHandle<Trk::IResidualPullCalculator> m_residualCalculator {this, "TrackBuilder", "Trk::ResidualPullCalculator/ResidualPullCalculator", "Residual calculator tool"}; + ToolHandle<ICombinedMuonTrackBuilder> m_trackBuilder {this, "TrackBuilder", "Rec::CombinedMuonTrackBuilder/CombinedMuonTrackBuilder", "Track builder tool"}; // configurable cuts and tolerances double m_minP; diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/MuonMatchQuality.h b/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/MuonMatchQuality.h index 22e830e8fa53..abf89053c765 100755 --- a/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/MuonMatchQuality.h +++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/MuonMatchQuality.h @@ -13,17 +13,12 @@ #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/ToolHandle.h" #include "MuidInterfaces/IMuonMatchQuality.h" +#include "MuonCombinedToolInterfaces/IMuonTrackTagTool.h" +#include "MuidInterfaces/IMuonTrackQuery.h" -namespace MuonCombined -{ - class IMuonTrackTagTool; -} - namespace Rec { - class IMuonTrackQuery; - class MuonMatchQuality : public AthAlgTool, virtual public IMuonMatchQuality { @@ -74,8 +69,8 @@ namespace Rec void setCache (const Trk::Track& track1, const Trk::Track& track2) const; // helpers, managers, tools - ToolHandle<MuonCombined::IMuonTrackTagTool> m_tagTool; - ToolHandle<IMuonTrackQuery> m_trackQuery; + ToolHandle<MuonCombined::IMuonTrackTagTool> m_tagTool {this, "TagTool", "", "Track tag tool"}; + ToolHandle<IMuonTrackQuery> m_trackQuery {this, "TrackQuery", "Rec::MuonTrackQuery/MuonTrackQuery", "Track query tool"}; // estimate of ID/MS alignment uncertainties AmgSymMatrix(5)* m_alignmentUncertainty; diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/MuonTrackQuery.h b/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/MuonTrackQuery.h index f83d6560f34c..9b278ec3ff79 100755 --- a/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/MuonTrackQuery.h +++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/MuonTrackQuery.h @@ -13,17 +13,14 @@ #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" #include "MuidInterfaces/IMuonTrackQuery.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "MuonRecHelperTools/IMuonEDMHelperSvc.h" +#include "MuonRecToolInterfaces/IMdtDriftCircleOnTrackCreator.h" +#include "TrkFitterInterfaces/ITrackFitter.h" -namespace Muon -{ - class IMdtDriftCircleOnTrackCreator; - class MuonIdHelperTool; -} namespace Trk { class ITrackingGeometrySvc; - class ITrackFitter; } namespace Rec { @@ -117,12 +114,13 @@ namespace Rec const Trk::TrackParameters* flippedParameters (const Trk::TrackParameters& params) const; // tools and services - ToolHandle<Trk::ITrackFitter> m_fitter; + ToolHandle<Trk::ITrackFitter> m_fitter {this, "Fitter", "", "Track fitter tool"}; ServiceHandle<Muon::IMuonEDMHelperSvc> m_edmHelperSvc {this, "edmHelper", "Muon::MuonEDMHelperSvc/MuonEDMHelperSvc", "Handle to the service providing the IMuonEDMHelperSvc interface" }; - ToolHandle<Muon::MuonIdHelperTool> m_idHelper; - ToolHandle<Muon::IMdtDriftCircleOnTrackCreator> m_mdtRotCreator; + ServiceHandle<Muon::IMuonIdHelperSvc> m_muonIdHelperSvc{this, "idHelper", + "Muon::MuonIdHelperSvc/MuonIdHelperSvc", "Handle to the service providing the IMuonIdHelperSvc interface"}; + ToolHandle<Muon::IMdtDriftCircleOnTrackCreator> m_mdtRotCreator {this, "MdtRotCreator", "Muon::MdtDriftCircleOnTrackCreator/MdtDriftCircleOnTrackCreator", "MdtDriftCircleOnTrackCreator tool"}; ServiceHandle<Trk::ITrackingGeometrySvc> m_trackingGeometrySvc; }; diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/OutwardsCombinedMuonTrackBuilder.h b/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/OutwardsCombinedMuonTrackBuilder.h index c66cd601eb61..39b7753d1ea1 100644 --- a/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/OutwardsCombinedMuonTrackBuilder.h +++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/OutwardsCombinedMuonTrackBuilder.h @@ -20,9 +20,13 @@ #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/ToolHandle.h" #include "MuidInterfaces/ICombinedMuonTrackBuilder.h" +#include "MuonRecToolInterfaces/IMuonErrorOptimisationTool.h" +#include "MuonRecToolInterfaces/IMuonHoleRecoveryTool.h" +#include "MuonRecToolInterfaces/IMuonTrackCleaner.h" +#include "TrkDetDescrInterfaces/ITrackingVolumesSvc.h" #include "TrkParameters/TrackParameters.h" #include "TrkTrack/TrackInfo.h" -#include "TrkDetDescrInterfaces/ITrackingVolumesSvc.h" +#include "TrkToolInterfaces/ITrackSummaryTool.h" //<<<<<< CLASS DECLARATIONS >>>>>> @@ -143,11 +147,11 @@ namespace Rec // helpers, managers, tools - ToolHandle<Muon::IMuonTrackCleaner> m_cleaner; - ToolHandle<Trk::ITrackFitter> m_fitter; // curved track fitter - ToolHandle<Trk::ITrackSummaryTool> m_trackSummary; - ToolHandle<Muon::IMuonHoleRecoveryTool> m_muonHoleRecovery; - ToolHandle<Muon::IMuonErrorOptimisationTool> m_muonErrorOptimizer; + ToolHandle<Muon::IMuonTrackCleaner> m_cleaner {this, "Cleaner", "", "MuonTrackCleaner tool"}; + ToolHandle<Trk::ITrackFitter> m_fitter {this, "Fitter", "", "TrackFitter tool"}; // curved track fitter + ToolHandle<Trk::ITrackSummaryTool> m_trackSummary {this, "TrackSummaryTool", "", "TrackSummary tool"}; + ToolHandle<Muon::IMuonHoleRecoveryTool> m_muonHoleRecovery {this, "MuonHoleRecovery", "", "MuonHoleRecovery tool"}; + ToolHandle<Muon::IMuonErrorOptimisationTool> m_muonErrorOptimizer {this, "MuonErrorOptimizer", "", "MuonErrorOptimizer tool"}; ServiceHandle<Trk::ITrackingVolumesSvc> m_trackingVolumesSvc; const Trk::Volume* m_calorimeterVolume; const Trk::Volume* m_indetVolume; diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackBuilder.cxx b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackBuilder.cxx index e9fc5891312a..383381f5d104 100755 --- a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackBuilder.cxx +++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackBuilder.cxx @@ -76,29 +76,29 @@ CombinedMuonTrackBuilder::CombinedMuonTrackBuilder (const std::string&type, const std::string&name, const IInterface*parent) : AthAlgTool (type, name, parent), - m_caloEnergyParam ("Rec::MuidCaloEnergyTool/MuidCaloEnergyToolParam"), - m_caloTSOS ("Rec::MuidCaloTrackStateOnSurface/MuidCaloTrackStateOnSurface"), - m_cleaner ("Muon::MuonTrackCleaner/MuidTrackCleaner"), - m_cscRotCreator (""), - m_extrapolator ("Trk::Extrapolator/AtlasExtrapolator"), - m_fitter ("Trk::iPatFitter/iPatFitter"), - m_fitterSL ("Trk::iPatFitter/iPatSLFitter"), - m_idHelperTool ("Muon::MuonIdHelperTool"), - m_intersector ("Trk::RungeKuttaIntersector/RungeKuttaIntersector"), + m_caloEnergyParam ("Rec::MuidCaloEnergyTool/MuidCaloEnergyToolParam", this), + m_caloTSOS ("Rec::MuidCaloTrackStateOnSurface/MuidCaloTrackStateOnSurface", this), + m_cleaner ("Muon::MuonTrackCleaner/MuidTrackCleaner", this), + m_cscRotCreator ("", this), + m_extrapolator ("Trk::Extrapolator/AtlasExtrapolator", this), + m_fitter ("Trk::iPatFitter/iPatFitter", this), + m_fitterSL ("Trk::iPatFitter/iPatSLFitter", this), + m_idHelperTool ("Muon::MuonIdHelperTool", this), + m_intersector ("Trk::RungeKuttaIntersector/RungeKuttaIntersector", this), m_magFieldProperties (Trk::FullField), m_magFieldSvc ("AtlasFieldSvc",name), - m_materialAllocator (""), - m_mdtRotCreator (""), - m_muonErrorOptimizer ("Muon::MuonErrorOptimisationTool/MuidErrorOptimisationTool"), - m_muonHoleRecovery ("Muon::MuonChamberHoleRecoveryTool/MuonChamberHoleRecoveryTool"), - m_propagator ("Trk::IntersectorWrapper/IntersectorWrapper"), - m_propagatorSL ("Trk::StraightLinePropagator/MuonStraightLinePropagator"), - m_printer ("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"), + m_materialAllocator ("", this), + m_mdtRotCreator ("", this), + m_muonErrorOptimizer ("Muon::MuonErrorOptimisationTool/MuidErrorOptimisationTool", this), + m_muonHoleRecovery ("Muon::MuonChamberHoleRecoveryTool/MuonChamberHoleRecoveryTool", this), + m_propagator ("Trk::IntersectorWrapper/IntersectorWrapper", this), + m_propagatorSL ("Trk::StraightLinePropagator/MuonStraightLinePropagator", this), + m_printer ("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool", this), m_trackingGeometrySvc ("TrackingGeometrySvc/AtlasTrackingGeometrySvc",name), m_trackingVolumesSvc ("TrackingVolumesSvc/TrackingVolumesSvc",name), - m_trackQuery ("Rec::MuonTrackQuery/MuonTrackQuery"), - m_trackSummary ("Trk::TrackSummaryTool/MuidTrackSummaryTool"), - m_materialUpdator ("Trk::TrkMaterialProviderTool/TrkMaterialProviderTool"), + m_trackQuery ("Rec::MuonTrackQuery/MuonTrackQuery", this), + m_trackSummary ("Trk::TrackSummaryTool/MuidTrackSummaryTool", this), + m_materialUpdator ("Trk::TrkMaterialProviderTool/TrkMaterialProviderTool", this), m_allowCleanerVeto (true), m_cleanCombined (true), m_cleanStandalone (true), diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuidMuonRecovery.cxx b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuidMuonRecovery.cxx index 7f264fa1e1aa..c07c1d63b4a5 100644 --- a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuidMuonRecovery.cxx +++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuidMuonRecovery.cxx @@ -19,22 +19,17 @@ #include <vector> #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/SystemOfUnits.h" -#include "MuidInterfaces/ICombinedMuonTrackBuilder.h" #include "MuidTrackBuilder/MuidMuonRecovery.h" #include "MuonRIO_OnTrack/MdtDriftCircleOnTrack.h" #include "MuonRIO_OnTrack/CscClusterOnTrack.h" #include "MuonReadoutGeometry/MuonReadoutElement.h" -#include "MuonRecHelperTools/IMuonEDMHelperSvc.h" -#include "MuonRecHelperTools/MuonEDMPrinterTool.h" #include "MuonIdHelpers/MuonIdHelperTool.h" #include "MuonIdHelpers/MuonStationIndex.h" #include "TrkEventPrimitives/LocalDirection.h" #include "TrkEventPrimitives/ResidualPull.h" -#include "TrkExInterfaces/IExtrapolator.h" #include "TrkParameters/TrackParameters.h" #include "TrkPseudoMeasurementOnTrack/PseudoMeasurementOnTrack.h" #include "TrkSurfaces/PlaneSurface.h" -#include "TrkToolInterfaces/IResidualPullCalculator.h" #include "TrkTrack/Track.h" #include "TrkTrackSummary/TrackSummary.h" #include "TrkSegment/SegmentCollection.h" @@ -48,11 +43,6 @@ MuidMuonRecovery::MuidMuonRecovery (const std::string& type, const std::string& name, const IInterface* parent) : AthAlgTool (type, name, parent), - m_extrapolator ("Trk::Extrapolator/AtlasExtrapolator"), - m_idHelper ("Muon::MuonIdHelperTool/MuonIdHelperTool"), - m_printer ("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"), - m_residualCalculator ("Trk::ResidualPullCalculator/ResidualPullCalculator"), - m_trackBuilder ("Rec::CombinedMuonTrackBuilder/CombinedMuonTrackBuilder"), m_minP (10.*Gaudi::Units::GeV), m_minPt (5.*Gaudi::Units::GeV), m_recoveryAttempts (0), @@ -60,8 +50,6 @@ MuidMuonRecovery::MuidMuonRecovery (const std::string& type, m_recoverySuccess (0) { declareInterface<IMuidMuonRecovery>(this); - declareProperty("Extrapolator", m_extrapolator); - declareProperty("TrackBuilder", m_trackBuilder); declareProperty("MinP", m_minP); declareProperty("MinPt", m_minPt); declareProperty("PullCut", m_pullCut = 5); @@ -96,14 +84,14 @@ MuidMuonRecovery::initialize() { ATH_MSG_INFO( "Retrieved tool " << m_edmHelperSvc ); } - if (m_idHelper.retrieve().isFailure()) + if (m_muonIdHelperSvc.retrieve().isFailure()) { - ATH_MSG_FATAL( "Failed to retrieve tool " << m_idHelper ); + ATH_MSG_FATAL( "Failed to retrieve tool " << m_muonIdHelperSvc ); return StatusCode::FAILURE; } else { - ATH_MSG_INFO( "Retrieved tool " << m_idHelper ); + ATH_MSG_INFO( "Retrieved tool " << m_muonIdHelperSvc ); } if (m_printer.retrieve().isFailure()) { @@ -203,21 +191,21 @@ MuidMuonRecovery::recoverableMatch (const Trk::Track& indetTrack, Identifier id = m_edmHelperSvc->getIdentifier(*meas); if ( !id.is_valid() ) continue; - Muon::MuonStationIndex::StIndex index = m_idHelper->stationIndex(id); - bool measuresPhi = m_idHelper->measuresPhi(id); + Muon::MuonStationIndex::StIndex index = m_muonIdHelperSvc->stationIndex(id); + bool measuresPhi = m_muonIdHelperSvc->measuresPhi(id); ++nmeas; if ( measuresPhi ) { if ( phiIndices.count(index) ) continue; - ATH_MSG_DEBUG("Adding phi station " << m_idHelper->toString(id)); + ATH_MSG_DEBUG("Adding phi station " << m_muonIdHelperSvc->toString(id)); phiIndices.insert(index); } - else if (m_idHelper->isMdt(id) || (m_idHelper->isCsc(id) ) ) + else if (m_muonIdHelperSvc->isMdt(id) || (m_muonIdHelperSvc->isCsc(id) ) ) { if ( etaIndices.count(index) ) continue; - ATH_MSG_DEBUG("Adding eta station " << m_idHelper->toString(id)); + ATH_MSG_DEBUG("Adding eta station " << m_muonIdHelperSvc->toString(id)); etaIndices.insert(index); } else @@ -241,13 +229,13 @@ MuidMuonRecovery::recoverableMatch (const Trk::Track& indetTrack, } if ( ! exPars ) { - ATH_MSG_DEBUG("Failed to extrapolate to station" << m_idHelper->toStringChamber(id) ); + ATH_MSG_DEBUG("Failed to extrapolate to station" << m_muonIdHelperSvc->toStringChamber(id) ); continue; } const Trk::ResidualPull* res = m_residualCalculator->residualPull( meas, exPars, Trk::ResidualPull::Unbiased ); - ATH_MSG_DEBUG(" " << m_idHelper->toStringChamber(id) << " residual " << m_printer->print(*res)); + ATH_MSG_DEBUG(" " << m_muonIdHelperSvc->toStringChamber(id) << " residual " << m_printer->print(*res)); if ( fabs(res->pull().front()) > m_pullCut ) { if ( measuresPhi ) @@ -264,10 +252,10 @@ MuidMuonRecovery::recoverableMatch (const Trk::Track& indetTrack, if (msgLvl(MSG::DEBUG)) { - if ( !m_idHelper->measuresPhi(id) ) + if ( !m_muonIdHelperSvc->measuresPhi(id) ) { const MuonGM::MuonReadoutElement* detEl = 0; - if ( m_idHelper->isMdt(id) ) + if ( m_muonIdHelperSvc->isMdt(id) ) { const Muon::MdtDriftCircleOnTrack* mdt = dynamic_cast<const Muon::MdtDriftCircleOnTrack*>(meas); @@ -276,7 +264,7 @@ if (msgLvl(MSG::DEBUG)) detEl = mdt->detectorElement(); } } - else if ( m_idHelper->isCsc(id) ) + else if ( m_muonIdHelperSvc->isCsc(id) ) { const Muon::CscClusterOnTrack* csc = dynamic_cast<const Muon::CscClusterOnTrack*>(meas); @@ -372,8 +360,8 @@ if (msgLvl(MSG::DEBUG)) Identifier id = m_edmHelperSvc->getIdentifier(*meas); if ( !id.is_valid() ) continue; - Muon::MuonStationIndex::StIndex index = m_idHelper->stationIndex(id); - bool measuresPhi = m_idHelper->measuresPhi(id); + Muon::MuonStationIndex::StIndex index = m_muonIdHelperSvc->stationIndex(id); + bool measuresPhi = m_muonIdHelperSvc->measuresPhi(id); if ( cleanEta && !measuresPhi && badEtaIndices.count(index) ) continue; if ( cleanPhi && measuresPhi && badPhiIndices.count(index) ) continue; spectrometerMeasurements.push_back(meas); diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuonMatchQuality.cxx b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuonMatchQuality.cxx index e1963df4cc52..b7e3a86041c9 100755 --- a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuonMatchQuality.cxx +++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuonMatchQuality.cxx @@ -10,9 +10,7 @@ #include <cmath> #include <iomanip> #include "CLHEP/GenericFunctions/CumulativeChiSquare.hh" -#include "MuidInterfaces/IMuonTrackQuery.h" #include "MuidTrackBuilder/MuonMatchQuality.h" -#include "MuonCombinedToolInterfaces/IMuonTrackTagTool.h" #include "TrkTrack/Track.h" #include "AthenaKernel/Units.h" @@ -25,8 +23,6 @@ MuonMatchQuality::MuonMatchQuality (const std::string& type, const std::string& name, const IInterface* parent) : AthAlgTool (type, name, parent), - m_tagTool (""), - m_trackQuery ("Rec::MuonTrackQuery/MuonTrackQuery"), m_alignmentUncertainty (0), m_directionUncertainty (0.000001), // not used anymore angle ID and MS: done by m_addIDMSerrors m_positionUncertainty (0.01*Units::mm), // not used anymore shift ID and MS: done by m_addIDMSerrors @@ -40,8 +36,6 @@ MuonMatchQuality::MuonMatchQuality (const std::string& type, m_track2 (0) { declareInterface<IMuonMatchQuality>(this); - declareProperty("TagTool", m_tagTool); - declareProperty("TrackQuery", m_trackQuery); declareProperty("ID_MS_DirectionUncertainty", m_directionUncertainty); declareProperty("ID_MS_PositionUncertainty", m_positionUncertainty); } diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuonTrackQuery.cxx b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuonTrackQuery.cxx index c2b0fc369aea..ce72db5add76 100755 --- a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuonTrackQuery.cxx +++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuonTrackQuery.cxx @@ -16,12 +16,8 @@ #include "MuidTrackBuilder/MuonTrackQuery.h" #include "MuonCompetingRIOsOnTrack/CompetingMuonClustersOnTrack.h" #include "MuonRIO_OnTrack/MdtDriftCircleOnTrack.h" -#include "MuonRecHelperTools/IMuonEDMHelperSvc.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" -#include "MuonRecToolInterfaces/IMdtDriftCircleOnTrackCreator.h" #include "TrkDetDescrInterfaces/ITrackingVolumesSvc.h" #include "TrkEventPrimitives/DriftCircleSide.h" -#include "TrkFitterInterfaces/ITrackFitter.h" #include "TrkGeometry/TrackingVolume.h" #include "TrkGeometry/TrackingGeometry.h" #include "TrkMaterialOnTrack/EnergyLoss.h" @@ -53,14 +49,9 @@ MuonTrackQuery::MuonTrackQuery (const std::string& type, const std::string& name, const IInterface* parent) : AthAlgTool (type, name, parent), - m_fitter (""), - m_idHelper ("Muon::MuonIdHelperTool/MuonIdHelperTool"), - m_mdtRotCreator ("Muon::MdtDriftCircleOnTrackCreator/MdtDriftCircleOnTrackCreator"), m_trackingGeometrySvc ("TrackingGeometrySvc/AtlasTrackingGeometrySvc",name) { declareInterface<IMuonTrackQuery>(this); - declareProperty("Fitter", m_fitter); - declareProperty("MdtRotCreator", m_mdtRotCreator); declareProperty( "TrackingGeometrySvc", m_trackingGeometrySvc); } @@ -98,14 +89,14 @@ MuonTrackQuery::initialize() { ATH_MSG_DEBUG( "Retrieved tool " << m_edmHelperSvc ); } - if (m_idHelper.retrieve().isFailure()) + if (m_muonIdHelperSvc.retrieve().isFailure()) { - ATH_MSG_FATAL( "Failed to retrieve tool " << m_idHelper ); + ATH_MSG_FATAL( "Failed to retrieve tool " << m_muonIdHelperSvc ); return StatusCode::FAILURE; } else { - ATH_MSG_DEBUG( "Retrieved tool " << m_idHelper ); + ATH_MSG_DEBUG( "Retrieved tool " << m_muonIdHelperSvc ); } // tools needed when flipping tracks to outgoing @@ -257,7 +248,7 @@ MuonTrackQuery::fieldIntegral (const Trk::Track& track) const && ! calorimeterVolume->inside((**s).trackParameters()->position())) { Identifier id = m_edmHelperSvc->getIdentifier(*(**s).measurementOnTrack()); - isPreciseHit = (id.is_valid() && ! m_idHelper->measuresPhi(id)); + isPreciseHit = (id.is_valid() && ! m_muonIdHelperSvc->measuresPhi(id)); } if (! (**s).materialEffectsOnTrack() && ! isPreciseHit) continue; @@ -1218,11 +1209,11 @@ MuonTrackQuery::spectrometerPhiQuality (const Trk::Track& track) const || ! (**s).trackParameters() || calorimeterVolume->inside((**s).trackParameters()->position())) continue; Identifier id = m_edmHelperSvc->getIdentifier(*(**s).measurementOnTrack()); - if (! id.is_valid() || ! m_idHelper->measuresPhi(id)) continue; + if (! id.is_valid() || ! m_muonIdHelperSvc->measuresPhi(id)) continue; // require phi measurement from CSC or CompetingROT if (! dynamic_cast<const Muon::CompetingMuonClustersOnTrack*>((**s).measurementOnTrack()) - && ! m_idHelper->isCsc(id)) continue; + && ! m_muonIdHelperSvc->isCsc(id)) continue; leadingPhiMeasurement = *s; break; } @@ -1238,7 +1229,7 @@ MuonTrackQuery::spectrometerPhiQuality (const Trk::Track& track) const || ! (**r).trackParameters()) continue; if (calorimeterVolume->inside((**r).trackParameters()->position())) break; Identifier id = m_edmHelperSvc->getIdentifier(*(**r).measurementOnTrack()); - if (! id.is_valid() || ! m_idHelper->measuresPhi(id)) continue; + if (! id.is_valid() || ! m_muonIdHelperSvc->measuresPhi(id)) continue; if (*r != leadingPhiMeasurement) trailingPhiMeasurement = *r; break; } diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/OutwardsCombinedMuonTrackBuilder.cxx b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/OutwardsCombinedMuonTrackBuilder.cxx index 107790a0e99a..6d2085a0e54e 100755 --- a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/OutwardsCombinedMuonTrackBuilder.cxx +++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/OutwardsCombinedMuonTrackBuilder.cxx @@ -18,12 +18,7 @@ #include <iomanip> #include "MuidTrackBuilder/OutwardsCombinedMuonTrackBuilder.h" - -#include "MuonRecToolInterfaces/IMuonTrackCleaner.h" -#include "MuonRecToolInterfaces/IMuonHoleRecoveryTool.h" -#include "MuonRecToolInterfaces/IMuonErrorOptimisationTool.h" #include "MuidInterfaces/ICombinedMuonTrackBuilder.h" -#include "TrkToolInterfaces/ITrackSummaryTool.h" #include "TrkTrack/Track.h" #include "TrkDetDescrInterfaces/ITrackingVolumesSvc.h" #include "TrkMaterialOnTrack/MaterialEffectsOnTrack.h" @@ -50,11 +45,6 @@ OutwardsCombinedMuonTrackBuilder::OutwardsCombinedMuonTrackBuilder (const std::s const std::string& name, const IInterface* parent) : AthAlgTool (type, name, parent), - m_cleaner (""), - m_fitter (""), - m_trackSummary (""), - m_muonHoleRecovery (""), - m_muonErrorOptimizer (""), m_trackingVolumesSvc ("TrackingVolumesSvc/TrackingVolumesSvc",name), m_calorimeterVolume (0), m_indetVolume (0), @@ -69,14 +59,9 @@ OutwardsCombinedMuonTrackBuilder::OutwardsCombinedMuonTrackBuilder (const std::s { declareInterface<ICombinedMuonTrackBuilder>(this); declareInterface<Trk::ITrackFitter>(this); - declareProperty("Cleaner", m_cleaner); - declareProperty("Fitter", m_fitter); - declareProperty("TrackSummaryTool", m_trackSummary); - declareProperty("MuonHoleRecovery", m_muonHoleRecovery); declareProperty("AllowCleanerVeto", m_allowCleanerVeto); declareProperty("CleanCombined", m_cleanCombined); declareProperty("RecoverCombined", m_recoverCombined); - declareProperty("MuonErrorOptimizer", m_muonErrorOptimizer); declareProperty("IDMS_xySigma" , m_IDMS_xySigma); declareProperty("IDMS_rzSigma" , m_IDMS_rzSigma); declareProperty("AddIDMSerrors", m_addIDMSerrors); -- GitLab From db73678c10af38b394044b6999efa2d0bad17b04 Mon Sep 17 00:00:00 2001 From: Pascal Boeschoten <pascal.boeschoten@cern.ch> Date: Tue, 3 Dec 2019 11:55:29 +0100 Subject: [PATCH 2/4] Use atomic for logging counters --- .../MuidTrackBuilder/MuidTrackBuilder/MuidMuonRecovery.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/MuidMuonRecovery.h b/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/MuidMuonRecovery.h index 35f7a3b38878..f6f6b4098e9c 100644 --- a/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/MuidMuonRecovery.h +++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/MuidMuonRecovery.h @@ -69,9 +69,9 @@ public: double m_pullCut; // counters - mutable unsigned int m_recoveryAttempts; - mutable unsigned int m_recoveryFitFailure; - mutable unsigned int m_recoverySuccess; + mutable std::atomic<unsigned int> m_recoveryAttempts; + mutable std::atomic<unsigned int> m_recoveryFitFailure; + mutable std::atomic<unsigned int> m_recoverySuccess; }; -- GitLab From 387106ce697d9d5c564bf0d02d496b7ffa425fb6 Mon Sep 17 00:00:00 2001 From: Pascal Boeschoten <pascal.boeschoten@cern.ch> Date: Thu, 5 Dec 2019 11:02:31 +0100 Subject: [PATCH 3/4] Revert making 2 tools private, were causing issues --- .../MuidTrackBuilder/src/CombinedMuonTrackBuilder.cxx | 4 ++-- .../MuonCombinedAlgs/src/MuonCombinedMuonCandidateAlg.cxx | 7 +++++-- .../MuonCombinedAlgs/src/MuonCombinedMuonCandidateAlg.h | 2 +- .../MuonCombinedBaseTools/src/MuonCandidateTool.cxx | 2 +- .../MuonCombinedBaseTools/src/MuonCombinedDebuggerTool.cxx | 2 +- .../MuonCombinedBaseTools/src/MuonCombinedFitTagTool.cxx | 2 +- 6 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackBuilder.cxx b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackBuilder.cxx index 383381f5d104..15db529fd48c 100755 --- a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackBuilder.cxx +++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackBuilder.cxx @@ -78,7 +78,7 @@ CombinedMuonTrackBuilder::CombinedMuonTrackBuilder (const std::string&type, : AthAlgTool (type, name, parent), m_caloEnergyParam ("Rec::MuidCaloEnergyTool/MuidCaloEnergyToolParam", this), m_caloTSOS ("Rec::MuidCaloTrackStateOnSurface/MuidCaloTrackStateOnSurface", this), - m_cleaner ("Muon::MuonTrackCleaner/MuidTrackCleaner", this), + m_cleaner ("Muon::MuonTrackCleaner/MuidTrackCleaner"), // Note: making this private crashes m_cscRotCreator ("", this), m_extrapolator ("Trk::Extrapolator/AtlasExtrapolator", this), m_fitter ("Trk::iPatFitter/iPatFitter", this), @@ -96,7 +96,7 @@ CombinedMuonTrackBuilder::CombinedMuonTrackBuilder (const std::string&type, m_printer ("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool", this), m_trackingGeometrySvc ("TrackingGeometrySvc/AtlasTrackingGeometrySvc",name), m_trackingVolumesSvc ("TrackingVolumesSvc/TrackingVolumesSvc",name), - m_trackQuery ("Rec::MuonTrackQuery/MuonTrackQuery", this), + m_trackQuery ("Rec::MuonTrackQuery/MuonTrackQuery"), // Note: making this private crashes m_trackSummary ("Trk::TrackSummaryTool/MuidTrackSummaryTool", this), m_materialUpdator ("Trk::TrkMaterialProviderTool/TrkMaterialProviderTool", this), m_allowCleanerVeto (true), diff --git a/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedMuonCandidateAlg.cxx b/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedMuonCandidateAlg.cxx index c9e5a802efbd..81879daf0935 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedMuonCandidateAlg.cxx +++ b/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedMuonCandidateAlg.cxx @@ -5,8 +5,11 @@ #include "MuonCombinedMuonCandidateAlg.h" MuonCombinedMuonCandidateAlg::MuonCombinedMuonCandidateAlg(const std::string& name, ISvcLocator* pSvcLocator): - AthAlgorithm(name,pSvcLocator) -{} + AthAlgorithm(name,pSvcLocator), + m_muonCandidateTool("MuonCombined::MuonCandidateTool/MuonCandidateTool", this) +{ + declareProperty("MuonCandidateTool", m_muonCandidateTool); +} MuonCombinedMuonCandidateAlg::~MuonCombinedMuonCandidateAlg() {} diff --git a/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedMuonCandidateAlg.h b/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedMuonCandidateAlg.h index 2a89ba830b05..337e33ea812f 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedMuonCandidateAlg.h +++ b/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedMuonCandidateAlg.h @@ -31,7 +31,7 @@ class MuonCombinedMuonCandidateAlg : public AthAlgorithm StatusCode finalize(); private: - ToolHandle<MuonCombined::IMuonCandidateTool> m_muonCandidateTool{this,"MuonCandidateTool","MuonCombined::MuonCandidateTool/MuonCandidateTool","Muon Candidate Tool"}; + ToolHandle<MuonCombined::IMuonCandidateTool> m_muonCandidateTool; SG::ReadHandleKey<xAOD::TrackParticleContainer> m_muonTrackParticleLocation{this,"MuonSpectrometerTrackParticleLocation","MuonSpectrometerTrackParticles","MS Track Particle collection"}; SG::WriteHandleKey<MuonCandidateCollection> m_candidateCollectionName{this,"MuonCandidateLocation","MuonCandidates","Muon candidate collection"}; SG::WriteHandleKey<TrackCollection> m_msOnlyTracks{this,"MSOnlyExtrapolatedTrackLocation","MSOnlyExtrapolatedMuonTracks","MS extrapolated muon tracks"}; diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCandidateTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCandidateTool.cxx index 4a555c6b5f5c..e3e5845b7051 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCandidateTool.cxx +++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCandidateTool.cxx @@ -24,7 +24,7 @@ namespace MuonCombined { MuonCandidateTool::MuonCandidateTool (const std::string& type, const std::string& name, const IInterface* parent) : AthAlgTool(type, name, parent), m_printer("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"), - m_trackBuilder("Rec::CombinedMuonTrackBuilder/CombinedMuonTrackBuilder"), + m_trackBuilder("Rec::CombinedMuonTrackBuilder/CombinedMuonTrackBuilder", this), m_trackExtrapolationTool("ExtrapolateMuonToIPTool/ExtrapolateMuonToIPTool"), m_ambiguityProcessor("Trk::TrackSelectionProcessorTool/MuonAmbiProcessor") { diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedDebuggerTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedDebuggerTool.cxx index cee37f518a51..f99dca5c642a 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedDebuggerTool.cxx +++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedDebuggerTool.cxx @@ -31,7 +31,7 @@ namespace MuonCombined { MuonCombinedDebuggerTool::MuonCombinedDebuggerTool (const std::string& type, const std::string& name, const IInterface* parent) : AthAlgTool(type, name, parent), - m_matchQuality("Rec::MuonMatchQuality/MuonMatchQuality"), + m_matchQuality("Rec::MuonMatchQuality/MuonMatchQuality", this), m_truthToTrack("Trk::TruthToTrack/TruthToTrack"), m_histSvc("THistSvc", name), m_recoTree(0) diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedFitTagTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedFitTagTool.cxx index d5c5a1e087b1..27432daa9d01 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedFitTagTool.cxx +++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedFitTagTool.cxx @@ -55,7 +55,7 @@ namespace MuonCombined { m_trackQuery("Rec::MuonTrackQuery/MuonTrackQuery"), m_momentumBalanceTool("Rec::MuonMomentumBalanceSignificanceTool/MuonMomentumBalanceSignifTool"), m_muonRecovery(""), - m_matchQuality("Rec::MuonMatchQuality/MuonMatchQuality"), + m_matchQuality("Rec::MuonMatchQuality/MuonMatchQuality", this), m_trackScoringTool("Muon::MuonTrackScoringTool/MuonTrackScoringTool"), m_magFieldSvc("AtlasFieldSvc",name), m_DetID(0) -- GitLab From d3977113edb8384296e27ccabd3a16e4b60ad5c8 Mon Sep 17 00:00:00 2001 From: Pascal Boeschoten <pascal.boeschoten@cern.ch> Date: Mon, 9 Dec 2019 11:49:49 +0100 Subject: [PATCH 4/4] Use private tools in CombinedMuonTrackBuilder --- .../MuidTrackBuilder/src/CombinedMuonTrackBuilder.cxx | 4 ++-- .../MuonCombinedRecExample/python/MuonCombinedFitTools.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackBuilder.cxx b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackBuilder.cxx index 15db529fd48c..383381f5d104 100755 --- a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackBuilder.cxx +++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackBuilder.cxx @@ -78,7 +78,7 @@ CombinedMuonTrackBuilder::CombinedMuonTrackBuilder (const std::string&type, : AthAlgTool (type, name, parent), m_caloEnergyParam ("Rec::MuidCaloEnergyTool/MuidCaloEnergyToolParam", this), m_caloTSOS ("Rec::MuidCaloTrackStateOnSurface/MuidCaloTrackStateOnSurface", this), - m_cleaner ("Muon::MuonTrackCleaner/MuidTrackCleaner"), // Note: making this private crashes + m_cleaner ("Muon::MuonTrackCleaner/MuidTrackCleaner", this), m_cscRotCreator ("", this), m_extrapolator ("Trk::Extrapolator/AtlasExtrapolator", this), m_fitter ("Trk::iPatFitter/iPatFitter", this), @@ -96,7 +96,7 @@ CombinedMuonTrackBuilder::CombinedMuonTrackBuilder (const std::string&type, m_printer ("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool", this), m_trackingGeometrySvc ("TrackingGeometrySvc/AtlasTrackingGeometrySvc",name), m_trackingVolumesSvc ("TrackingVolumesSvc/TrackingVolumesSvc",name), - m_trackQuery ("Rec::MuonTrackQuery/MuonTrackQuery"), // Note: making this private crashes + m_trackQuery ("Rec::MuonTrackQuery/MuonTrackQuery", this), m_trackSummary ("Trk::TrackSummaryTool/MuidTrackSummaryTool", this), m_materialUpdator ("Trk::TrkMaterialProviderTool/TrkMaterialProviderTool", this), m_allowCleanerVeto (true), diff --git a/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedFitTools.py b/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedFitTools.py index 16734be40f7f..8d085059a58d 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedFitTools.py +++ b/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedFitTools.py @@ -270,6 +270,7 @@ def CombinedMuonTrackBuilder( name='CombinedMuonTrackBuilder', **kwargs ): kwargs.setdefault("CaloEnergyParam" , getPublicTool("MuidCaloEnergyToolParam") ) kwargs.setdefault("CaloTSOS" , getPublicTool("MuidCaloTrackStateOnSurface") ) kwargs.setdefault("CscRotCreator" , (getPublicTool("CscClusterOnTrackCreator") if MuonGeometryFlags.hasCSC() else "") ) + kwargs.setdefault("Cleaner" , getTool("MuidTrackCleaner") ) kwargs.setdefault("Fitter" , getPublicTool("iPatFitter") ) kwargs.setdefault("SLFitter" , getPublicTool("iPatSLFitter") ) kwargs.setdefault("MaterialAllocator" , getPublicTool("MuidMaterialAllocator") ) @@ -288,6 +289,7 @@ def CombinedMuonTrackBuilder( name='CombinedMuonTrackBuilder', **kwargs ): kwargs.setdefault("Vertex3DSigmaZ" , 60.*mm) kwargs.setdefault("UseCaloTG" , True ) # kwargs.setdefault("CaloMaterialProvider" , getPublicTool("MuonMaterialProviderTool")) + kwargs.setdefault("TrackQuery" , getTool("MuonTrackQuery") ) if TriggerFlags.MuonSlice.doTrigMuonConfig: kwargs.setdefault("MuonHoleRecovery" , "" ) -- GitLab