From 500bead6f890203d77e54b290fe23a9cfdaaf7c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20K=C3=B6hler?= Date: Wed, 1 Jul 2020 15:36:39 +0200 Subject: [PATCH 1/3] make functions called in execute const --- .../IMuonRecoValidationTool.h | 18 ++++++------- .../src/MuonRecoValidationTool.cxx | 16 ++++++------ .../src/MuonRecoValidationTool.h | 26 ++++++++++--------- .../src/MuonCaloTagTool.cxx | 14 ++++------ .../src/MuonCaloTagTool.h | 12 ++++----- .../IMuonCombinedInDetExtensionTool.h | 9 +++---- .../IMuonCombinedTrigCaloTagExtensionTool.h | 7 ++--- .../src/MuonInsideOutRecoTool.cxx | 12 ++++----- .../src/MuonInsideOutRecoTool.h | 12 ++++----- .../src/MuonStauRecoTool.cxx | 24 ++++++++--------- .../src/MuonStauRecoTool.h | 24 ++++++++--------- 11 files changed, 83 insertions(+), 91 deletions(-) diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces/MuonRecToolInterfaces/IMuonRecoValidationTool.h b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces/MuonRecToolInterfaces/IMuonRecoValidationTool.h index 33fface4a89..f461de8c9b0 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces/MuonRecToolInterfaces/IMuonRecoValidationTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces/MuonRecToolInterfaces/IMuonRecoValidationTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUON_IMUONRECOVALIDATIONTOOL_H @@ -40,30 +40,30 @@ namespace Muon { static const InterfaceID& interfaceID() { return IID_IMuonRecoValidationTool; } /** add a new TrackParticle with it's muon system extension */ - virtual bool addTrackParticle( const xAOD::TrackParticle& indetTrackParticle, const MuonSystemExtension& muonSystemExtention ) = 0; + virtual bool addTrackParticle( const xAOD::TrackParticle& indetTrackParticle, const MuonSystemExtension& muonSystemExtention ) const = 0; /** add a new segment, indicate the stage of the reco */ - virtual bool add( const MuonSystemExtension::Intersection& intersection, const MuonSegment& segment, int stage ) = 0; + virtual bool add( const MuonSystemExtension::Intersection& intersection, const MuonSegment& segment, int stage ) const = 0; /** add a new hough maximum */ - virtual bool add( const MuonSystemExtension::Intersection& intersection,const MuonHough::MuonLayerHough::Maximum& maximum ) = 0; + virtual bool add( const MuonSystemExtension::Intersection& intersection,const MuonHough::MuonLayerHough::Maximum& maximum ) const = 0; /** add a new prd */ - virtual bool add( const MuonSystemExtension::Intersection& intersection, const Trk::PrepRawData& prd, float expos, float expos_err ) = 0; + virtual bool add( const MuonSystemExtension::Intersection& intersection, const Trk::PrepRawData& prd, float expos, float expos_err ) const = 0; /** add a new time measurement */ - virtual bool addTimeMeasurement( const MuonSystemExtension::Intersection& intersection, const Trk::MeasurementBase& meas ) = 0; + virtual bool addTimeMeasurement( const MuonSystemExtension::Intersection& intersection, const Trk::MeasurementBase& meas ) const = 0; /** add a new time measurement */ virtual bool addTimeMeasurement( const MuonSystemExtension::Intersection& intersection, const Identifier& id, - const Amg::Vector3D& gpos, float time, float errorTime ) = 0; + const Amg::Vector3D& gpos, float time, float errorTime ) const = 0; /** add new MuonCandidate */ virtual bool addMuonCandidate( const xAOD::TrackParticle& indetTrackParticle, const MuonCandidate* candidate, - Trk::Track* combinedTrack, int ntimes, float beta, float chi2ndof, int stage ) = 0; + Trk::Track* combinedTrack, int ntimes, float beta, float chi2ndof, int stage ) const = 0; /** add StauHits to ntuple */ - virtual bool addTimeMeasurements( const xAOD::TrackParticle& indetTrackParticle, const MuGirlNS::StauHits& stauHits ) = 0; + virtual bool addTimeMeasurements( const xAOD::TrackParticle& indetTrackParticle, const MuGirlNS::StauHits& stauHits ) const = 0; }; diff --git a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonRecoValidationTool.cxx b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonRecoValidationTool.cxx index 48a2dedcfb5..aebf76ece8b 100644 --- a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonRecoValidationTool.cxx +++ b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonRecoValidationTool.cxx @@ -103,7 +103,7 @@ namespace Muon { } bool MuonRecoValidationTool::addTrackParticle( const xAOD::TrackParticle& indetTrackParticle, - const MuonSystemExtension& muonSystemExtension ) { + const MuonSystemExtension& muonSystemExtension ) const { m_ntuple.trackParticleBlock.pt->push_back(indetTrackParticle.pt()); m_ntuple.trackParticleBlock.p->push_back(1./indetTrackParticle.qOverP()); @@ -172,7 +172,7 @@ namespace Muon { return barcode; } - bool MuonRecoValidationTool::addTimeMeasurements( const xAOD::TrackParticle& indetTrackParticle, const MuGirlNS::StauHits& stauHits ) { + bool MuonRecoValidationTool::addTimeMeasurements( const xAOD::TrackParticle& indetTrackParticle, const MuGirlNS::StauHits& stauHits ) const { Muon::MuonBetaCalculationUtils muonBetaCalculationUtils; @@ -211,7 +211,7 @@ namespace Muon { } bool MuonRecoValidationTool::addTimeMeasurement( const MuonSystemExtension::Intersection& intersection, const Identifier& id, - const Amg::Vector3D& gpos, float time, float errorTime ) { + const Amg::Vector3D& gpos, float time, float errorTime ) const { // track index m_ntuple.timeBlock.track.fill(getIndex(intersection)); @@ -234,7 +234,7 @@ namespace Muon { } - bool MuonRecoValidationTool::addTimeMeasurement( const MuonSystemExtension::Intersection& intersection, const Trk::MeasurementBase& meas ) { + bool MuonRecoValidationTool::addTimeMeasurement( const MuonSystemExtension::Intersection& intersection, const Trk::MeasurementBase& meas ) const { float segmentTimeCorrection = 0.; @@ -313,7 +313,7 @@ namespace Muon { } - bool MuonRecoValidationTool::add( const MuonSystemExtension::Intersection& intersection, const MuonSegment& segment, int stage ) { + bool MuonRecoValidationTool::add( const MuonSystemExtension::Intersection& intersection, const MuonSegment& segment, int stage ) const { m_ntuple.segmentBlock.stage->push_back(stage); @@ -394,7 +394,7 @@ namespace Muon { } bool MuonRecoValidationTool::add( const MuonSystemExtension::Intersection& intersection, - const MuonHough::MuonLayerHough::Maximum& maximum ) { + const MuonHough::MuonLayerHough::Maximum& maximum ) const { m_ntuple.houghBlock.maximum->push_back(maximum.max); @@ -437,7 +437,7 @@ namespace Muon { } bool MuonRecoValidationTool::add( const MuonSystemExtension::Intersection& intersection, const Trk::PrepRawData& prd, - float expos, float expos_err ) { + float expos, float expos_err ) const { Identifier id = prd.identify(); m_ntuple.hitBlock.id.fill(m_idHelperSvc->sector(id),m_idHelperSvc->chamberIndex(id)); @@ -482,7 +482,7 @@ namespace Muon { } bool MuonRecoValidationTool::addMuonCandidate( const xAOD::TrackParticle& indetTrackParticle, const MuonCandidate* candidate, - Trk::Track* combinedTrack, int ntimes, float beta, float chi2ndof, int stage ) { + Trk::Track* combinedTrack, int ntimes, float beta, float chi2ndof, int stage ) const { auto pos = std::find(m_trackParticles.begin(),m_trackParticles.end(),&indetTrackParticle); if( pos == m_trackParticles.end() ) { diff --git a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonRecoValidationTool.h b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonRecoValidationTool.h index 78b6eff9b99..db95bb7b9c3 100644 --- a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonRecoValidationTool.h +++ b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonRecoValidationTool.h @@ -30,6 +30,8 @@ #include "MuonRecToolInterfaces/IMuonHitSummaryTool.h" #include +#include + class TTree; class TFile; class IIncidentSvc; @@ -55,30 +57,30 @@ namespace Muon { virtual StatusCode initialize() override; /** add a new TrackParticle with it's muon system extension */ - bool addTrackParticle( const xAOD::TrackParticle& indetTrackParticle, const MuonSystemExtension& muonSystemExtention ) override; + bool addTrackParticle( const xAOD::TrackParticle& indetTrackParticle, const MuonSystemExtension& muonSystemExtention ) const override; /** add a new segment */ - bool add( const MuonSystemExtension::Intersection& intersection, const MuonSegment& segment, int stage ) override; + bool add( const MuonSystemExtension::Intersection& intersection, const MuonSegment& segment, int stage ) const override; /** add a new hough maximum */ - bool add( const MuonSystemExtension::Intersection& intersection, const MuonHough::MuonLayerHough::Maximum& maximum ) override; + bool add( const MuonSystemExtension::Intersection& intersection, const MuonHough::MuonLayerHough::Maximum& maximum ) const override; /** add a new prd */ - bool add( const MuonSystemExtension::Intersection& intersection, const Trk::PrepRawData& prd, float expos, float expos_err ) override; + bool add( const MuonSystemExtension::Intersection& intersection, const Trk::PrepRawData& prd, float expos, float expos_err ) const override; /** add a new time measurement */ - bool addTimeMeasurement( const MuonSystemExtension::Intersection& intersection, const Trk::MeasurementBase& meas ) override; + bool addTimeMeasurement( const MuonSystemExtension::Intersection& intersection, const Trk::MeasurementBase& meas ) const override; /** add a new time measurement */ bool addTimeMeasurement( const MuonSystemExtension::Intersection& intersection, const Identifier& id, - const Amg::Vector3D& gpos, float time, float errorTime ) override; + const Amg::Vector3D& gpos, float time, float errorTime ) const override; /** add StauHits to ntuple */ - bool addTimeMeasurements( const xAOD::TrackParticle& indetTrackParticle, const MuGirlNS::StauHits& stauHits ) override; + bool addTimeMeasurements( const xAOD::TrackParticle& indetTrackParticle, const MuGirlNS::StauHits& stauHits ) const override; /** add a new muon candidate */ bool addMuonCandidate( const xAOD::TrackParticle& indetTrackParticle, const MuonCandidate* candidate, - Trk::Track* combinedTrack, int ntimes, float beta, float chi2ndof, int stage ) override; + Trk::Track* combinedTrack, int ntimes, float beta, float chi2ndof, int stage ) const override; /** incident service handle for EndEvent */ virtual void handle(const Incident& inc) override; @@ -111,13 +113,13 @@ namespace Muon { ToolHandle m_hitTimingTool; ServiceHandle< IIncidentSvc > m_incidentSvc; - std::vector m_trackParticles; - std::map< const Trk::TrackParameters*, unsigned int > m_trackParticleIndexLookup; + mutable std::vector m_trackParticles; + mutable std::map< const Trk::TrackParameters*, unsigned int > m_trackParticleIndexLookup; - MuonInsideOutValidationNtuple m_ntuple; + mutable MuonInsideOutValidationNtuple m_ntuple; TTree* m_tree; - unsigned int m_candidateCounter; + mutable std::atomic m_candidateCounter; bool m_isMC; }; diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCaloTagTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCaloTagTool.cxx index 9dfdec55092..fd774dea9fb 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCaloTagTool.cxx +++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCaloTagTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////////////////// @@ -87,10 +87,6 @@ namespace MuonCombined { declareProperty("TrackSelectorTool", m_trkSelTool ); } - MuonCaloTagTool::~MuonCaloTagTool() - {} - - StatusCode MuonCaloTagTool::initialize() { ATH_MSG_INFO("MuonCaloTagTool::initialize()"); @@ -127,14 +123,14 @@ namespace MuonCombined { } void MuonCaloTagTool::extendWithPRDs( const InDetCandidateCollection& inDetCandidates, InDetCandidateToTagMap* tagMap, IMuonCombinedInDetExtensionTool::MuonPrdData prdData, - TrackCollection* combTracks, TrackCollection* meTracks, Trk::SegmentCollection* segments) { + TrackCollection* combTracks, TrackCollection* meTracks, Trk::SegmentCollection* segments) const { //shouldn't need this interface for this tool, I don't think if(!prdData.mdtPrds) ATH_MSG_DEBUG("calo-tagging doesn't need PRDs"); extend(inDetCandidates, tagMap, combTracks, meTracks, segments); } void MuonCaloTagTool::extend( const InDetCandidateCollection& inDetCandidates, InDetCandidateToTagMap* tagMap, TrackCollection* combTracks, TrackCollection* meTracks, - Trk::SegmentCollection* segments) { + Trk::SegmentCollection* segments) const { if(combTracks || meTracks || segments) ATH_MSG_DEBUG("track collections passed to MuonCaloTagTool?"); const xAOD::CaloClusterContainer* caloClusterCont=0; @@ -156,7 +152,7 @@ namespace MuonCombined { void MuonCaloTagTool::extend( const InDetCandidateCollection& inDetCandidates, InDetCandidateToTagMap* tagMap, const CaloCellContainer* caloCellCont, - const xAOD::CaloClusterContainer* caloClusterCont) { + const xAOD::CaloClusterContainer* caloClusterCont) const { // --- Retrieve primary vertex (not retrieving for now) --- @@ -332,7 +328,7 @@ namespace MuonCombined { // applyTrackIsolation check - bool MuonCaloTagTool::applyTrackIsolation(const xAOD::TrackParticle& tp ) { + bool MuonCaloTagTool::applyTrackIsolation(const xAOD::TrackParticle& tp ) const { if( m_trackIsolationTool.empty() ) return true; diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCaloTagTool.h b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCaloTagTool.h index 3abeba78a87..f8f0288a34f 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCaloTagTool.h +++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCaloTagTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONCOMBINEDBASETOOLS_MUONCALOTAGTOOL_H @@ -43,7 +43,7 @@ namespace MuonCombined { public: MuonCaloTagTool(const std::string& type, const std::string& name, const IInterface* parent); - virtual ~MuonCaloTagTool(void); // destructor + virtual ~MuonCaloTagTool()=default; virtual StatusCode initialize() override; virtual StatusCode finalize() override; @@ -51,15 +51,15 @@ namespace MuonCombined { /**IMuonCombinedInDetExtensionTool interface: extend ID candidate */ virtual void extend( const InDetCandidateCollection& inDetCandidates, InDetCandidateToTagMap* tagMap, TrackCollection* combTracks, TrackCollection* meTracks, - Trk::SegmentCollection* segments ) override; + Trk::SegmentCollection* segments ) const override; virtual void extend( const InDetCandidateCollection& inDetCandidates, InDetCandidateToTagMap* tagMap, const CaloCellContainer* caloCellContainer, - const xAOD::CaloClusterContainer* caloClusterContainer) override; + const xAOD::CaloClusterContainer* caloClusterContainer) const override; virtual void extendWithPRDs(const InDetCandidateCollection& inDetCandidates, InDetCandidateToTagMap* tagMap, IMuonCombinedInDetExtensionTool::MuonPrdData prdData, - TrackCollection* combTracks, TrackCollection* meTracks, Trk::SegmentCollection* segments) override; + TrackCollection* combTracks, TrackCollection* meTracks, Trk::SegmentCollection* segments) const override; private: @@ -68,7 +68,7 @@ namespace MuonCombined { const Trk::TrackParameters* getTrackParameters(const Trk::Track* trk) const; bool selectTrack(const Trk::Track* trk, const Trk::Vertex* vertex) const; bool selectCosmic(const Trk::Track* ptcl) const; - bool applyTrackIsolation(const xAOD::TrackParticle& tp); + bool applyTrackIsolation(const xAOD::TrackParticle& tp) const; void showTrackInfo(const Trk::TrackParameters* par) const; // --- StoreGate keys --- diff --git a/Reconstruction/MuonIdentification/MuonCombinedToolInterfaces/MuonCombinedToolInterfaces/IMuonCombinedInDetExtensionTool.h b/Reconstruction/MuonIdentification/MuonCombinedToolInterfaces/MuonCombinedToolInterfaces/IMuonCombinedInDetExtensionTool.h index c1fb1c04bc0..5f6499ea4d5 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedToolInterfaces/MuonCombinedToolInterfaces/IMuonCombinedInDetExtensionTool.h +++ b/Reconstruction/MuonIdentification/MuonCombinedToolInterfaces/MuonCombinedToolInterfaces/IMuonCombinedInDetExtensionTool.h @@ -1,10 +1,7 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// IMuonCombinedInDetExtensionTool.h, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// #ifndef IRECMUONCOMBINEDINDETEXTENSIONTOOL_H #define IRECMUONCOMBINEDINDETEXTENSIONTOOL_H @@ -44,11 +41,11 @@ namespace MuonCombined { /**IMuonCombinedInDetExtensionTool interface: build combined muons from ID candidates */ virtual void extend( const InDetCandidateCollection& inDetCandidates, InDetCandidateToTagMap* tagMap, TrackCollection* combTracks, TrackCollection* meTracks, - Trk::SegmentCollection* segments) = 0; + Trk::SegmentCollection* segments) const = 0; /*New interface including PRDs for MuGirl segment-finding*/ virtual void extendWithPRDs( const InDetCandidateCollection& inDetCandidates, InDetCandidateToTagMap* tagMap, IMuonCombinedInDetExtensionTool::MuonPrdData prdData, - TrackCollection* combTracks, TrackCollection* meTracks, Trk::SegmentCollection* segments) =0; + TrackCollection* combTracks, TrackCollection* meTracks, Trk::SegmentCollection* segments) const = 0; }; diff --git a/Reconstruction/MuonIdentification/MuonCombinedToolInterfaces/MuonCombinedToolInterfaces/IMuonCombinedTrigCaloTagExtensionTool.h b/Reconstruction/MuonIdentification/MuonCombinedToolInterfaces/MuonCombinedToolInterfaces/IMuonCombinedTrigCaloTagExtensionTool.h index 02df646747f..b23288c1793 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedToolInterfaces/MuonCombinedToolInterfaces/IMuonCombinedTrigCaloTagExtensionTool.h +++ b/Reconstruction/MuonIdentification/MuonCombinedToolInterfaces/MuonCombinedToolInterfaces/IMuonCombinedTrigCaloTagExtensionTool.h @@ -1,10 +1,7 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// IMuonCombinedTrigCaloTagExtensionTool.h, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// #ifndef IRECMUONCOMBINEDTRIGCALOTAGEXTENSIONTOOL_H #define IRECMUONCOMBINEDTRIGCALOTAGEXTENSIONTOOL_H @@ -32,7 +29,7 @@ namespace MuonCombined { /**IMuonCombinedTrigCaloTagExtensionTool interface: build combined muons from ID and MS candidates */ virtual void extend( const InDetCandidateCollection& inDetCandidates, InDetCandidateToTagMap* tagMap, const CaloCellContainer* caloCellCont = nullptr, - const xAOD::CaloClusterContainer* caloClusterCont = nullptr ) = 0; + const xAOD::CaloClusterContainer* caloClusterCont = nullptr ) const = 0; }; inline const InterfaceID& IMuonCombinedTrigCaloTagExtensionTool::interfaceID() diff --git a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonInsideOutRecoTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonInsideOutRecoTool.cxx index 7ab4011849c..5270c846178 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonInsideOutRecoTool.cxx +++ b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonInsideOutRecoTool.cxx @@ -62,14 +62,14 @@ namespace MuonCombined { } void MuonInsideOutRecoTool::extend( const InDetCandidateCollection& inDetCandidates, InDetCandidateToTagMap* tagMap, TrackCollection* combTracks, TrackCollection* meTracks, - Trk::SegmentCollection* segments) { + Trk::SegmentCollection* segments) const { ATH_MSG_WARNING("This version is deprecated, please use extendWithPRDs for MuGirl"); IMuonCombinedInDetExtensionTool::MuonPrdData prdData; extendWithPRDs(inDetCandidates,tagMap,prdData,combTracks,meTracks,segments); } void MuonInsideOutRecoTool::extendWithPRDs( const InDetCandidateCollection& inDetCandidates, InDetCandidateToTagMap* tagMap, IMuonCombinedInDetExtensionTool::MuonPrdData prdData, - TrackCollection* combTracks, TrackCollection* meTracks, Trk::SegmentCollection* segments) { + TrackCollection* combTracks, TrackCollection* meTracks, Trk::SegmentCollection* segments) const { ATH_MSG_DEBUG(" extending " << inDetCandidates.size() ); InDetCandidateCollection::const_iterator it = inDetCandidates.begin(); @@ -80,7 +80,7 @@ namespace MuonCombined { } void MuonInsideOutRecoTool::handleCandidate( const InDetCandidate& indetCandidate, InDetCandidateToTagMap* tagMap, IMuonCombinedInDetExtensionTool::MuonPrdData prdData, - TrackCollection* combTracks, TrackCollection* meTracks, Trk::SegmentCollection* segColl) { + TrackCollection* combTracks, TrackCollection* meTracks, Trk::SegmentCollection* segColl) const { if( m_ignoreSiAssocated && indetCandidate.isSiliconAssociated() ) { ATH_MSG_DEBUG(" skip silicon associated track for extension "); @@ -163,7 +163,7 @@ namespace MuonCombined { std::pair,Trk::Track*> - MuonInsideOutRecoTool::findBestCandidate( const xAOD::TrackParticle& indetTrackParticle, const std::vector< Muon::MuonLayerRecoData >& allLayers) { + MuonInsideOutRecoTool::findBestCandidate( const xAOD::TrackParticle& indetTrackParticle, const std::vector< Muon::MuonLayerRecoData >& allLayers) const { // resolve ambiguities std::vector< Muon::MuonCandidate > resolvedCandidates; @@ -298,7 +298,7 @@ namespace MuonCombined { } bool MuonInsideOutRecoTool::getLayerData( int sector, Muon::MuonStationIndex::DetectorRegionIndex regionIndex, - Muon::MuonStationIndex::LayerIndex layerIndex, Muon::MuonLayerPrepRawData& layerPrepRawData, IMuonCombinedInDetExtensionTool::MuonPrdData prdData){ + Muon::MuonStationIndex::LayerIndex layerIndex, Muon::MuonLayerPrepRawData& layerPrepRawData, IMuonCombinedInDetExtensionTool::MuonPrdData prdData) const { // get technologies in the given layer Muon::MuonStationIndex::StIndex stIndex = Muon::MuonStationIndex::toStationIndex( regionIndex, layerIndex ); @@ -337,7 +337,7 @@ namespace MuonCombined { template bool MuonInsideOutRecoTool::getLayerDataTech( int sector, Muon::MuonStationIndex::TechnologyIndex technology, Muon::MuonStationIndex::DetectorRegionIndex regionIndex, - Muon::MuonStationIndex::LayerIndex layerIndex, const Muon::MuonPrepDataContainer< COL >* input, std::vector& output ) { + Muon::MuonStationIndex::LayerIndex layerIndex, const Muon::MuonPrepDataContainer< COL >* input, std::vector& output ) const { if(!input || input->size()==0) return true; typedef Muon::MuonPrepDataContainer< COL > ContainerType; diff --git a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonInsideOutRecoTool.h b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonInsideOutRecoTool.h index ae0b0aed3d7..c49809fec9d 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonInsideOutRecoTool.h +++ b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonInsideOutRecoTool.h @@ -57,20 +57,20 @@ namespace MuonCombined { /**IMuonCombinedInDetExtensionTool interface: extend ID candidate with PRDs for segment-finding */ virtual void extendWithPRDs( const InDetCandidateCollection& inDetCandidates, InDetCandidateToTagMap* tagMap, IMuonCombinedInDetExtensionTool::MuonPrdData prdData, - TrackCollection* combTracks, TrackCollection* meTracks, Trk::SegmentCollection* segments) override; + TrackCollection* combTracks, TrackCollection* meTracks, Trk::SegmentCollection* segments) const override; /**IMuonCombinedInDetExtensionTool interface: deprecated*/ virtual void extend(const InDetCandidateCollection& inDetCandidates, InDetCandidateToTagMap* tagMap, TrackCollection* combTracks, TrackCollection* meTracks, - Trk::SegmentCollection* segments) override; + Trk::SegmentCollection* segments) const override; /** find the best candidate for a given set of segments */ std::pair,Trk::Track*> - findBestCandidate( const xAOD::TrackParticle& indetTrackParticle, const std::vector< Muon::MuonLayerRecoData >& allLayers); + findBestCandidate( const xAOD::TrackParticle& indetTrackParticle, const std::vector< Muon::MuonLayerRecoData >& allLayers) const; private: /** handle a single candidate */ void handleCandidate( const InDetCandidate& inDetCandidate, InDetCandidateToTagMap* tagMap, IMuonCombinedInDetExtensionTool::MuonPrdData prdData, - TrackCollection* combTracks, TrackCollection* meTracks, Trk::SegmentCollection* segments); + TrackCollection* combTracks, TrackCollection* meTracks, Trk::SegmentCollection* segments) const; /** add muon candidate to indet candidate */ void addTag( const InDetCandidate& indetCandidate, InDetCandidateToTagMap* tagMap, @@ -78,12 +78,12 @@ namespace MuonCombined { /** access data in layer */ bool getLayerData( int sector, Muon::MuonStationIndex::DetectorRegionIndex regionIndex, Muon::MuonStationIndex::LayerIndex layerIndex, - Muon::MuonLayerPrepRawData& layerPrepRawData, IMuonCombinedInDetExtensionTool::MuonPrdData prdData); + Muon::MuonLayerPrepRawData& layerPrepRawData, IMuonCombinedInDetExtensionTool::MuonPrdData prdData) const; /** access data in layer for a given technology */ template bool getLayerDataTech( int sector, Muon::MuonStationIndex::TechnologyIndex technology, Muon::MuonStationIndex::DetectorRegionIndex regionIndex, - Muon::MuonStationIndex::LayerIndex layerIndex, const Muon::MuonPrepDataContainer< COL >* input, std::vector& output ); + Muon::MuonStationIndex::LayerIndex layerIndex, const Muon::MuonPrepDataContainer< COL >* input, std::vector& output ) const; ServiceHandle m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; ToolHandle m_printer; diff --git a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonStauRecoTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonStauRecoTool.cxx index 7a27d5a23b3..9698375f4c2 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonStauRecoTool.cxx +++ b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonStauRecoTool.cxx @@ -115,7 +115,7 @@ namespace MuonCombined { } void MuonStauRecoTool::extendWithPRDs( const InDetCandidateCollection& inDetCandidates, InDetCandidateToTagMap* tagMap, IMuonCombinedInDetExtensionTool::MuonPrdData prdData, - TrackCollection* combTracks, TrackCollection* meTracks, Trk::SegmentCollection* segments) { + TrackCollection* combTracks, TrackCollection* meTracks, Trk::SegmentCollection* segments) const { // Maybe we'll need this later, I wouldn't be surprised if the PRDs are retrieved somewhere down the chain // For now it's just a placeholder though if(!prdData.mdtPrds) ATH_MSG_DEBUG("empty PRDs passed"); @@ -123,7 +123,7 @@ namespace MuonCombined { } void MuonStauRecoTool::extend( const InDetCandidateCollection& inDetCandidates, InDetCandidateToTagMap* tagMap, TrackCollection* combTracks, TrackCollection* meTracks, - Trk::SegmentCollection* segments) { + Trk::SegmentCollection* segments) const { ATH_MSG_DEBUG(" extending " << inDetCandidates.size() ); if(meTracks) ATH_MSG_DEBUG("Not currently creating ME tracks for staus"); @@ -148,7 +148,7 @@ namespace MuonCombined { } - void MuonStauRecoTool::handleCandidate( const InDetCandidate& indetCandidate, InDetCandidateToTagMap* tagMap, TrackCollection* combTracks, Trk::SegmentCollection* segments ) { + void MuonStauRecoTool::handleCandidate( const InDetCandidate& indetCandidate, InDetCandidateToTagMap* tagMap, TrackCollection* combTracks, Trk::SegmentCollection* segments ) const { if( m_ignoreSiAssocated && indetCandidate.isSiliconAssociated() ) { ATH_MSG_DEBUG(" skip silicon associated track for extension "); @@ -268,7 +268,7 @@ namespace MuonCombined { return refineCandidates(candidates); } - bool MuonStauRecoTool::refineCandidates( MuonStauRecoTool::CandidateVec& candidates ) { + bool MuonStauRecoTool::refineCandidates( MuonStauRecoTool::CandidateVec& candidates ) const { // keep track of candidates for which segments are found CandidateVec refinedCandidates; @@ -339,7 +339,7 @@ namespace MuonCombined { return !candidates.empty(); } - void MuonStauRecoTool::extractTimeMeasurementsFromTrack( MuonStauRecoTool::Candidate& candidate ) { + void MuonStauRecoTool::extractTimeMeasurementsFromTrack( MuonStauRecoTool::Candidate& candidate ) const { ATH_MSG_VERBOSE("extractTimeMeasurementsFromTrack for candidate: beta seed " << candidate.betaSeed.beta ); Trk::Track* combinedTrack = candidate.combinedTrack.get(); if( !combinedTrack ) return; @@ -811,7 +811,7 @@ namespace MuonCombined { } - bool MuonStauRecoTool::resolveAmbiguities( MuonStauRecoTool::CandidateVec& candidates ) { + bool MuonStauRecoTool::resolveAmbiguities( MuonStauRecoTool::CandidateVec& candidates ) const { ATH_MSG_DEBUG("Resolving ambiguities: candidates " << candidates.size()); @@ -860,7 +860,7 @@ namespace MuonCombined { - bool MuonStauRecoTool::combineCandidates( const xAOD::TrackParticle& indetTrackParticle, MuonStauRecoTool::CandidateVec& candidates ) { + bool MuonStauRecoTool::combineCandidates( const xAOD::TrackParticle& indetTrackParticle, MuonStauRecoTool::CandidateVec& candidates ) const { // keep track of candidates that have a successfull fit CandidateVec combinedCandidates; @@ -1056,7 +1056,7 @@ namespace MuonCombined { } bool MuonStauRecoTool::extractTimeMeasurements( const Muon::MuonSystemExtension& muonSystemExtension, - MuonStauRecoTool::AssociatedData& associatedData ) { + MuonStauRecoTool::AssociatedData& associatedData ) const { // get layer intersections const std::vector& layerIntersections = muonSystemExtension.layerIntersections(); @@ -1292,7 +1292,7 @@ namespace MuonCombined { } - void MuonStauRecoTool::extractRpcTimingFromMaximum( const Muon::MuonSystemExtension::Intersection& intersection, MaximumData& maximumData ) { + void MuonStauRecoTool::extractRpcTimingFromMaximum( const Muon::MuonSystemExtension::Intersection& intersection, MaximumData& maximumData ) const { // extract trigger hits per chamber const MuonHough::MuonLayerHough::Maximum& maximum = *maximumData.maximum; @@ -1344,7 +1344,7 @@ namespace MuonCombined { void MuonStauRecoTool::createRpcTimeMeasurementsFromClusters( const Muon::MuonSystemExtension::Intersection& intersection, const std::vector< Muon::RpcClusterObj>& clusterObjects, - MuonStauRecoTool::RpcTimeMeasurementVec& rpcTimeMeasurements ) { + MuonStauRecoTool::RpcTimeMeasurementVec& rpcTimeMeasurements ) const { // loop over the clusters for( auto& cluster : clusterObjects ){ @@ -1384,7 +1384,7 @@ namespace MuonCombined { } } - void MuonStauRecoTool::associateHoughMaxima( MuonStauRecoTool::LayerData& layerData ) { + void MuonStauRecoTool::associateHoughMaxima( MuonStauRecoTool::LayerData& layerData ) const { // get intersection and layer identifiers const Muon::MuonSystemExtension::Intersection& intersection = layerData.intersection; @@ -1497,7 +1497,7 @@ namespace MuonCombined { } } - void MuonStauRecoTool::addCandidatesToNtuple( const xAOD::TrackParticle& indetTrackParticle, const MuonStauRecoTool::CandidateVec& candidates, int stage ) { + void MuonStauRecoTool::addCandidatesToNtuple( const xAOD::TrackParticle& indetTrackParticle, const MuonStauRecoTool::CandidateVec& candidates, int stage ) const { if( m_recoValidationTool.empty() ) return; ATH_MSG_DEBUG("add candidates to ntuple, stage "<& clusterObjects, - RpcTimeMeasurementVec& rpcTimeMeasurements ); + RpcTimeMeasurementVec& rpcTimeMeasurements ) const; /** find segments for a given maximum */ void findSegments( const Muon::MuonSystemExtension::Intersection& intersection, MaximumData& maximumData, @@ -175,7 +175,7 @@ namespace MuonCombined { bool processMuonSystemExtension( const xAOD::TrackParticle& indetTrackParticle, const Muon::MuonSystemExtension& muonSystemExtension, CandidateVec& candidates ); /** associate Hough maxima and associate time measurements */ - bool extractTimeMeasurements( const Muon::MuonSystemExtension& muonSystemExtension, AssociatedData& associatedData ); + bool extractTimeMeasurements( const Muon::MuonSystemExtension& muonSystemExtension, AssociatedData& associatedData ) const; /** create candidates from the beta seeds */ bool createCandidates( const AssociatedData& associatedData, CandidateVec& candidates ) const; @@ -191,19 +191,19 @@ namespace MuonCombined { bool extractTimeHits( const MaximumData& maximumData, Muon::TimePointBetaFitter::HitVec& hits, const BetaSeed* seed=0 ) const; /** refine candidates: find segments for the given beta */ - bool refineCandidates( CandidateVec& candidates ); + bool refineCandidates( CandidateVec& candidates ) const; /** combine reconstruction */ - bool combineCandidates( const xAOD::TrackParticle& indetTrackParticle, CandidateVec& candidates ); + bool combineCandidates( const xAOD::TrackParticle& indetTrackParticle, CandidateVec& candidates ) const; /** resolve ambiguities between the candidates */ - bool resolveAmbiguities( CandidateVec& candidates ); + bool resolveAmbiguities( CandidateVec& candidates ) const; /** create final tag object and add it to the inDetCandidate */ void addTag( const InDetCandidate& inDetCandidate, Candidate& candidate, InDetCandidateToTagMap* tagMap, TrackCollection* combTracks, Trk::SegmentCollection* segments ) const; /** extract time measurements from the track associated with the candidate */ - void extractTimeMeasurementsFromTrack( Candidate& candidate ); + void extractTimeMeasurementsFromTrack( Candidate& candidate ) const; /** extract truth from the indetTrackParticle */ TruthInfo* getTruth( const xAOD::TrackParticle& indetTrackParticle ) const; @@ -216,7 +216,7 @@ namespace MuonCombined { } /** helper function to add Candidate to ntuple */ - void addCandidatesToNtuple( const xAOD::TrackParticle& indetTrackParticle, const CandidateVec& candidates, int stage ); + void addCandidatesToNtuple( const xAOD::TrackParticle& indetTrackParticle, const CandidateVec& candidates, int stage ) const; /** */ void mdtTimeCalibration( const Identifier& id, float& time, float& error ) const; -- GitLab From 092e49e23a957c2469e0337f5eb8b2ddedb2a531 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20K=C3=B6hler?= Date: Wed, 1 Jul 2020 15:40:22 +0200 Subject: [PATCH 2/3] add comment to MuonRecoValidationTool --- .../MuonTrackPerformance/src/MuonRecoValidationTool.h | 1 + .../MuonCombinedTrackFindingTools/src/MuonStauRecoTool.cxx | 3 +++ 2 files changed, 4 insertions(+) diff --git a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonRecoValidationTool.h b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonRecoValidationTool.h index db95bb7b9c3..be2742b9ac2 100644 --- a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonRecoValidationTool.h +++ b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonRecoValidationTool.h @@ -113,6 +113,7 @@ namespace Muon { ToolHandle m_hitTimingTool; ServiceHandle< IIncidentSvc > m_incidentSvc; + // the following members are supposed to be used in 1-thread debugging, thus, not in production and not with mutliple threads mutable std::vector m_trackParticles; mutable std::map< const Trk::TrackParameters*, unsigned int > m_trackParticleIndexLookup; diff --git a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonStauRecoTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonStauRecoTool.cxx index 9698375f4c2..aee3ed280b1 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonStauRecoTool.cxx +++ b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonStauRecoTool.cxx @@ -1498,6 +1498,9 @@ namespace MuonCombined { } void MuonStauRecoTool::addCandidatesToNtuple( const xAOD::TrackParticle& indetTrackParticle, const MuonStauRecoTool::CandidateVec& candidates, int stage ) const { + if (Gaudi::Concurrency::ConcurrencyFlags::numThreads()>1) { + ATH_MSG_WARNING("You are calling the non thread-safe MuonRecoValidationTool with multiple threads, will most likely crash"); + } if( m_recoValidationTool.empty() ) return; ATH_MSG_DEBUG("add candidates to ntuple, stage "< Date: Wed, 1 Jul 2020 20:21:33 +0200 Subject: [PATCH 3/3] add missing include --- .../MuonCombinedTrackFindingTools/src/MuonStauRecoTool.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonStauRecoTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonStauRecoTool.cxx index aee3ed280b1..33db0ccee67 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonStauRecoTool.cxx +++ b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonStauRecoTool.cxx @@ -9,6 +9,7 @@ #include "MuonRIO_OnTrack/RpcClusterOnTrack.h" #include "MuonRIO_OnTrack/CscClusterOnTrack.h" #include "MuonRIO_OnTrack/MuonDriftCircleErrorStrategy.h" +#include "GaudiKernel/ConcurrencyFlags.h" #include "TrkDriftCircleMath/DCSLFitter.h" #include "TrkDriftCircleMath/SegmentFinder.h" -- GitLab