From fed6a23663c44a2c6b98854fb1e65bc4abe2f621 Mon Sep 17 00:00:00 2001 From: Christos Anastopoulos <christos.anastopoulos@cern.ch> Date: Tue, 15 Sep 2020 11:10:46 +0000 Subject: [PATCH] Remove ATLAS_NOT_THREAD_SAFE ITrackSummaryTool methods --- .../TrkJiveXML/src/TrackRetriever.cxx | 44 ++-- .../src/TrackScoringTool.cxx | 42 +-- .../IExtendedTrackSummaryTool.h | 119 +++++---- .../TrkToolInterfaces/ITrackSummaryTool.h | 37 +-- .../TrkTrackSummaryTool/TrackSummaryTool.h | 241 ++++++++++-------- .../src/TrackSummaryTool.cxx | 123 +++++---- 6 files changed, 327 insertions(+), 279 deletions(-) diff --git a/Tracking/TrkEventCnv/TrkJiveXML/src/TrackRetriever.cxx b/Tracking/TrkEventCnv/TrkJiveXML/src/TrackRetriever.cxx index 825335a0022..d28539d5b50 100644 --- a/Tracking/TrkEventCnv/TrkJiveXML/src/TrackRetriever.cxx +++ b/Tracking/TrkEventCnv/TrkJiveXML/src/TrackRetriever.cxx @@ -30,7 +30,7 @@ // for residuals #include "TrkToolInterfaces/IResidualPullCalculator.h" -#include "TrkEventPrimitives/ResidualPull.h" +#include "TrkEventPrimitives/ResidualPull.h" // for detector id #include "AtlasDetDescr/AtlasDetectorID.h" @@ -47,8 +47,8 @@ namespace JiveXML { * out in the old format using @f$ \cot\theta @f$ and @f$ q/p_T @f$ * @return the perigee parameter object for further use */ - const Trk::Perigee* getPerigeeParameters( const Trk::Track* track, - DataVect& pt, DataVect& d0, DataVect& z0, DataVect& phi0, + const Trk::Perigee* getPerigeeParameters( const Trk::Track* track, + DataVect& pt, DataVect& d0, DataVect& z0, DataVect& phi0, DataVect& cotTheta, DataVect& covMatrix){ /** @@ -86,7 +86,7 @@ namespace JiveXML { double measuredQoverp = perigee->parameters()[Trk::qOverP]; const Trk::JacobianThetaPToCotThetaPt theJac( measuredTheta, measuredQoverp ); covVert = covariance->similarity(theJac); - }else{ + }else{ for ( int ii=0; ii<20; ii++){ // placeholder. Do this nicer. covVert(ii) = 0.; } @@ -97,7 +97,7 @@ namespace JiveXML { const long scale = 10000; const double thisScale(scale/100.); // Migration: Now only has diagonal elements from covariance matrix ? - covMatrix.push_back(DataType(covVert(0)*thisScale)); // 5 elements + covMatrix.push_back(DataType(covVert(0)*thisScale)); // 5 elements covMatrix.push_back(DataType(covVert(1)*thisScale)); covMatrix.push_back(DataType(covVert(2)*thisScale)); covMatrix.push_back(DataType(covVert(3)*thisScale)); @@ -114,7 +114,7 @@ namespace JiveXML { /** * Get a list of track-State on Surfaces for measurement and - * outlier hits, sorted using the perigee comparison functions + * outlier hits, sorted using the perigee comparison functions * @return a std::vector of Trk::TrackStateOnSurface* */ std::vector<const Trk::TrackStateOnSurface*> getTrackStateOnSurfaces( const Trk::Track* track, const Trk::Perigee* perigee, bool doHitsSorting){ @@ -170,8 +170,8 @@ namespace JiveXML { polylineY.push_back(DataType(pos.y()*onetenth)); polylineZ.push_back(DataType(pos.z()*onetenth)); ++numPoly; - } - } + } + } //Store counter as well numPolyline.push_back(DataType(numPoly)); } @@ -181,13 +181,13 @@ namespace JiveXML { * Retrieve all the basic hit information from the Trk::TrackStateOnSurface * @return the reconstruction input object (RIO) for further use */ - const Trk::RIO_OnTrack* getBaseInfoFromHit( const Trk::TrackStateOnSurface* tsos, const AtlasDetectorID* idHelper, + const Trk::RIO_OnTrack* getBaseInfoFromHit( const Trk::TrackStateOnSurface* tsos, const AtlasDetectorID* idHelper, DataVect& isOutlier, DataVect& hits, DataVect& driftSign, DataVect& tsosDetType){ //Get corresponding measurement const Trk::MeasurementBase *measurement = tsos->measurementOnTrack(); - //If measurement is invalid, return imediately + //If measurement is invalid, return imediately if ( ! measurement ) return nullptr ; // get RIO_OnTrack @@ -258,7 +258,7 @@ namespace JiveXML { double ResLoc1 = -99.; double ResLoc2 = -99.; double PullLoc1 = -99.; - double PullLoc2 = -99.; + double PullLoc2 = -99.; // get TrackParameters on the surface to calculate residual const Trk::TrackParameters* tsosParameters = tsos->trackParameters(); @@ -275,13 +275,13 @@ namespace JiveXML { const Trk::ResidualPull* residualPull = residualPullCalculator->residualPull(rot, tsosParameters,Trk::ResidualPull::Biased); if (residualPull) { - //Get the first residual + //Get the first residual ResLoc1 = residualPull->residual()[Trk::loc1]; //Get the second residual for more than 1 dimension if (residualPull->dimension() >= 2) ResLoc2 = residualPull->residual()[Trk::loc2]; if ((residualPull->isPullValid()) ) { - //Get the first residual + //Get the first residual PullLoc1 = residualPull->pull()[Trk::loc1]; //Get the second residual for more than 1 dimension if (residualPull->dimension() >= 2) PullLoc2 = residualPull->pull()[Trk::loc2]; @@ -289,11 +289,11 @@ namespace JiveXML { } // end if residualPull } // end if tsosParameters - //Finally store the values + //Finally store the values tsosResLoc1.push_back( ResLoc1 ); tsosResLoc2.push_back( ResLoc2 ); tsosPullLoc1.push_back( PullLoc1 ); - tsosPullLoc2.push_back( PullLoc2 ); + tsosPullLoc2.push_back( PullLoc2 ); } /** @@ -350,7 +350,7 @@ namespace JiveXML { declareProperty("TrackTruthColName" , m_TrackTruthCollection = "TrackTruthCollection", "Track collection from which to retrieve the truth associations for the priority track collection"); declareProperty("DoWriteHLT" , m_doWriteHLT = false, "Whether to write HLTAutoKey objects"); - declareProperty("DoWriteResiduals" , m_doWriteResiduals = true, "Whether to write TrackResiduals"); + declareProperty("DoWriteResiduals" , m_doWriteResiduals = true, "Whether to write TrackResiduals"); declareProperty("DoHitsSorting" , m_doHitsSorting = false, "Whether to sort hits (TrackStateOnSurfaces)"); declareProperty("DoHitsDetails" , m_doHitsDetails = true, "Whether to write hits details (TrackStateOnSurfaces)"); } @@ -397,7 +397,7 @@ namespace JiveXML { */ StatusCode TrackRetriever::retrieve(ToolHandle<IFormatTool> &FormatTool) { //be verbose - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieving " << dataTypeName() << endmsg; + if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieving " << dataTypeName() << endmsg; //Generate a list of requested track collections typedef std::pair< TrackCollection , std::string > tracksNamePair; std::vector< tracksNamePair > requestedTrackColls; @@ -498,7 +498,7 @@ namespace JiveXML { evtStore()->retrieve(truthCollection, collectionName+"Truth").ignore(); ATH_MSG_DEBUG( "Found TrackTruthCollection with key " << collectionName << "Truth" ); // No matching track truth collection found at all - } else { + } else { ATH_MSG_DEBUG( "Could not find matching TrackTruthCollection for " << collectionName ); truthCollection = nullptr ; } @@ -563,8 +563,8 @@ namespace JiveXML { /** * Get number of Pix/SCT/TRT hits */ - const Trk::TrackSummary* summary = nullptr; - summary = m_trackSumTool->createSummary(**track); + std::unique_ptr<Trk::TrackSummary> summary = nullptr; + summary = m_trackSumTool->summary(**track); if(not summary){ ATH_MSG_DEBUG( "Track summary is NULL " ); @@ -606,7 +606,7 @@ namespace JiveXML { tsosResLoc1.reserve(tsosResLoc1.size()+TSoSVec.size()); tsosResLoc2.reserve(tsosResLoc2.size()+TSoSVec.size()); tsosPullLoc1.reserve(tsosPullLoc1.size()+TSoSVec.size()); - tsosPullLoc2.reserve(tsosPullLoc2.size()+TSoSVec.size()); + tsosPullLoc2.reserve(tsosPullLoc2.size()+TSoSVec.size()); tsosDetType.reserve(tsosDetType.size()+TSoSVec.size()); //Now loop over tracks and fill them @@ -623,7 +623,7 @@ namespace JiveXML { if (!rot){ ATH_MSG_VERBOSE( "Could not obtain RIO for TSoS of type " << (*TSoSItr)->dumpType() ); continue ; - } + } //count this as a hit ++nHits; diff --git a/Tracking/TrkTools/TrkAmbiguityProcessor/src/TrackScoringTool.cxx b/Tracking/TrkTools/TrkAmbiguityProcessor/src/TrackScoringTool.cxx index 6c9a67ad3a2..49db0a86963 100644 --- a/Tracking/TrkTools/TrkAmbiguityProcessor/src/TrackScoringTool.cxx +++ b/Tracking/TrkTools/TrkAmbiguityProcessor/src/TrackScoringTool.cxx @@ -24,7 +24,7 @@ Trk::TrackScoringTool::TrackScoringTool(const std::string& t, { declareInterface<ITrackScoringTool>(this); declareProperty("SumHelpTool", m_trkSummaryTool); - + //set some test values m_summaryTypeScore[Trk::numberOfPixelHits] = 20; m_summaryTypeScore[Trk::numberOfPixelSharedHits] = -10; // a shared hit is only half the weight @@ -45,10 +45,10 @@ Trk::TrackScoringTool::TrackScoringTool(const std::string& t, m_summaryTypeScore[Trk::numberOfOutliersOnTrack] = -2; // an outlier might happen // scoring for Muons is missing - m_summaryTypeScore[Trk::numberOfMdtHits] = 20; - m_summaryTypeScore[Trk::numberOfTgcPhiHits] = 20; + m_summaryTypeScore[Trk::numberOfMdtHits] = 20; + m_summaryTypeScore[Trk::numberOfTgcPhiHits] = 20; m_summaryTypeScore[Trk::numberOfTgcEtaHits] = 10; - m_summaryTypeScore[Trk::numberOfCscPhiHits] = 20; + m_summaryTypeScore[Trk::numberOfCscPhiHits] = 20; m_summaryTypeScore[Trk::numberOfCscEtaHits] = 20; m_summaryTypeScore[Trk::numberOfRpcPhiHits] = 20; m_summaryTypeScore[Trk::numberOfRpcEtaHits] = 10; @@ -57,7 +57,7 @@ Trk::TrackScoringTool::TrackScoringTool(const std::string& t, Trk::TrackScoringTool::~TrackScoringTool(){ } -StatusCode +StatusCode Trk::TrackScoringTool::initialize(){ ATH_CHECK( AlgTool::initialize()); ATH_CHECK( m_trkSummaryTool.retrieve()); @@ -69,20 +69,26 @@ StatusCode Trk::TrackScoringTool::finalize(){ return AlgTool::finalize(); } -Trk::TrackScore +Trk::TrackScore Trk::TrackScoringTool::score( const Track& track, const bool suppressHoleSearch ) const{ - const TrackSummary* summary = nullptr; - if (suppressHoleSearch) - summary = m_trkSummaryTool->createSummaryNoHoleSearch(track); - else - summary = m_trkSummaryTool->createSummary(track); - - Trk::TrackScore score = TrackScore( simpleScore(track, *summary) ); - delete summary; - return score; + + // Used to call the now removed not MT safe + // summary = m_trkSummaryTool->createSummary(track); + // We keep the non-thread safe logic only here. + // Locally to where is actually used + // To decide for a better design + // + Trk::Track& nonConstTrack = const_cast<Trk::Track&>(track); + if (suppressHoleSearch) { + nonConstTrack.setTrackSummary(m_trkSummaryTool->summaryNoHoleSearch(track)); + } else { + nonConstTrack.setTrackSummary(m_trkSummaryTool->summary(track)); + } + Trk::TrackScore score = TrackScore(simpleScore(track, *(nonConstTrack.trackSummary()))); + return score; } -Trk::TrackScore +Trk::TrackScore Trk::TrackScoringTool::simpleScore( const Track& track, const TrackSummary& trackSummary ) const{ // --- reject bad tracks if (track.fitQuality() && track.fitQuality()->numberDoF() < 0) { @@ -101,8 +107,8 @@ Trk::TrackScoringTool::simpleScore( const Track& track, const TrackSummary& trac for (int i=0; i<Trk::numberOfTrackSummaryTypes; ++i) { int value = trackSummary.get(static_cast<Trk::SummaryType>(i)); //value is -1 if undefined. - if (value>0) { - score+=m_summaryTypeScore[i]*value; + if (value>0) { + score+=m_summaryTypeScore[i]*value; ATH_MSG_VERBOSE("\tType ["<<i<<"], value \t= "<<value<<"], score \t="<<score); } } diff --git a/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/IExtendedTrackSummaryTool.h b/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/IExtendedTrackSummaryTool.h index 9026eb03d5c..a079f8ac11c 100644 --- a/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/IExtendedTrackSummaryTool.h +++ b/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/IExtendedTrackSummaryTool.h @@ -2,21 +2,17 @@ Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ - - #ifndef TRKIEXTENDEDTRACKSUMMARYTOOL_H #define TRKIEXTENDEDTRACKSUMMARYTOOL_H -// @TODO remove once interface without PRDtoTrackMap argument is retired. -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Woverloaded-virtual" #include "ITrackSummaryTool.h" namespace Trk { class PRDtoTrackMap; -static const InterfaceID IID_IExtendedTrackSummaryTool("Trk::IExtendedTrackSummaryTool", 1, 0); +static const InterfaceID + IID_IExtendedTrackSummaryTool("Trk::IExtendedTrackSummaryTool", 1, 0); /** @class IExtendedTrackSummaryTool @brief Interface for condensing Trk::Track properties and associated @@ -24,65 +20,92 @@ static const InterfaceID IID_IExtendedTrackSummaryTool("Trk::IExtendedTrackSumma @author Edward Moyse, Martin Siebel <http://consult.cern.ch/xwho> */ -class IExtendedTrackSummaryTool : virtual public ITrackSummaryTool { - public: - static const InterfaceID& interfaceID( ) ; +class IExtendedTrackSummaryTool : virtual public ITrackSummaryTool +{ +public: + static const InterfaceID& interfaceID(); + using ITrackSummaryTool::summary; + using ITrackSummaryTool::summaryNoHoleSearch; + using ITrackSummaryTool::updateSharedHitCount; + using ITrackSummaryTool::updateAdditionalInfo; /** Compute track summary and replace the summary in given track. - * @param track the track whose track summary is replaced with a newly computed one - * @param prd_to_track_map a PRD to track association map to compute shared hits or a nullptr - * @param suppress_hole_search do not perform the hole search independent of the settings of the ID and muon hole search properties. - * Will recompute the track summary for the given track, delete the old track summary of - * the track if there is already one and set the new one. If a valid PRD to track map is - * given the number of shared hits is computed otherwise not. The hole search is performed - * according to the settings of the ID and muon hole search properties unless the - * suppress_hole_search argument is true. + * @param track the track whose track summary is replaced with a newly + * computed one + * @param prd_to_track_map a PRD to track association map to compute shared + * hits or a nullptr + * @param suppress_hole_search do not perform the hole search independent of + * the settings of the ID and muon hole search properties. Will recompute the + * track summary for the given track, delete the old track summary of the + * track if there is already one and set the new one. If a valid PRD to track + * map is given the number of shared hits is computed otherwise not. The hole + * search is performed according to the settings of the ID and muon hole + * search properties unless the suppress_hole_search argument is true. */ - virtual void computeAndReplaceTrackSummary(Track &track, - const Trk::PRDtoTrackMap *prd_to_track_map, - bool suppress_hole_search=false) const = 0; + virtual void computeAndReplaceTrackSummary( + Track& track, + const Trk::PRDtoTrackMap* prd_to_track_map, + bool suppress_hole_search = false) const = 0; /** create a summary object from passed Track.*/ - virtual std::unique_ptr<Trk::TrackSummary> summary( const Track& track, - const Trk::PRDtoTrackMap *prd_to_track_map) const = 0; + virtual std::unique_ptr<Trk::TrackSummary> summary( + const Track& track, + const Trk::PRDtoTrackMap* prd_to_track_map) const = 0; - /** create a summary object of passed track without doing the tedious hole search. */ - virtual std::unique_ptr<Trk::TrackSummary> summaryNoHoleSearch( const Track& track, - const Trk::PRDtoTrackMap *prd_to_track_map) const = 0; + /** create a summary object of passed track without doing the tedious hole + * search. */ + virtual std::unique_ptr<Trk::TrackSummary> summaryNoHoleSearch( + const Track& track, + const Trk::PRDtoTrackMap* prd_to_track_map) const = 0; /** Update the shared hit count of the given track summary. - * @param track the track which corresponds to the given track summary and is used to compute the numbers of shared hits. - * @param prd_to_track_map an optional PRD-to-track map which is used to compute the shared hits otherwise the association tool will be used. - * @param summary the summary to be updated i.e. a copy of the track summary of the given track. - * The method will update the shared information in the given summary. The track will not be modified i.e. the shared hit count - * of the summary owned by the track will not be updated. + * @param track the track which corresponds to the given track summary and is + * used to compute the numbers of shared hits. + * @param prd_to_track_map an optional PRD-to-track map which is used to + * compute the shared hits otherwise the association tool will be used. + * @param summary the summary to be updated i.e. a copy of the track summary + * of the given track. The method will update the shared information in the + * given summary. The track will not be modified i.e. the shared hit count of + * the summary owned by the track will not be updated. */ - virtual void updateSharedHitCount(const Track& track, const Trk::PRDtoTrackMap *prd_to_track_map, TrackSummary &summary) const = 0; - - /** method to update the shared hit content only, this is optimised for track collection merging. */ - virtual void updateSharedHitCount(Track& track, const Trk::PRDtoTrackMap *prd_to_track_map) const = 0; - - /** Update the shared hit counts, expected hit, PID information and eventually the detailed track summaries. - * @param track the track corresponding to the summary which is updated, which is not actively changed. - * @param prd-to-track an optional PRD-to-track map to compute shared hits or nullptr. + virtual void updateSharedHitCount(const Track& track, + const Trk::PRDtoTrackMap* prd_to_track_map, + TrackSummary& summary) const = 0; + + /** method to update the shared hit content only, this is optimised for track + * collection merging. */ + virtual void updateSharedHitCount( + Track& track, + const Trk::PRDtoTrackMap* prd_to_track_map) const = 0; + + /** Update the shared hit counts, expected hit, PID information and eventually + * the detailed track summaries. + * @param track the track corresponding to the summary which is updated, which + * is not actively changed. + * @param prd-to-track an optional PRD-to-track map to compute shared hits or + * nullptr. * @param summary the summary which is updated. - * Will update the shared hit, expected hit, PID information and eventually the detailed track summaries. If - * no PRD-to-track map is given the helper tools will rely on a PRD association tool to privide the shared - * hit information. The method will not update the track itself unless the given summary is owned by the track. + * Will update the shared hit, expected hit, PID information and eventually + * the detailed track summaries. If no PRD-to-track map is given the helper + * tools will rely on a PRD association tool to privide the shared hit + * information. The method will not update the track itself unless the given + * summary is owned by the track. */ - virtual void updateAdditionalInfo(const Track& track, const Trk::PRDtoTrackMap *prd_to_track_map, TrackSummary &summary) const = 0; - - virtual void updateAdditionalInfo(Track& track, const Trk::PRDtoTrackMap *prd_to_track_map) const = 0; + virtual void updateAdditionalInfo(const Track& track, + const Trk::PRDtoTrackMap* prd_to_track_map, + TrackSummary& summary) const = 0; + virtual void updateAdditionalInfo( + Track& track, + const Trk::PRDtoTrackMap* prd_to_track_map) const = 0; }; -inline const InterfaceID& Trk::IExtendedTrackSummaryTool::interfaceID() +inline const InterfaceID& +Trk::IExtendedTrackSummaryTool::interfaceID() { - return IID_IExtendedTrackSummaryTool; + return IID_IExtendedTrackSummaryTool; } - } -#pragma GCC diagnostic pop #endif diff --git a/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ITrackSummaryTool.h b/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ITrackSummaryTool.h index 33aa95a1721..75616e5fb9b 100755 --- a/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ITrackSummaryTool.h +++ b/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ITrackSummaryTool.h @@ -5,8 +5,8 @@ #ifndef TRKITRACKSUMMARYTOOL_H #define TRKITRACKSUMMARYTOOL_H -#include "GaudiKernel/IAlgTool.h" #include "CxxUtils/checker_macros.h" +#include "GaudiKernel/IAlgTool.h" #include <memory> namespace Trk { @@ -27,33 +27,18 @@ class ITrackSummaryTool : virtual public IAlgTool public: static const InterfaceID& interfaceID(); - /** create a summary object from passed Track. The summary object belongs to - you, the user, and so you must take care of deletion of it. - If the track has a summary already a clone is returned back. - @param onlyUpdateTrack If false (default) then the summary is cloned and - added to the track, and a separate summary returned. If true, only update - track and return nullptr */ - virtual const Trk::TrackSummary* createSummary - ATLAS_NOT_THREAD_SAFE(const Track& track, - bool onlyUpdateTrack = false) const = 0; - - /** create a summary object of passed track without doing the tedious hole - search. Same comments as for createSummary apply here, of course, too. */ - virtual const Trk::TrackSummary* createSummaryNoHoleSearch - ATLAS_NOT_THREAD_SAFE(const Track& track) const = 0; - - /** create a summary object from a passed Track. - If the track has a summary already a clone is returned back. + /** Create a new summary object from a passed Track or clone + * the existing. */ virtual std::unique_ptr<Trk::TrackSummary> summary( const Track& track) const = 0; - /** create a summary object of passed track without doing the tedious hole - search. If the track has a summary already a clone is returned back.*/ + /** create a summary object from a passed track, without doing the tedious + hole search, or clone the existing.*/ virtual std::unique_ptr<Trk::TrackSummary> summaryNoHoleSearch( const Track& track) const = 0; - /** method which can be used to update the track and add a summary to it. + /** Method which can be used to update the track and add a summary to it. This can be used to add a summary to a track and then retrieve it from it without the need to clone. */ virtual void updateTrack(Track& track) const = 0; @@ -72,11 +57,11 @@ public: virtual void updateAdditionalInfo(Track& track) const = 0; }; -inline const InterfaceID& Trk::ITrackSummaryTool::interfaceID() -{ - return IID_ITrackSummaryTool; +inline const InterfaceID& +Trk::ITrackSummaryTool::interfaceID() +{ + return IID_ITrackSummaryTool; } - } -#endif +#endif diff --git a/Tracking/TrkTools/TrkTrackSummaryTool/TrkTrackSummaryTool/TrackSummaryTool.h b/Tracking/TrkTools/TrkTrackSummaryTool/TrkTrackSummaryTool/TrackSummaryTool.h index ca02495f95a..c134eb940a3 100755 --- a/Tracking/TrkTools/TrkTrackSummaryTool/TrkTrackSummaryTool/TrackSummaryTool.h +++ b/Tracking/TrkTools/TrkTrackSummaryTool/TrkTrackSummaryTool/TrackSummaryTool.h @@ -5,22 +5,20 @@ #ifndef TRKTRACKSUMMARYTOOL_H #define TRKTRACKSUMMARYTOOL_H -#include "CxxUtils/checker_macros.h" #include "AthenaBaseComps/AthAlgTool.h" +#include "CxxUtils/checker_macros.h" #include "GaudiKernel/ToolHandle.h" -#include "TrkTrack/Track.h" #include "TrkParameters/TrackParameters.h" +#include "TrkTrack/Track.h" #include "TrkTrackSummary/TrackSummary.h" - +#include "TRT_ElectronPidTools/ITRT_ToT_dEdx.h" #include "TrkToolInterfaces/IExtendedTrackSummaryHelperTool.h" -#include "TrkToolInterfaces/ITRT_ElectronPidTool.h" #include "TrkToolInterfaces/IPixelToTPIDTool.h" -#include "TRT_ElectronPidTools/ITRT_ToT_dEdx.h" - +#include "TrkToolInterfaces/ITRT_ElectronPidTool.h" -#include <vector> #include "TrkToolInterfaces/IExtendedTrackSummaryTool.h" +#include <vector> class AtlasDetectorID; class Identifier; @@ -56,71 +54,85 @@ public: virtual StatusCode initialize() override; virtual StatusCode finalize() override; - /** create a summary object from passed Track. The summary object belongs to - you, the user, and so you must take care of deletion of it. - @param onlyUpdateTrack If false (default) then the summary is cloned and added to the track, - and a separate summary returned. If true, only update track and return 0*/ - virtual const Trk::TrackSummary* createSummary ATLAS_NOT_THREAD_SAFE(const Track& track, - bool onlyUpdateTrack = false) const override; - - /** create a summary object of passed track without doing the tedious hole search. - Same comments as for createSummary apply here, of course, too. */ - virtual const Trk::TrackSummary* createSummaryNoHoleSearch ATLAS_NOT_THREAD_SAFE(const Track& track) const override; - /** Compute track summary and replace the summary in given track. - * @param track the track whose track summary is replaced with a newly computed one - * @param prd_to_track_map a PRD to track association map to compute shared hits or a nullptr - * @param suppress_hole_search do not perform the hole search independent of the settings of the ID and muon hole - * search properties. Will recompute the track summary for the given track, delete the old track summary of the track - * if there is already one and set the new one. If a valid PRD to track map is given the number of shared hits is - * computed otherwise not. The hole search is performed according to the settings of the ID and muon hole search - * properties unless the suppress_hole_search argument is true. + * @param track the track whose track summary is replaced with a newly + * computed one + * @param prd_to_track_map a PRD to track association map to compute shared + * hits or a nullptr + * @param suppress_hole_search do not perform the hole search independent of + * the settings of the ID and muon hole search properties. Will recompute the + * track summary for the given track, delete the old track summary of the + * track if there is already one and set the new one. If a valid PRD to track + * map is given the number of shared hits is computed otherwise not. The hole + * search is performed according to the settings of the ID and muon hole + * search properties unless the suppress_hole_search argument is true. */ - virtual void computeAndReplaceTrackSummary(Track& track, - const Trk::PRDtoTrackMap* prd_to_track_map, - bool suppress_hole_search = false) const override; + virtual void computeAndReplaceTrackSummary( + Track& track, + const Trk::PRDtoTrackMap* prd_to_track_map, + bool suppress_hole_search = false) const override; - /** create a summary object from passed Track.*/ - virtual std::unique_ptr<Trk::TrackSummary> summary(const Track& track) const override; + /** create a summary object from passed Track or clone the existing*/ + virtual std::unique_ptr<Trk::TrackSummary> summary( + const Track& track) const override; - /** create a summary object of passed track without doing the tedious hole search. */ - virtual std::unique_ptr<Trk::TrackSummary> summaryNoHoleSearch(const Track& track) const override; + /** create a summary object of passed track, without doing the tedious hole + * search, or clone the existing*/ + virtual std::unique_ptr<Trk::TrackSummary> summaryNoHoleSearch( + const Track& track) const override; - /** create a summary object from passed Track.*/ - virtual std::unique_ptr<Trk::TrackSummary> summary(const Track& track, - const Trk::PRDtoTrackMap* prd_to_track_map) const override; + /** create a summary object from passed Track,*/ + virtual std::unique_ptr<Trk::TrackSummary> summary( + const Track& track, + const Trk::PRDtoTrackMap* prd_to_track_map) const override; - /** create a summary object of passed track without doing the tedious hole search. */ + /** create a summary object of passed track without doing the tedious hole + * search. */ virtual std::unique_ptr<Trk::TrackSummary> summaryNoHoleSearch( const Track& track, const Trk::PRDtoTrackMap* prd_to_track_map) const override; - /** method to update the shared hit content only, this is optimised for track collection merging. */ - virtual void updateSharedHitCount(Track& track, const Trk::PRDtoTrackMap* prd_to_track_map) const override + /** method to update the shared hit content only, this is optimised for track + * collection merging. */ + virtual void updateSharedHitCount( + Track& track, + const Trk::PRDtoTrackMap* prd_to_track_map) const override { if (!track.trackSummary()) { - computeAndReplaceTrackSummary(track, prd_to_track_map, false /*DO NOT suppress hole search*/); + computeAndReplaceTrackSummary( + track, prd_to_track_map, false /*DO NOT suppress hole search*/); } else { updateSharedHitCount(track, prd_to_track_map, *track.trackSummary()); } } - /** method to update additional information (PID,shared hits, dEdX), this is optimised for track collection merging. + /** method to update additional information (PID,shared hits, dEdX), this is + * optimised for track collection merging. */ - virtual void updateAdditionalInfo(Track& track, const Trk::PRDtoTrackMap* prd_to_track_map) const override + virtual void updateAdditionalInfo( + Track& track, + const Trk::PRDtoTrackMap* prd_to_track_map) const override { if (!track.trackSummary()) { - computeAndReplaceTrackSummary(track, prd_to_track_map, false /*DO NOT suppress hole search*/); + computeAndReplaceTrackSummary( + track, prd_to_track_map, false /*DO NOT suppress hole search*/); } else { updateAdditionalInfo( - track, prd_to_track_map, *track.trackSummary(), true); // @TODO set to false; true for backward compatibility + track, + prd_to_track_map, + *track.trackSummary(), + true); // @TODO set to false; true for backward compatibility } } - /** use this method to update a track. this means a tracksummary is created for - this track but not returned. the summary can then be obtained from the track. - Because it is taken from the track the ownership stays with the track */ - virtual void updateTrack(Track& track) const override { updateTrack(track, nullptr); } + /** use this method to update a track. this means a tracksummary is created + for this track but not returned. the summary can then be obtained from the + track. Because it is taken from the track the ownership stays with the track +*/ + virtual void updateTrack(Track& track) const override + { + updateTrack(track, nullptr); + } /** method which can be used to update a refitted track and add a summary to * it, without doing shard hit/ or hole search. Adds a summary to a track and @@ -131,34 +143,44 @@ public: } /** Update the shared hit count of the given track summary. - * @param summary the summary to be updated i.e. a copy of the track summary of the given track. - * @param track the track which corresponds to the given track summary and is used to compute the numbers of shared - * hits. - * @param prd_to_track_map an optional PRD-to-track map which is used to compute the shared hits otherwise the - * association tool will be used. The method will update the shared information in the given summary. The track will - * not be modified i.e. the shared hit count of the summary owned by the track will not be updated. + * @param summary the summary to be updated i.e. a copy of the track summary + * of the given track. + * @param track the track which corresponds to the given track summary and is + * used to compute the numbers of shared hits. + * @param prd_to_track_map an optional PRD-to-track map which is used to + * compute the shared hits otherwise the association tool will be used. The + * method will update the shared information in the given summary. The track + * will not be modified i.e. the shared hit count of the summary owned by the + * track will not be updated. */ virtual void updateSharedHitCount(const Track& track, const Trk::PRDtoTrackMap* prd_to_track_map, TrackSummary& summary) const override; - /** method to update the shared hit content only, this is optimised for track collection merging. */ + /** method to update the shared hit content only, this is optimised for track + * collection merging. */ virtual void updateSharedHitCount(Track& track) const override { if (!track.trackSummary()) { - computeAndReplaceTrackSummary(track, nullptr, false /*DO NOT suppress hole search*/); + computeAndReplaceTrackSummary( + track, nullptr, false /*DO NOT suppress hole search*/); } else { updateSharedHitCount(track, nullptr, *track.trackSummary()); } } - /** Update the shared hit counts, expected hit, PID information and eventually the detailed track summaries. - * @param track the track corresponding to the summary which is updated, which is not actively changed. - * @param prd-to-track an optional PRD-to-track map to compute shared hits or nullptr. + /** Update the shared hit counts, expected hit, PID information and eventually + * the detailed track summaries. + * @param track the track corresponding to the summary which is updated, which + * is not actively changed. + * @param prd-to-track an optional PRD-to-track map to compute shared hits or + * nullptr. * @param summary the summary which is updated. - * Will update the shared hit, expected hit, PID information and eventually the detailed track summaries. If - * no PRD-to-track map is given the helper tools will rely on a PRD association tool to privide the shared - * hit information. The method will not update the track itself unless the given summary is owned by the track. + * Will update the shared hit, expected hit, PID information and eventually + * the detailed track summaries. If no PRD-to-track map is given the helper + * tools will rely on a PRD association tool to privide the shared hit + * information. The method will not update the track itself unless the given + * summary is owned by the track. */ virtual void updateAdditionalInfo(const Track& track, const Trk::PRDtoTrackMap* prd_to_track_map, @@ -167,15 +189,20 @@ public: updateAdditionalInfo(track, prd_to_track_map, summary, false); } - /** method to update additional information (PID,shared hits, dEdX), this is optimised for track collection merging. + /** method to update additional information (PID,shared hits, dEdX), this is + * optimised for track collection merging. */ virtual void updateAdditionalInfo(Track& track) const override { if (!track.trackSummary()) { - computeAndReplaceTrackSummary(track, nullptr, false /*DO NOT suppress hole search*/); + computeAndReplaceTrackSummary( + track, nullptr, false /*DO NOT suppress hole search*/); } else { updateAdditionalInfo( - track, nullptr, *track.trackSummary(), true); // @TODO set to false; true for backward compatibility + track, + nullptr, + *track.trackSummary(), + true); // @TODO set to false; true for backward compatibility } } @@ -185,67 +212,79 @@ private: TrackSummary& summary, bool initialise_to_zero) const; - Trk::TrackSummary* createSummaryAndUpdateTrack ATLAS_NOT_THREAD_SAFE(const Track& track, - const Trk::PRDtoTrackMap* prd_to_track_map, - bool onlyUpdateTrack, - bool doHolesInDet, - bool doHolesMuon) const - { - Trk::Track& nonConstTrack = const_cast<Trk::Track&>(track); - nonConstTrack.setTrackSummary(createSummary(track, prd_to_track_map, doHolesInDet, doHolesMuon)); - return onlyUpdateTrack ? nullptr : new Trk::TrackSummary(*nonConstTrack.trackSummary()); - } - /** use this method to update a track. this means a tracksummary is created for - this track but not returned. the summary can then be obtained from the track. - Because it is taken from the track the ownership stays with the track */ - void updateTrack(Track& track, const Trk::PRDtoTrackMap* prd_to_track_map) const; + /** use this method to update a track. this means a tracksummary is created + for this track but not returned. the summary can then be obtained from the + track. Because it is taken from the track the ownership stays with the track + */ + void updateTrack(Track& track, + const Trk::PRDtoTrackMap* prd_to_track_map) const; - void updateTrackNoHoleSearch(Track& track, const Trk::PRDtoTrackMap* prd_to_track_map) const; + void updateTrackNoHoleSearch( + Track& track, + const Trk::PRDtoTrackMap* prd_to_track_map) const; - std::unique_ptr<Trk::TrackSummary> createSummary(const Track& track, - const Trk::PRDtoTrackMap* prd_to_track_map, - bool doHolesInDet, - bool doHolesMuon) const; + std::unique_ptr<Trk::TrackSummary> createSummary( + const Track& track, + const Trk::PRDtoTrackMap* prd_to_track_map, + bool doHolesInDet, + bool doHolesMuon) const; /** Return the correct tool, matching the passed Identifier*/ Trk::IExtendedTrackSummaryHelperTool* getTool(const Identifier& id); - const Trk::IExtendedTrackSummaryHelperTool* getTool(const Identifier& id) const; + const Trk::IExtendedTrackSummaryHelperTool* getTool( + const Identifier& id) const; /**tool to decipher ID RoTs*/ - ToolHandle<IExtendedTrackSummaryHelperTool> m_idTool{ this, "InDetSummaryHelperTool", "", "" }; + ToolHandle<IExtendedTrackSummaryHelperTool> + m_idTool{ this, "InDetSummaryHelperTool", "", "" }; /**tool to calculate electron probabilities*/ - ToolHandle<ITRT_ElectronPidTool> m_eProbabilityTool{ this, "TRT_ElectronPidTool", "", "" }; + ToolHandle<ITRT_ElectronPidTool> m_eProbabilityTool{ this, + "TRT_ElectronPidTool", + "", + "" }; /** tool to calculate the TRT_ToT_dEdx.*/ ToolHandle<ITRT_ToT_dEdx> m_trt_dEdxTool{ this, "TRT_ToT_dEdxTool", "", "" }; /**tool to calculate dE/dx using pixel clusters*/ ToolHandle<IPixelToTPIDTool> m_dedxtool{ this, "PixelToTPIDTool", "", "" }; /**tool to decipher muon RoTs*/ - ToolHandle<IExtendedTrackSummaryHelperTool> m_muonTool{ this, "MuonSummaryHelperTool","", "" }; - + ToolHandle<IExtendedTrackSummaryHelperTool> + m_muonTool{ this, "MuonSummaryHelperTool", "", "" }; + /** controls whether holes on track are produced Turning this on will (slightly) increase processing time.*/ Gaudi::Property<bool> m_doHolesMuon{ this, "doHolesMuon", false, "" }; - /** For the InDet it is switched on automatically as soon as the HoleSearchTool is given */ + /** For the InDet it is switched on automatically as soon as the + * HoleSearchTool is given */ Gaudi::Property<bool> m_doHolesInDet{ this, "doHolesInDet", false, "" }; /** controls whether shared hits in Pix+SCT are produced Turning this on will increase processing time.*/ Gaudi::Property<bool> m_doSharedHits{ this, "doSharedHits", false, "" }; - + /** controls whether the detailed summary is added for the indet */ - Gaudi::Property<bool> m_addInDetDetailedSummary{ this, "AddDetailedInDetSummary", true, "" }; + Gaudi::Property<bool> m_addInDetDetailedSummary{ this, + "AddDetailedInDetSummary", + true, + "" }; /** controls whether the detailed summary is added for the muons */ - Gaudi::Property<bool> m_addMuonDetailedSummary{ this, "AddDetailedMuonSummary", true, "" }; + Gaudi::Property<bool> m_addMuonDetailedSummary{ this, + "AddDetailedMuonSummary", + true, + "" }; /** switch to deactivate Pixel info init */ Gaudi::Property<bool> m_pixelExists{ this, "PixelExists", true, "" }; - - /** Only compute TRT dE/dx if there are at least this number of TRT hits or outliers.*/ - Gaudi::Property<int> m_minTRThitsForTRTdEdx{ this, "minTRThitsForTRTdEdx", 1, "" }; + + /** Only compute TRT dE/dx if there are at least this number of TRT hits or + * outliers.*/ + Gaudi::Property<int> m_minTRThitsForTRTdEdx{ this, + "minTRThitsForTRTdEdx", + 1, + "" }; /**atlas id helper*/ const AtlasDetectorID* m_detID; - /**loops over TrackStatesOnSurface and uses this to produce the summary information - Fills 'information', 'eProbability', and 'hitPattern'*/ + /**loops over TrackStatesOnSurface and uses this to produce the summary + information Fills 'information', 'eProbability', and 'hitPattern'*/ void processTrackStates(const Track& track, const Trk::PRDtoTrackMap* prd_to_track_map, const DataVector<const TrackStateOnSurface>* tsos, @@ -261,10 +300,10 @@ private: std::vector<int>& information, std::bitset<numberOfDetectorTypes>& hitPattern) const; - /** Extrapolation is performed from one hit to the next, it is checked if surfaces in between - the extrapolation are left out. The trackParameters of the destination hit (instead of the - trackParameters of the extrapolation step) are then used as starting point for the next - extrapolation step. */ + /** Extrapolation is performed from one hit to the next, it is checked if + surfaces in between the extrapolation are left out. The trackParameters of + the destination hit (instead of the trackParameters of the extrapolation + step) are then used as starting point for the next extrapolation step. */ void searchHolesStepWise(const Trk::Track& track, std::vector<int>& information, bool doHolesInDet, diff --git a/Tracking/TrkTools/TrkTrackSummaryTool/src/TrackSummaryTool.cxx b/Tracking/TrkTools/TrkTrackSummaryTool/src/TrackSummaryTool.cxx index f1c6b44cb46..b7fc117d42e 100755 --- a/Tracking/TrkTools/TrkTrackSummaryTool/src/TrackSummaryTool.cxx +++ b/Tracking/TrkTools/TrkTrackSummaryTool/src/TrackSummaryTool.cxx @@ -23,7 +23,6 @@ #include <vector> #include <algorithm> -//============================================================================================ Trk::TrackSummaryTool::TrackSummaryTool(const std::string& t, const std::string& n, @@ -35,15 +34,13 @@ Trk::TrackSummaryTool::TrackSummaryTool(const std::string& t, declareInterface<ITrackSummaryTool>(this); } -//============================================================================================ Trk::TrackSummaryTool::~TrackSummaryTool() { } -//============================================================================================ -StatusCode +StatusCode Trk::TrackSummaryTool::initialize() { // StatusCode sc=StatusCode::SUCCESS; @@ -61,49 +58,49 @@ StatusCode ATH_MSG_ERROR ("Failed to retrieve InDet helper tool "<< m_idTool); ATH_MSG_ERROR ("configure as 'None' to avoid its loading."); return StatusCode::FAILURE; - } + } if ( !m_idTool.empty()) msg(MSG::INFO) << "Retrieved tool " << m_idTool << endmsg; - + // Troels.Petersen@cern.ch: - if ( !m_eProbabilityTool.empty() && m_eProbabilityTool.retrieve().isFailure() ) + if ( !m_eProbabilityTool.empty() && m_eProbabilityTool.retrieve().isFailure() ) { ATH_MSG_ERROR ("Failed to retrieve electron probability tool " << m_eProbabilityTool); ATH_MSG_ERROR ("configure as 'None' to avoid its loading."); return StatusCode::FAILURE; - } + } if ( !m_eProbabilityTool.empty()) msg(MSG::INFO) << "Retrieved tool " << m_eProbabilityTool << endmsg; - + if (!m_trt_dEdxTool.empty()) { ATH_CHECK( m_trt_dEdxTool.retrieve() ); } - + if ( !m_dedxtool.empty() && m_dedxtool.retrieve().isFailure() ) { ATH_MSG_ERROR ("Failed to retrieve pixel dEdx tool " << m_dedxtool); ATH_MSG_ERROR ("configure as 'None' to avoid its loading."); return StatusCode::FAILURE; - } + } if ( !m_dedxtool.empty()) msg(MSG::INFO) << "Retrieved tool " << m_dedxtool << endmsg; - - if ( !m_muonTool.empty() && m_muonTool.retrieve().isFailure() ) + + if ( !m_muonTool.empty() && m_muonTool.retrieve().isFailure() ) { ATH_MSG_ERROR ("Failed to retrieve Muon helper tool "<< m_muonTool); ATH_MSG_ERROR ("configure as 'None' to avoid its loading."); - } + } else { if ( !m_muonTool.empty()) msg(MSG::INFO) << "Retrieved tool " << m_muonTool<<endmsg; } - if (m_doHolesInDet) + if (m_doHolesInDet) ATH_MSG_INFO ("Search for InDet holes using external tool turned ON"); else ATH_MSG_INFO ("Search for InDet holes using external tool turned OFF"); - if (m_doHolesMuon) + if (m_doHolesMuon) ATH_MSG_INFO ("Search for Muon holes using external tool turned ON"); else ATH_MSG_INFO ("Search for Muon holes using external tool turned OFF"); @@ -112,27 +109,16 @@ StatusCode return StatusCode::SUCCESS; } -//============================================================================================ -StatusCode +StatusCode Trk::TrackSummaryTool::finalize() { - //StatusCode sc = AlgTool::finalize(); return StatusCode::SUCCESS; } -const Trk::TrackSummary* Trk::TrackSummaryTool::createSummaryNoHoleSearch( const Track& track ) const -{ - return createSummaryAndUpdateTrack(track, nullptr, false, false, false); -} -//============================================================================================ - -const Trk::TrackSummary* Trk::TrackSummaryTool::createSummary( const Track& track, - bool onlyUpdateTrack ) const -{ - return createSummaryAndUpdateTrack(track, nullptr, onlyUpdateTrack, m_doHolesInDet, m_doHolesMuon); -} - +/* + * First the methods to create a new or clone the existing + */ void Trk::TrackSummaryTool::computeAndReplaceTrackSummary(Trk::Track &track, const Trk::PRDtoTrackMap *prd_to_track_map, bool suppress_hole_search) const { @@ -159,13 +145,13 @@ std::unique_ptr<Trk::TrackSummary> Trk::TrackSummaryTool::summary( const Track& std::unique_ptr<Trk::TrackSummary> Trk::TrackSummaryTool::summaryNoHoleSearch( const Track& track) const { - return createSummary(track, nullptr, false, false ); + return createSummary(track, nullptr, false, false ); } std::unique_ptr<Trk::TrackSummary> Trk::TrackSummaryTool::summaryNoHoleSearch( const Track& track, const Trk::PRDtoTrackMap *prd_to_track_map) const { - return createSummary(track, prd_to_track_map, false, false ); + return createSummary(track, prd_to_track_map, false, false ); } std::unique_ptr<Trk::TrackSummary> @@ -196,7 +182,7 @@ Trk::TrackSummaryTool::createSummary( const Track& track, if (!m_idTool.empty()) { if (m_pixelExists) { - information [numberOfContribPixelLayers] = 0; + information [numberOfContribPixelLayers] = 0; information [numberOfInnermostPixelLayerHits] = 0; information [numberOfInnermostPixelLayerOutliers] = 0; information [numberOfNextToInnermostPixelLayerHits] = 0; @@ -261,7 +247,7 @@ Trk::TrackSummaryTool::createSummary( const Track& track, // New Small Wheel information[Trk::numberOfStgcEtaHits] =0; information[Trk::numberOfStgcPhiHits] =0; - information[Trk::numberOfMmHits] =0; + information[Trk::numberOfMmHits] =0; information[Trk::numberOfStgcEtaHoles] =0; information[Trk::numberOfStgcPhiHoles] =0; information[Trk::numberOfMmHoles] =0; @@ -281,13 +267,13 @@ Trk::TrackSummaryTool::createSummary( const Track& track, <<track.info().dumpInfo()<<"). This should never happen! "); } - if (doHolesInDet || doHolesMuon) + if (doHolesInDet || doHolesMuon) { - if (m_pixelExists) + if (m_pixelExists) { - information [numberOfPixelHoles] = 0; + information [numberOfPixelHoles] = 0; } - information [numberOfSCTHoles] = 0; + information [numberOfSCTHoles] = 0; information [numberOfSCTDoubleHoles] = 0; searchHolesStepWise(track,information, doHolesInDet, doHolesMuon); } @@ -307,7 +293,7 @@ Trk::TrackSummaryTool::createSummary( const Track& track, else { eProbability.push_back(0.0); } - + std::unique_ptr<TrackSummary> ts=std::make_unique<TrackSummary>(information, eProbability, hitPattern, @@ -328,6 +314,10 @@ Trk::TrackSummaryTool::createSummary( const Track& track, return ts; } +/* + * The the update methods + */ + void Trk::TrackSummaryTool::updateTrack(Track& track,const Trk::PRDtoTrackMap *prd_to_track_map) const { // first check if track has summary already. @@ -352,7 +342,7 @@ void Trk::TrackSummaryTool::updateSharedHitCount(const Track& track, const Trk:: void Trk::TrackSummaryTool::updateAdditionalInfo(const Track& track, const Trk::PRDtoTrackMap *prd_to_track_map, TrackSummary &summary, bool initialise_to_zero) const { unsigned int numberOfeProbabilityTypes = Trk::numberOfeProbabilityTypes+1; - std::vector<float> eProbability(numberOfeProbabilityTypes,0.5); + std::vector<float> eProbability(numberOfeProbabilityTypes,0.5); if ( !m_eProbabilityTool.empty() ) eProbability = m_eProbabilityTool->electronProbability(track); if (!m_trt_dEdxTool.empty()) { @@ -393,6 +383,11 @@ void Trk::TrackSummaryTool::updateAdditionalInfo(const Track& track, const Trk:: if (m_addInDetDetailedSummary) m_idTool->addDetailedTrackSummary(track,summary); } + +/* + * Then the internal helpers + */ + void Trk::TrackSummaryTool::processTrackStates(const Track& track, const Trk::PRDtoTrackMap *prd_to_track_map, const DataVector<const TrackStateOnSurface>* tsos, @@ -506,15 +501,15 @@ Trk::TrackSummaryTool::getTool(const Identifier& id) if (m_detID->is_indet(id)){ if (!m_idTool.empty()){ return &*m_idTool; - } + } ATH_MSG_WARNING("getTool: Identifier is from ID but have no ID tool"); - + } else if(m_detID->is_muon(id)) { if (!m_muonTool.empty()) { return &*m_muonTool; - } + } ATH_MSG_WARNING("getTool: Identifier is from Muon but have no Muon tool"); - + } else { ATH_MSG_WARNING("getTool: Identifier is of unknown type! id: "<<id.getString()); } @@ -527,15 +522,15 @@ Trk::TrackSummaryTool::getTool(const Identifier& id) const if (m_detID->is_indet(id)){ if (!m_idTool.empty()){ return &*m_idTool; - } + } ATH_MSG_WARNING("getTool: Identifier is from ID but have no ID tool"); - + } else if(m_detID->is_muon(id)) { if (!m_muonTool.empty()) { return &*m_muonTool; - } + } ATH_MSG_WARNING("getTool: Identifier is from Muon but have no Muon tool"); - + } else { ATH_MSG_WARNING("getTool: Identifier is of unknown type! id: "<<id.getString()); } @@ -550,11 +545,11 @@ void Trk::TrackSummaryTool::searchHolesStepWise( const Trk::Track& track, ATH_MSG_VERBOSE ("Entering Trk::TrackSummaryTool::searchHolesStepWise"); // -------- obtain hits in Pixel and SCT only - if (track.trackStateOnSurfaces()==nullptr) + if (track.trackStateOnSurfaces()==nullptr) { ATH_MSG_DEBUG ("No trackStatesOnSurface!!!!"); information [numberOfPixelHoles] = -1; - information [numberOfPixelDeadSensors] = -1; + information [numberOfPixelDeadSensors] = -1; information [numberOfSCTHoles] = -1; information [numberOfSCTDoubleHoles] = -1; information [numberOfSCTDeadSensors] = -1; @@ -562,27 +557,27 @@ void Trk::TrackSummaryTool::searchHolesStepWise( const Trk::Track& track, information [numberOfTRTDeadStraws] = -1; // NOTE: Eta holes was used twice instead of Phi holes information [numberOfCscEtaHoles] = -1; - information [numberOfCscPhiHoles] = -1; + information [numberOfCscPhiHoles] = -1; information [numberOfRpcEtaHoles] = -1; - information [numberOfRpcPhiHoles] = -1; + information [numberOfRpcPhiHoles] = -1; information [numberOfTgcEtaHoles] = -1; information [numberOfTgcPhiHoles] = -1; // New Small Wheel information [numberOfStgcEtaHoles] = -1; - information [numberOfStgcPhiHoles] = -1; + information [numberOfStgcPhiHoles] = -1; information [numberOfMmHoles] = -1; return; } - - + + if (doHolesInDet) { // -------- perform the InDet hole search if (m_pixelExists) { information [numberOfPixelHoles] = 0; information [numberOfPixelDeadSensors] = 0; - } - information [numberOfSCTHoles] = 0; + } + information [numberOfSCTHoles] = 0; information [numberOfSCTDoubleHoles] = 0; information [numberOfSCTDeadSensors] = 0; // ME : revert to take the summary helper, this is a temporary thing for 16.0.X @@ -590,22 +585,22 @@ void Trk::TrackSummaryTool::searchHolesStepWise( const Trk::Track& track, } if (!m_muonTool.empty() && doHolesMuon) { - // now do Muon hole search. It works completely differently to the above, + // now do Muon hole search. It works completely differently to the above, // so we need to make this all a bit more general // and probably more efficient. But this hopefully works for now! EJWM information [numberOfMdtHoles] = 0; information [numberOfCscEtaHoles] = 0; - information [numberOfCscPhiHoles] = 0; + information [numberOfCscPhiHoles] = 0; information [numberOfRpcEtaHoles] = 0; - information [numberOfRpcPhiHoles] = 0; + information [numberOfRpcPhiHoles] = 0; information [numberOfTgcEtaHoles] = 0; information [numberOfTgcPhiHoles] = 0; // New Small Wheel information [numberOfStgcEtaHoles] = 0; - information [numberOfStgcPhiHoles] = 0; - information [numberOfMmHoles] = 0; + information [numberOfStgcPhiHoles] = 0; + information [numberOfMmHoles] = 0; m_muonTool->searchForHoles(track,information,Trk::muon) ; } - + } -- GitLab