diff --git a/InnerDetector/InDetRecTools/InDetTrackScoringTools/CMakeLists.txt b/InnerDetector/InDetRecTools/InDetTrackScoringTools/CMakeLists.txt index 2ce6e4c09fd1e58b954f2a7b2a58e48343cd6ed7..1f3115de07d13fe860c4674b5f069025c072fe0f 100644 --- a/InnerDetector/InDetRecTools/InDetTrackScoringTools/CMakeLists.txt +++ b/InnerDetector/InDetRecTools/InDetTrackScoringTools/CMakeLists.txt @@ -9,10 +9,12 @@ atlas_subdir( InDetTrackScoringTools ) atlas_depends_on_subdirs( PUBLIC Control/AthenaBaseComps Control/AthenaKernel + Control/SGTools GaudiKernel Tracking/TrkEvent/TrkEventPrimitives Tracking/TrkTools/TrkToolInterfaces PRIVATE + Control/StoreGate DetectorDescription/GeoPrimitives InnerDetector/InDetConditions/InDetBeamSpotService InnerDetector/InDetDetDescr/InDetIdentifier diff --git a/InnerDetector/InDetRecTools/InDetTrackScoringTools/InDetTrackScoringTools/InDetAmbiScoringTool.h b/InnerDetector/InDetRecTools/InDetTrackScoringTools/InDetTrackScoringTools/InDetAmbiScoringTool.h index d581ffb263493e8567a0027642054b6e74f2fa01..985bedf39079f7168500d663eb20570d04892ab6 100755 --- a/InnerDetector/InDetRecTools/InDetTrackScoringTools/InDetTrackScoringTools/InDetAmbiScoringTool.h +++ b/InnerDetector/InDetRecTools/InDetTrackScoringTools/InDetTrackScoringTools/InDetAmbiScoringTool.h @@ -16,6 +16,7 @@ #include "TrkToolInterfaces/ITrackScoringTool.h" #include "TrkToolInterfaces/ITrackSummaryTool.h" #include "TrkParameters/TrackParameters.h" +#include "SGTools/CLASS_DEF.h" #include "AthenaKernel/IOVSvcDefs.h" #include <vector> #include <string> @@ -39,35 +40,46 @@ class ITrtDriftCircleCutTool; /**Concrete implementation of the ITrackScoringTool pABC*/ class InDetAmbiScoringTool : virtual public Trk::ITrackScoringTool, - virtual public IIncidentListener, public AthAlgTool { public: InDetAmbiScoringTool(const std::string&,const std::string&,const IInterface*); virtual ~InDetAmbiScoringTool (); - virtual StatusCode initialize(); - virtual StatusCode finalize (); - /** handle for incident service */ - virtual void handle(const Incident& inc); + virtual StatusCode initialize() override; + virtual StatusCode finalize () override; /** create a score based on how good the passed track is*/ - Trk::TrackScore score( const Trk::Track& track, const bool suppressHoleSearch ); + virtual Trk::TrackScore score( const Trk::Track& track, const bool suppressHoleSearch ) const override; /** create a score based on how good the passed TrackSummary is*/ - Trk::TrackScore simpleScore( const Trk::Track& track, const Trk::TrackSummary& trackSum ); - Trk::TrackScore ambigScore( const Trk::Track& track, const Trk::TrackSummary& trackSum ); - + virtual Trk::TrackScore simpleScore( const Trk::Track& track, const Trk::TrackSummary& trackSum ) const override; + Trk::TrackScore ambigScore( const Trk::Track& track, const Trk::TrackSummary& trackSum ) const; + + struct ROIInfo { + ROIInfo (double the_emF, + //double the_emE, + double the_emR, + double the_emZ) + : emF(the_emF), + //emE(the_emE), + emR(the_emR), + emZ(the_emZ) {} + double emF; + //double emE; + double emR; + double emZ; + }; + typedef std::vector<ROIInfo> ROIInfoVec; + private: + const ROIInfoVec* getInfo() const; void setupScoreModifiers(); /** Check if the cluster is compatible with a EM cluster*/ - bool isEmCaloCompatible(const Trk::Track& track) const; - - /** Fill hadronic & EM cluster map*/ - void newEvent(); - + bool isEmCaloCompatible(const Trk::Track& track, + const ROIInfoVec* info) const; //these are used for ScoreModifiers @@ -92,9 +104,6 @@ class InDetAmbiScoringTool : virtual public Trk::ITrackScoringTool, ToolHandle<Trk::IExtrapolator> m_extrapolator; ServiceHandle<MagField::IMagFieldSvc> m_magFieldSvc; - /** IncidentSvc to catch begining of event and end of event */ - ServiceHandle<IIncidentSvc> m_incidentSvc; - /** use the scoring tuned to Ambiguity processing or not */ bool m_useAmbigFcn; @@ -107,7 +116,7 @@ class InDetAmbiScoringTool : virtual public Trk::ITrackScoringTool, /** cuts for selecting good tracks*/ int m_minNDF; //!< minimal number of degrees of freedom cut - bool m_fieldOn; //!< do we have field on ? + //bool m_fieldOn; //!< do we have field on ? double m_minPt; //!< minimal Pt cut double m_maxEta; //!< maximal Eta cut double m_maxRPhiImp; //!< maximal RPhi impact parameter cut @@ -122,23 +131,17 @@ class InDetAmbiScoringTool : virtual public Trk::ITrackScoringTool, int m_minPixel; //!< minimum number of pixel clusters double m_maxRPhiImpEM; //!< maximal RPhi impact parameter cut track that match EM clusters - mutable bool m_holesearch; - bool m_useEmClusSeed; float m_minPtEm; float m_phiWidthEm; float m_etaWidthEm; std::string m_inputEmClusterContainerName; - std::vector<double> m_emF; - std::vector<double> m_emE; - std::vector<double> m_emR; - std::vector<double> m_emZ; - - bool m_mapFilled; - }; -} +} // namespace InDet + + +CLASS_DEF (InDet::InDetAmbiScoringTool::ROIInfoVec, 169195041, 0) #endif diff --git a/InnerDetector/InDetRecTools/InDetTrackScoringTools/InDetTrackScoringTools/InDetCosmicScoringTool.h b/InnerDetector/InDetRecTools/InDetTrackScoringTools/InDetTrackScoringTools/InDetCosmicScoringTool.h index dfef02840580c1af322e04579856d37a7bd83f81..5ebdd6a59326e673d93c7c8aa77bf80328aae452 100755 --- a/InnerDetector/InDetRecTools/InDetTrackScoringTools/InDetTrackScoringTools/InDetCosmicScoringTool.h +++ b/InnerDetector/InDetRecTools/InDetTrackScoringTools/InDetTrackScoringTools/InDetCosmicScoringTool.h @@ -31,13 +31,15 @@ class InDetCosmicScoringTool : virtual public Trk::ITrackScoringTool, public Ath public: InDetCosmicScoringTool(const std::string&,const std::string&,const IInterface*); virtual ~InDetCosmicScoringTool (); - virtual StatusCode initialize(); - virtual StatusCode finalize (); + virtual StatusCode initialize() override; + virtual StatusCode finalize () override; /** create a score based on how good the passed track is*/ - Trk::TrackScore score( const Trk::Track& track, const bool suppressHoleSearch ); + virtual + Trk::TrackScore score( const Trk::Track& track, const bool suppressHoleSearch ) const override; /** create a score based on how good the passed TrackSummary is*/ - Trk::TrackScore simpleScore( const Trk::Track& track, const Trk::TrackSummary& trackSum ); + virtual + Trk::TrackScore simpleScore( const Trk::Track& track, const Trk::TrackSummary& trackSum ) const override; private: diff --git a/InnerDetector/InDetRecTools/InDetTrackScoringTools/InDetTrackScoringTools/InDetTrtTrackScoringTool.h b/InnerDetector/InDetRecTools/InDetTrackScoringTools/InDetTrackScoringTools/InDetTrtTrackScoringTool.h index 595c17e9dc15b967dc54cf571d1c535969d832d7..40a0c6b8624fb8a882e82e6d13d7386e4ed95aac 100755 --- a/InnerDetector/InDetRecTools/InDetTrackScoringTools/InDetTrackScoringTools/InDetTrtTrackScoringTool.h +++ b/InnerDetector/InDetRecTools/InDetTrackScoringTools/InDetTrackScoringTools/InDetTrtTrackScoringTool.h @@ -37,28 +37,28 @@ class InDetTrtTrackScoringTool : virtual public Trk::ITrackScoringTool, public A public: InDetTrtTrackScoringTool(const std::string&,const std::string&,const IInterface*); virtual ~InDetTrtTrackScoringTool (); - virtual StatusCode initialize(); - virtual StatusCode finalize (); + virtual StatusCode initialize() override; + virtual StatusCode finalize () override; /** create a score based on how good the passed track is*/ - Trk::TrackScore score( const Trk::Track& track, const bool suppressHoleSearch ); + virtual Trk::TrackScore score( const Trk::Track& track, const bool suppressHoleSearch ) const override; /** create a score based on how good the passed TrackSummary is*/ - Trk::TrackScore simpleScore( const Trk::Track& track, const Trk::TrackSummary& trackSum ); + virtual Trk::TrackScore simpleScore( const Trk::Track& track, const Trk::TrackSummary& trackSum ) const override; - Trk::TrackScore TRT_ambigScore( const Trk::Track& track, const Trk::TrackSummary& trackSum ); + Trk::TrackScore TRT_ambigScore( const Trk::Track& track, const Trk::TrackSummary& trackSum ) const; private: void setupTRT_ScoreModifiers(); /** Decide whether standalone TRT tracks pass the minimum hit requirement. */ - bool isGoodTRT(const Trk::Track&); + bool isGoodTRT(const Trk::Track&) const; /**ID TRT helper*/ const TRT_ID* m_trtId; //these are used for ScoreModifiers - int m_maxSigmaChi2, m_maxTRT_Hits, m_maxLogProb, m_maxTrtRatio, m_maxTrtFittedRatio; + int m_maxSigmaChi2, m_maxLogProb, m_maxTrtRatio, m_maxTrtFittedRatio; std::vector<double> m_factorSigmaChi2, m_factorLogProb, m_factorTrtRatio, m_factorTrtFittedRatio; @@ -84,7 +84,6 @@ private: /** cuts for selecting good tracks*/ int m_minTRTonTrk; //!< minimum number of TRT hits double m_maxEta; //!< maximal Eta cut - bool m_fieldOn; //!< do we have field on ? double m_ptmin; //!< Minimum Pt bool m_parameterization; //!< use parameterization to cut instead of custom cut bool m_oldLogic; //!< use old transition hit logic diff --git a/InnerDetector/InDetRecTools/InDetTrackScoringTools/cmt/requirements b/InnerDetector/InDetRecTools/InDetTrackScoringTools/cmt/requirements index 429b1f72df90dce87e6aca08afc4593fb40df732..3fe1d9ce69952d3a5e3248d4fdc5378c187c38ec 100755 --- a/InnerDetector/InDetRecTools/InDetTrackScoringTools/cmt/requirements +++ b/InnerDetector/InDetRecTools/InDetTrackScoringTools/cmt/requirements @@ -8,6 +8,7 @@ apply_tag rootMathLibs use AtlasCLHEP AtlasCLHEP-* External use AtlasROOT AtlasROOT-* External +use StoreGate StoreGate-* Control use TrkTrack TrkTrack-* Tracking/TrkEvent use TrkTrackSummary TrkTrackSummary-* Tracking/TrkEvent use TrkPseudoMeasurementOnTrack TrkPseudoMeasurementOnTrack-* Tracking/TrkEvent @@ -28,6 +29,7 @@ use TrkEventPrimitives TrkEventPrimitives-* Tracking/TrkEvent use TrkParameters TrkParameters-* Tracking/TrkEvent use TrkToolInterfaces TrkToolInterfaces-* Tracking/TrkTools use AthenaKernel AthenaKernel-* Control +use SGTools SGTools-* Control branches InDetTrackScoringTools src diff --git a/InnerDetector/InDetRecTools/InDetTrackScoringTools/src/InDetAmbiScoringTool.cxx b/InnerDetector/InDetRecTools/InDetTrackScoringTools/src/InDetAmbiScoringTool.cxx index b51385e5eadefb854d546755f4e2a7d52601a6d1..94cebce8d3518a9dd6b1f12d73f86e2e9ee40b9b 100755 --- a/InnerDetector/InDetRecTools/InDetTrackScoringTools/src/InDetAmbiScoringTool.cxx +++ b/InnerDetector/InDetRecTools/InDetTrackScoringTools/src/InDetAmbiScoringTool.cxx @@ -21,6 +21,8 @@ #include "GeoPrimitives/GeoPrimitives.h" #include "TrkCaloClusterROI/CaloClusterROI.h" #include "TrkCaloClusterROI/CaloClusterROI_Collection.h" +#include "StoreGate/ReadHandle.h" +#include "StoreGate/WriteHandle.h" //--------------------------------------------------------------------------------------------------------------------- @@ -33,10 +35,7 @@ InDet::InDetAmbiScoringTool::InDetAmbiScoringTool(const std::string& t, m_selectortool("InDet::InDetTrtDriftCircleCutTool"), m_summaryTypeScore(Trk::numberOfTrackSummaryTypes), m_iBeamCondSvc("BeamCondSvc",n), - m_magFieldSvc("AtlasFieldSvc",n), - m_incidentSvc("IncidentSvc", n), - m_fieldOn(true), - m_holesearch(false) + m_magFieldSvc("AtlasFieldSvc",n) { declareInterface<Trk::ITrackScoringTool>(this); @@ -123,58 +122,48 @@ StatusCode InDet::InDetAmbiScoringTool::initialize() sc = m_trkSummaryTool.retrieve(); if (sc.isFailure()) { - msg(MSG::FATAL) << "Failed to retrieve tool " << m_trkSummaryTool << endreq; + msg(MSG::FATAL) << "Failed to retrieve tool " << m_trkSummaryTool << endmsg; return StatusCode::FAILURE; } else - msg(MSG::DEBUG) << "Retrieved tool " << m_trkSummaryTool << endreq; + msg(MSG::DEBUG) << "Retrieved tool " << m_trkSummaryTool << endmsg; sc = m_extrapolator.retrieve(); if (sc.isFailure()) { - msg(MSG::FATAL) << "Failed to retrieve tool " << m_extrapolator << endreq; + msg(MSG::FATAL) << "Failed to retrieve tool " << m_extrapolator << endmsg; return StatusCode::FAILURE; } else - msg(MSG::DEBUG) << "Retrieved tool " << m_extrapolator << endreq; + msg(MSG::DEBUG) << "Retrieved tool " << m_extrapolator << endmsg; // Get segment selector tool // if(m_selectortool.retrieve().isFailure()) { - msg(MSG::FATAL)<<"Failed to retrieve tool "<< m_selectortool <<endreq; + msg(MSG::FATAL)<<"Failed to retrieve tool "<< m_selectortool <<endmsg; return StatusCode::FAILURE; } else { - msg(MSG::DEBUG) << "Retrieved tool " << m_selectortool << endreq; + msg(MSG::DEBUG) << "Retrieved tool " << m_selectortool << endmsg; } sc = m_iBeamCondSvc.retrieve(); if (sc.isFailure()) { - msg(MSG::DEBUG) << "Could not find BeamCondSvc." << endreq; + msg(MSG::DEBUG) << "Could not find BeamCondSvc." << endmsg; return StatusCode::FAILURE; } sc = m_magFieldSvc.retrieve(); if (sc.isFailure()){ - msg(MSG::FATAL) << "Failed to retrieve " << m_magFieldSvc << endreq; + msg(MSG::FATAL) << "Failed to retrieve " << m_magFieldSvc << endmsg; return StatusCode::FAILURE; } else { - msg(MSG::DEBUG) << "Retrieved " << m_magFieldSvc << endreq; + msg(MSG::DEBUG) << "Retrieved " << m_magFieldSvc << endmsg; } if (m_useAmbigFcn && m_useTRT_AmbigFcn) { - msg(MSG::FATAL) << "Both on, normal ambi funciton and the one for back tracking, configuration problem, not recoverable" << endreq; + msg(MSG::FATAL) << "Both on, normal ambi funciton and the one for back tracking, configuration problem, not recoverable" << endmsg; return StatusCode::FAILURE; } - if (m_incidentSvc.retrieve().isFailure()){ - ATH_MSG_WARNING("Can not retrieve " << m_incidentSvc << ". Exiting."); - return StatusCode::FAILURE; - } - - // register to the incident service: EndEvent needed for memory cleanup - m_incidentSvc->addListener( this, "BeginEvent"); - - - if (m_useAmbigFcn || m_useTRT_AmbigFcn) setupScoreModifiers(); return StatusCode::SUCCESS; @@ -190,10 +179,8 @@ StatusCode InDet::InDetAmbiScoringTool::finalize() //--------------------------------------------------------------------------------------------------------------------- -Trk::TrackScore InDet::InDetAmbiScoringTool::score( const Trk::Track& track, const bool suppressHoleSearch ) +Trk::TrackScore InDet::InDetAmbiScoringTool::score( const Trk::Track& track, const bool suppressHoleSearch ) const { - m_holesearch = !suppressHoleSearch; - const Trk::TrackSummary* summary; if ( suppressHoleSearch) { ATH_MSG_DEBUG ("Get summary for new Track, suppress HoleSearch"); @@ -214,11 +201,8 @@ Trk::TrackScore InDet::InDetAmbiScoringTool::score( const Trk::Track& track, con //--------------------------------------------------------------------------------------------------------------------- -Trk::TrackScore InDet::InDetAmbiScoringTool::simpleScore( const Trk::Track& track, const Trk::TrackSummary& trackSummary ) +Trk::TrackScore InDet::InDetAmbiScoringTool::simpleScore( const Trk::Track& track, const Trk::TrackSummary& trackSummary ) const { - if(!m_mapFilled) - newEvent(); - int numPixel = trackSummary.get(Trk::numberOfPixelHits); int numSCT = trackSummary.get(Trk::numberOfSCTHits); int numTRT = trackSummary.get(Trk::numberOfTRTHits); @@ -333,7 +317,7 @@ Trk::TrackScore InDet::InDetAmbiScoringTool::simpleScore( const Trk::Track& trac const Trk::Perigee*extrapolatedPerigee = dynamic_cast<const Trk::Perigee*> (parm ); if (!extrapolatedPerigee) { - msg(MSG::WARNING) << "Extrapolation of perigee failed, this should never happen" << endreq; + msg(MSG::WARNING) << "Extrapolation of perigee failed, this should never happen" << endmsg; delete parm; return Trk::TrackScore(0); } @@ -346,7 +330,11 @@ Trk::TrackScore InDet::InDetAmbiScoringTool::simpleScore( const Trk::Track& trac } double maxD0 = m_maxRPhiImp; - if(m_useEmClusSeed && isEmCaloCompatible( track ) ) maxD0 = m_maxRPhiImpEM; + if(m_useEmClusSeed) { + const ROIInfoVec* info = getInfo(); + if (isEmCaloCompatible( track, info ) ) + maxD0 = m_maxRPhiImpEM; + } if (fabs(extrapolatedPerigee->parameters()[Trk::d0]) > maxD0) { ATH_MSG_DEBUG ("Track Rphi impact > "<<m_maxRPhiImp<<", reject it"); delete extrapolatedPerigee; @@ -401,7 +389,7 @@ Trk::TrackScore InDet::InDetAmbiScoringTool::simpleScore( const Trk::Track& trac //--------------------------------------------------------------------------------------------------------------------- -Trk::TrackScore InDet::InDetAmbiScoringTool::ambigScore( const Trk::Track& track, const Trk::TrackSummary& trackSummary ) +Trk::TrackScore InDet::InDetAmbiScoringTool::ambigScore( const Trk::Track& track, const Trk::TrackSummary& trackSummary ) const { // // --- start with bonus for high pt tracks @@ -619,7 +607,7 @@ Trk::TrackScore InDet::InDetAmbiScoringTool::ambigScore( const Trk::Track& track int sigmaChi2times100 = trackSummary.get(Trk::standardDeviationOfChi2OS); if (sigmaChi2times100 > 0) { double testvar = double(sigmaChi2times100)/100. - sqrt(2.*chi2/ndf); - if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "sigma chi2 = " << testvar << endreq; + if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "sigma chi2 = " << testvar << endmsg; if ( testvar< m_boundsSigmaChi2[0] ) { prob *= m_factorSigmaChi2[0]; ATH_MSG_DEBUG ("Modifier for " << testvar << " sigma chi2: "<< m_factorSigmaChi2[0] @@ -860,93 +848,87 @@ void InDet::InDetAmbiScoringTool::setupScoreModifiers() if (msgLvl(MSG::VERBOSE)) { for (int i=0; i<=m_maxPixHoles; ++i) - msg(MSG::VERBOSE) << "Modifier for " << i << " Pixel holes: " << m_factorPixHoles[i] <<endreq; + msg(MSG::VERBOSE) << "Modifier for " << i << " Pixel holes: " << m_factorPixHoles[i] <<endmsg; for (int i=0; i<=m_maxSCT_Holes; ++i) - msg(MSG::VERBOSE) << "Modifier for " << i << " SCT holes: " << m_factorSCT_Holes[i] <<endreq; + msg(MSG::VERBOSE) << "Modifier for " << i << " SCT holes: " << m_factorSCT_Holes[i] <<endmsg; for (int i=0; i<=m_maxDblHoles; ++i) - msg(MSG::VERBOSE) << "Modifier for " << i << " double SCT holes: " << m_factorDblHoles[i] <<endreq; + msg(MSG::VERBOSE) << "Modifier for " << i << " double SCT holes: " << m_factorDblHoles[i] <<endmsg; for (int i=0; i<=m_maxPixLay; ++i) - msg(MSG::VERBOSE) << "Modifier for " << i << " Pixel layers: " << m_factorPixLay[i] <<endreq; + msg(MSG::VERBOSE) << "Modifier for " << i << " Pixel layers: " << m_factorPixLay[i] <<endmsg; for (int i=0; i<=m_maxB_LayerHits; ++i) - msg(MSG::VERBOSE) << "Modifier for " << i << " b-layer hits: " << m_factorB_LayerHits[i] <<endreq; + msg(MSG::VERBOSE) << "Modifier for " << i << " b-layer hits: " << m_factorB_LayerHits[i] <<endmsg; for (int i=0; i<=m_maxPixelHits; ++i) - msg(MSG::VERBOSE) << "Modifier for " << i << " Pixel hits: " << m_factorPixelHits[i] <<endreq; + msg(MSG::VERBOSE) << "Modifier for " << i << " Pixel hits: " << m_factorPixelHits[i] <<endmsg; for (int i=0; i<=m_maxGangedFakes; ++i) - msg(MSG::VERBOSE) << "Modifier for " << i << " ganged fakes: " << m_factorGangedFakes[i] <<endreq; + msg(MSG::VERBOSE) << "Modifier for " << i << " ganged fakes: " << m_factorGangedFakes[i] <<endmsg; for (int i=0; i<=m_maxHits; ++i) - msg(MSG::VERBOSE) << "Modifier for " << i << " Si hits: " << m_factorHits[i] <<endreq; + msg(MSG::VERBOSE) << "Modifier for " << i << " Si hits: " << m_factorHits[i] <<endmsg; for (int i=0; i<m_maxTrtRatio; ++i) msg(MSG::VERBOSE) << "Modifier for " << m_boundsTrtRatio[i] << " < TRT ratio < " - << m_boundsTrtRatio[i+1] <<" : " <<m_factorTrtRatio[i] <<endreq; + << m_boundsTrtRatio[i+1] <<" : " <<m_factorTrtRatio[i] <<endmsg; for (int i=0; i<m_maxTrtFittedRatio; ++i) msg(MSG::VERBOSE) << "Modifier for " << m_boundsTrtFittedRatio[i] << " < TRT fitted ratio < " - << m_boundsTrtFittedRatio[i+1] <<" : " <<m_factorTrtFittedRatio[i] <<endreq; + << m_boundsTrtFittedRatio[i+1] <<" : " <<m_factorTrtFittedRatio[i] <<endmsg; // only if used for (int i=0; i<m_maxLogProb; ++i) msg(MSG::VERBOSE) << "Modifier for " << m_boundsLogProb[i] << " < log(P) < " - << m_boundsLogProb[i+1] <<" : " <<m_factorLogProb[i] <<endreq; + << m_boundsLogProb[i+1] <<" : " <<m_factorLogProb[i] <<endmsg; // only if used for (int i=0; i<m_maxSigmaChi2; ++i) msg(MSG::VERBOSE) << "Modifier for " << m_boundsSigmaChi2[i] << " < sigma(chi2) - sqrt(2chi2) < " << m_boundsSigmaChi2[i+1] - <<" : " <<m_factorSigmaChi2[i] <<endreq; + <<" : " <<m_factorSigmaChi2[i] <<endmsg; } } -void InDet::InDetAmbiScoringTool::handle(const Incident& inc) -{ - // the cluster ambiguity map - if ( inc.type() == IncidentType::BeginEvent ){ - m_mapFilled =false; - } -} - - -void InDet::InDetAmbiScoringTool::newEvent() +const InDet::InDetAmbiScoringTool::ROIInfoVec* +InDet::InDetAmbiScoringTool::getInfo() const { - // Reload ROI's - if(m_useEmClusSeed) { - m_emF.clear(); - m_emE.clear(); - m_emR.clear(); - m_emZ.clear(); - - const CaloClusterROI_Collection* calo = 0; - StatusCode sc = evtStore()->retrieve(calo,m_inputEmClusterContainerName); - - if(sc == StatusCode::SUCCESS && calo) { - for( auto& ccROI : *calo) { - if( ccROI->energy() * sin(ccROI->globalPosition().theta()) < m_minPtEm){ - continue; - } - m_emF.push_back( ccROI->globalPosition().phi() ); - m_emE.push_back( ccROI->globalPosition().eta() ); - m_emR.push_back( ccROI->globalPosition().perp() ); - m_emZ.push_back( ccROI->globalPosition().z() ); - } + std::string roiname = name() + "ROIInfoVec"; + SG::ReadHandle<ROIInfoVec> rh (roiname); + if (rh.isValid()) + return rh.cptr(); + + const CaloClusterROI_Collection* calo = nullptr; + StatusCode sc = evtStore()->retrieve(calo,m_inputEmClusterContainerName); + + if(sc == StatusCode::SUCCESS && calo) { + auto info = std::make_unique<ROIInfoVec>(); + for( const Trk::CaloClusterROI* ccROI : *calo) { + if( ccROI->energy() * sin(ccROI->globalPosition().theta()) < m_minPtEm){ + continue; + } + info->emplace_back( ccROI->globalPosition().phi(), + ccROI->globalPosition().perp(), + ccROI->globalPosition().z() ); } + + SG::WriteHandle<ROIInfoVec> wh (roiname); + return wh.put (std::move(info), true); } - m_mapFilled = true; + + return nullptr; } //========================================================================================== -bool InDet::InDetAmbiScoringTool::isEmCaloCompatible(const Trk::Track& track) const +bool InDet::InDetAmbiScoringTool::isEmCaloCompatible(const Trk::Track& track, + const ROIInfoVec* info) const { - + const Trk::TrackParameters * Tp = track.trackParameters()->front(); @@ -968,33 +950,25 @@ bool InDet::InDetAmbiScoringTool::isEmCaloCompatible(const Trk::Track& track) co const double pi = M_PI, pi2 = 2.*M_PI; - if(m_emF.empty()) return false; - - auto f = m_emF.begin(), fe = m_emF.end(); - auto e = m_emE.begin(); - auto r = m_emR.begin(); - auto z = m_emZ.begin(); + if(!info || info->empty()) return false; double F = Tp->momentum().phi(); double E = Tp->momentum().eta(); double R = Tp->position().perp(); double Z = Tp->position().z(); - for(; f!=fe; ++f) { - double df = fabs(F-(*f)); + for (const ROIInfo& i : *info) { + double df = fabs(F-(i.emF)); if(df > pi ) df = fabs(pi2-df); if(df < m_phiWidthEm) { //Correct eta of cluster to take into account the z postion of the track - double newZ = *z - Z; - double newR = *r - R; + double newZ = i.emZ - Z; + double newR = i.emR - R; double newEta = atanh( newZ / sqrt( newR*newR + newZ*newZ ) ); double de = fabs(E-newEta); if(de < m_etaWidthEm) return true; } - ++e; - ++r; - ++z; } return false; } diff --git a/InnerDetector/InDetRecTools/InDetTrackScoringTools/src/InDetCosmicScoringTool.cxx b/InnerDetector/InDetRecTools/InDetTrackScoringTools/src/InDetCosmicScoringTool.cxx index 2b697a870a02a1c2cb90de08b0d9087dcb2ee1fb..07203a37df2e1a66f326b88753faae8ed1c40ae9 100755 --- a/InnerDetector/InDetRecTools/InDetTrackScoringTools/src/InDetCosmicScoringTool.cxx +++ b/InnerDetector/InDetRecTools/InDetTrackScoringTools/src/InDetCosmicScoringTool.cxx @@ -40,10 +40,10 @@ StatusCode InDet::InDetCosmicScoringTool::initialize() sc = m_trkSummaryTool.retrieve(); if (sc.isFailure()) { - msg(MSG::FATAL) << "Failed to retrieve tool " << m_trkSummaryTool << endreq; + msg(MSG::FATAL) << "Failed to retrieve tool " << m_trkSummaryTool << endmsg; return StatusCode::FAILURE; } else - msg(MSG::INFO) << "Retrieved tool " << m_trkSummaryTool << endreq; + msg(MSG::INFO) << "Retrieved tool " << m_trkSummaryTool << endmsg; return StatusCode::SUCCESS; } @@ -58,7 +58,7 @@ StatusCode InDet::InDetCosmicScoringTool::finalize() //--------------------------------------------------------------------------------------------------------------------- -Trk::TrackScore InDet::InDetCosmicScoringTool::score( const Trk::Track& track, const bool suppressHoleSearch ) +Trk::TrackScore InDet::InDetCosmicScoringTool::score( const Trk::Track& track, const bool suppressHoleSearch ) const { const Trk::TrackSummary* summary; if ( suppressHoleSearch) @@ -66,22 +66,22 @@ Trk::TrackScore InDet::InDetCosmicScoringTool::score( const Trk::Track& track, c else summary = m_trkSummaryTool->createSummary(track); - if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE)<<"Track has TrackSummary "<<*summary<<endreq; + if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE)<<"Track has TrackSummary "<<*summary<<endmsg; Trk::TrackScore score = Trk::TrackScore( simpleScore(track, *summary) ); - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG)<<"Track has Score: "<<score<<endreq; + if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG)<<"Track has Score: "<<score<<endmsg; delete summary; return score; } //--------------------------------------------------------------------------------------------------------------------- -Trk::TrackScore InDet::InDetCosmicScoringTool::simpleScore( const Trk::Track& track, const Trk::TrackSummary& trackSummary ) +Trk::TrackScore InDet::InDetCosmicScoringTool::simpleScore( const Trk::Track& track, const Trk::TrackSummary& trackSummary ) const { - if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Summary for track: " << trackSummary << endreq; + if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Summary for track: " << trackSummary << endmsg; if (!track.fitQuality()){ - msg(MSG::WARNING) << "No fit quality! Track info=" << track.info().dumpInfo() << endreq; + msg(MSG::WARNING) << "No fit quality! Track info=" << track.info().dumpInfo() << endmsg; return Trk::TrackScore(track.measurementsOnTrack()->size()); } else { @@ -92,7 +92,7 @@ Trk::TrackScore InDet::InDetCosmicScoringTool::simpleScore( const Trk::Track& tr int nWeightedClusters = 2 * pixelhits + scthits; if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "pixelhits: " << pixelhits << "; scthits: " << scthits - << "; trthits: " << trthits << "; nWeightedClusters: " << nWeightedClusters << endreq; + << "; trthits: " << trthits << "; nWeightedClusters: " << nWeightedClusters << endmsg; if ((nWeightedClusters >= m_nWeightedClustersMin) and (trthits >= m_minTRTHits)){ // calculate track score only if min number of hits @@ -113,7 +113,7 @@ Trk::TrackScore InDet::InDetCosmicScoringTool::simpleScore( const Trk::Track& tr if (track.fitQuality()->numberDoF() > 0) fitscore = 0.0001*track.fitQuality()->chiSquared() / track.fitQuality()->numberDoF(); - if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "track score: " << hitscore - 0.25*tubehits - fitscore << endreq; + if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "track score: " << hitscore - 0.25*tubehits - fitscore << endmsg; return Trk::TrackScore (hitscore - 0.25*tubehits - fitscore); } diff --git a/InnerDetector/InDetRecTools/InDetTrackScoringTools/src/InDetTrtTrackScoringTool.cxx b/InnerDetector/InDetRecTools/InDetTrackScoringTools/src/InDetTrtTrackScoringTool.cxx index 06597e6b5006f7215d00b73aaa569ee7c7e66079..36e0b3038603363b1dcce4482588e85c27a9bf78 100755 --- a/InnerDetector/InDetRecTools/InDetTrackScoringTools/src/InDetTrtTrackScoringTool.cxx +++ b/InnerDetector/InDetRecTools/InDetTrackScoringTools/src/InDetTrtTrackScoringTool.cxx @@ -65,33 +65,33 @@ StatusCode InDet::InDetTrtTrackScoringTool::initialize() sc = m_trkSummaryTool.retrieve(); if (sc.isFailure()) { - msg(MSG::FATAL) << "Failed to retrieve tool " << m_trkSummaryTool << endreq; + msg(MSG::FATAL) << "Failed to retrieve tool " << m_trkSummaryTool << endmsg; return StatusCode::FAILURE; } else { - msg(MSG::DEBUG) << "Retrieved tool " << m_trkSummaryTool << endreq; + msg(MSG::DEBUG) << "Retrieved tool " << m_trkSummaryTool << endmsg; } // Get segment selector tool // if(m_selectortool.retrieve().isFailure()) { - msg(MSG::FATAL)<<"Failed to retrieve tool "<< m_selectortool <<endreq; + msg(MSG::FATAL)<<"Failed to retrieve tool "<< m_selectortool <<endmsg; return StatusCode::FAILURE; } else { - msg(MSG::DEBUG) << "Retrieved tool " << m_selectortool << endreq; + msg(MSG::DEBUG) << "Retrieved tool " << m_selectortool << endmsg; } sc = m_magFieldSvc.retrieve(); if (sc.isFailure()){ - msg(MSG::FATAL) << "Failed to retrieve " << m_magFieldSvc << endreq; + msg(MSG::FATAL) << "Failed to retrieve " << m_magFieldSvc << endmsg; return StatusCode::FAILURE; } else { - msg(MSG::DEBUG) << "Retrieved " << m_magFieldSvc << endreq; + msg(MSG::DEBUG) << "Retrieved " << m_magFieldSvc << endmsg; } sc = detStore()->retrieve(m_trtId, "TRT_ID"); if (sc.isFailure()){ - msg(MSG::FATAL) << "Could not get TRT_ID helper !" << endreq; + msg(MSG::FATAL) << "Could not get TRT_ID helper !" << endmsg; return StatusCode::FAILURE; } @@ -110,7 +110,7 @@ StatusCode InDet::InDetTrtTrackScoringTool::finalize() //--------------------------------------------------------------------------------------------------------------------- -Trk::TrackScore InDet::InDetTrtTrackScoringTool::score( const Trk::Track& track, const bool suppressHoleSearch ) +Trk::TrackScore InDet::InDetTrtTrackScoringTool::score( const Trk::Track& track, const bool suppressHoleSearch ) const { const Trk::TrackSummary* summary; if ( suppressHoleSearch) @@ -127,7 +127,7 @@ Trk::TrackScore InDet::InDetTrtTrackScoringTool::score( const Trk::Track& track, //--------------------------------------------------------------------------------------------------------------------- -Trk::TrackScore InDet::InDetTrtTrackScoringTool::simpleScore( const Trk::Track& track, const Trk::TrackSummary& trackSummary ) +Trk::TrackScore InDet::InDetTrtTrackScoringTool::simpleScore( const Trk::Track& track, const Trk::TrackSummary& trackSummary ) const { int numTRT = trackSummary.get(Trk::numberOfTRTHits); int numTRTTube = trackSummary.get(Trk::numberOfTRTTubeHits); @@ -202,7 +202,7 @@ Trk::TrackScore InDet::InDetTrtTrackScoringTool::simpleScore( const Trk::Track& //--------------------------------------------------------------------------------------------------------------- -Trk::TrackScore InDet::InDetTrtTrackScoringTool::TRT_ambigScore( const Trk::Track& track, const Trk::TrackSummary& trackSummary ) +Trk::TrackScore InDet::InDetTrtTrackScoringTool::TRT_ambigScore( const Trk::Track& track, const Trk::TrackSummary& trackSummary ) const { // // --- start with bonus for high pt tracks @@ -443,7 +443,7 @@ void InDet::InDetTrtTrackScoringTool::setupTRT_ScoreModifiers() } } -bool InDet::InDetTrtTrackScoringTool::isGoodTRT(const Trk::Track& track) +bool InDet::InDetTrtTrackScoringTool::isGoodTRT(const Trk::Track& track) const { int nTRT = 0;