diff --git a/InnerDetector/InDetCosmics/TRT_SegmentsToTrack/CMakeLists.txt b/InnerDetector/InDetCosmics/TRT_SegmentsToTrack/CMakeLists.txt index 867be991f1c72875941be555a3a2230e2ab9ea80..4e9538297dc4c26e644044a15380978d8d759d08 100644 --- a/InnerDetector/InDetCosmics/TRT_SegmentsToTrack/CMakeLists.txt +++ b/InnerDetector/InDetCosmics/TRT_SegmentsToTrack/CMakeLists.txt @@ -28,7 +28,8 @@ atlas_depends_on_subdirs( PUBLIC Tracking/TrkEvent/TrkTrack Tracking/TrkEvent/TrkTruthData Tracking/TrkExtrapolation/TrkExInterfaces - Tracking/TrkFitter/TrkFitterInterfaces ) + Tracking/TrkFitter/TrkFitterInterfaces + Tracking/TrkTools/TrkToolInterfaces ) # External dependencies: find_package( Eigen ) @@ -38,7 +39,7 @@ atlas_add_component( TRT_SegmentsToTrack src/*.cxx src/components/*.cxx INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${EIGEN_LIBRARIES} AthContainers AthenaBaseComps GaudiKernel AtlasDetDescr GeoPrimitives Identifier EventPrimitives InDetIdentifier InDetPrepRawData InDetRIO_OnTrack TrkSurfaces TrkEventUtils TrkParameters TrkPseudoMeasurementOnTrack TrkRIO_OnTrack TrkSegment TrkTrack TrkTruthData TrkExInterfaces TrkFitterInterfaces ) + LINK_LIBRARIES ${EIGEN_LIBRARIES} AthContainers AthenaBaseComps GaudiKernel AtlasDetDescr GeoPrimitives Identifier EventPrimitives InDetIdentifier InDetPrepRawData InDetRIO_OnTrack TrkSurfaces TrkEventUtils TrkParameters TrkPseudoMeasurementOnTrack TrkRIO_OnTrack TrkSegment TrkTrack TrkTruthData TrkExInterfaces TrkFitterInterfaces TrkToolInterfaces ) # Install files from the package: atlas_install_headers( TRT_SegmentsToTrack ) diff --git a/InnerDetector/InDetCosmics/TRT_SegmentsToTrack/TRT_SegmentsToTrack/TRT_SegmentsToTrack.h b/InnerDetector/InDetCosmics/TRT_SegmentsToTrack/TRT_SegmentsToTrack/TRT_SegmentsToTrack.h index d00a049d20bc2a5dd1f51b92e17b052da9684d4d..b6bcc788634cd49bd240785a8986291b88168cdc 100755 --- a/InnerDetector/InDetCosmics/TRT_SegmentsToTrack/TRT_SegmentsToTrack/TRT_SegmentsToTrack.h +++ b/InnerDetector/InDetCosmics/TRT_SegmentsToTrack/TRT_SegmentsToTrack/TRT_SegmentsToTrack.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 TRT_SEGMENTSTOTRACK_H @@ -20,15 +20,18 @@ #include "TrkTrack/TrackCollection.h" #include "TrkSegment/SegmentCollection.h" #include "TrkTruthData/PRD_MultiTruthCollection.h" - +#include "TrkToolInterfaces/IExtendedTrackSummaryTool.h" +#include "TrkFitterInterfaces/ITrackFitter.h" +#include "TrkExInterfaces/IExtrapolator.h" +// for shared hits: +#include "TrkToolInterfaces/IPRDtoTrackMapTool.h" +#include "TrkEventUtils/PRDtoTrackMap.h" class PRD_MultiTruthCollection; class AtlasDetectorID; class TRT_ID; namespace Trk { - class ITrackFitter; - class IExtrapolator; class Track; class Segment; } @@ -58,32 +61,40 @@ namespace InDet StatusCode finalize(); private: - - int getNumberReal(const InDet::TRT_DriftCircle*); //!< Get the number of truth particles associated with this hit + int getNumberReal(const InDet::TRT_DriftCircle*,const EventContext& ctx) const; //!< Get the number of truth particles associated with this hit - double getRealFraction(const Trk::Segment *segment); //!< Get the fraction of truth hits on this segment - double getRealFractionTRT(const Trk::Track *track); //!< Get the fraction of truth TRT hits on this Track - - double getNoiseProbability(const Trk::Track *track); //!< Get the fraction of noise TRT hits on this Track - - int nTRTHits(const Trk::Track *track); //!< Count number of TRT Hits on track - - int nHTHits(const Trk::Track *track); //!< Count number of TRT HT Hits on track + double getRealFractionTRT(const Trk::Track *track,const EventContext& ctx) const; //!< Get the fraction of truth TRT hits on this Track + double getNoiseProbability(const Trk::Track *track) const; //!< Get the fraction of noise TRT hits on this Track - bool validateTrack(const Trk::Track *track); //!< Check that this track has the right properties (moves towards positive z and radially inwards) + int nTRTHits(const Trk::Track *track) const; //!< Count number of TRT Hits on track - void combineSegments(void); + int nHTHits(const Trk::Track *track) const; //!< Count number of TRT HT Hits on track + + void combineSegments(const EventContext& ctx) const; SG::ReadHandleKey<Trk::SegmentCollection> m_inputSegmentCollectionName{this,"InputSegmentsCollection","TrackSegments","RHK to retrieve input track collection"}; //!< Name of the TrackSegment Collection to read in SG::WriteHandleKey<TrackCollection> m_outputTrackCollectionName{this,"OutputTrackCollection","SegmentTracks","WHK to store output tracks"}; //!< Name of the TrackCollection to write out - ToolHandle<Trk::ITrackFitter> m_trackFitter; //!< The TrackFitter + ToolHandle<Trk::ITrackFitter> m_trackFitter + {this,"TrackFitter","Trk::KalmanFitter/TrkKalmanFitter",""}; //!< The TrackFitter + + ToolHandle<Trk::IExtrapolator> m_extrapolator + {this,"ExtrapolationTool","Trk::Extrapolator/InDetExtrapolator",""}; //!< The Extrapolator + + ToolHandle<Trk::IExtendedTrackSummaryTool> m_trkSummaryTool + {this, "SummaryTool","",""}; + ToolHandle<Trk::IPRDtoTrackMapTool> m_assoTool + {this, "AssociationTool", "","" }; + /** key for the PRDtoTrackMap to filled by the ambiguity score processor.**/ + SG::WriteHandleKey<Trk::PRDtoTrackMap> m_assoMapName + {this,"AssociationMapName","",""}; ///< key to be set to optionally store PRD to track association map + SG::ReadHandleKey<Trk::PRDtoTrackMap> m_inputAssoMapName + {this,"InputAssociationMapName","",""}; ///< key to be set to optionally store PRD to track association map - ToolHandle<Trk::IExtrapolator> m_extrapolator; //!< The Extrapolator double m_noiseCut; //!< All tracks with a TRT Noise fraction larger than this variable will be thrown away int m_minTRTHits; //!< All tracks with less Hits (after the track fit) will be thrown away @@ -100,7 +111,7 @@ namespace InDet double m_noiseratio; //!< average percentage of noise in real tracks - int m_events; //!< Event counter + mutable std::atomic<int> m_events; //!< Event counter std::map<int,int> m_MapReal; //!< Map of hits and real tracks std::map<int,int> m_MapFake; //!< Map of hits and fake tracks @@ -115,11 +126,7 @@ namespace InDet SG::WriteHandleKey<TrackCollection> m_BECCollectionName{this,"BarrelEndcapTracks","TRT_Barrel_EC","WHK to write tracks"}; //!< Name of the combined (TRT Barrel+EC) TrackCollection to write out - std::string m_dummy; - bool m_dummy_bool; - - - int m_n_combined_fit; + mutable std::atomic<int> m_n_combined_fit; diff --git a/InnerDetector/InDetCosmics/TRT_SegmentsToTrack/src/TRT_SegmentsToTrack.cxx b/InnerDetector/InDetCosmics/TRT_SegmentsToTrack/src/TRT_SegmentsToTrack.cxx index c9461a5431a321f75ca285dde93ace76d7ac7e57..f2d7356cb8627633ffd3dacf7d3d09c1603dc515 100755 --- a/InnerDetector/InDetCosmics/TRT_SegmentsToTrack/src/TRT_SegmentsToTrack.cxx +++ b/InnerDetector/InDetCosmics/TRT_SegmentsToTrack/src/TRT_SegmentsToTrack.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 */ //====================================================== @@ -25,7 +25,6 @@ #include "TrkSurfaces/StraightLineSurface.h" #include "TrkSurfaces/PerigeeSurface.h" #include "TrkTrack/TrackCollection.h" -#include "TrkFitterInterfaces/ITrackFitter.h" #include "TrkSegment/SegmentCollection.h" #include "TrkSegment/TrackSegment.h" #include "TrkParameters/TrackParameters.h" @@ -38,8 +37,6 @@ #include "TrkTruthData/PRD_MultiTruthCollection.h" #include "TrkEventUtils/TrackStateOnSurfaceComparisonFunction.h" -#include "TrkExInterfaces/IExtrapolator.h" - // Geometry Stuff #include "Identifier/Identifier.h" #include "AtlasDetDescr/AtlasDetectorID.h" @@ -57,8 +54,6 @@ InDet::TRT_SegmentsToTrack::TRT_SegmentsToTrack(const std::string& name, ISvcLocator* pSvcLocator): AthAlgorithm(name, pSvcLocator), - m_trackFitter("Trk::KalmanFitter/TrkKalmanFitter"), - m_extrapolator("Trk::Extrapolator/InDetExtrapolator"), m_idHelper(nullptr), m_trtid(nullptr), m_nTracksReal(0), @@ -67,18 +62,11 @@ InDet::TRT_SegmentsToTrack::TRT_SegmentsToTrack(const std::string& name, ISvcLoc m_events(0), m_n_combined_fit(0) { - declareProperty("TrackFitter", m_trackFitter); - declareProperty("ExtrapolationTool", m_extrapolator); declareProperty("NoiseCut", m_noiseCut = -1.); declareProperty("MinNHit", m_minTRTHits = 1); declareProperty("MaterialEffects", m_materialEffects = false); declareProperty("OutlierRemoval", m_outlierRemoval = false); declareProperty("CombineSegments", m_combineSegments = false); - //to be deleted - declareProperty("InputSCTCollection",m_dummy); - declareProperty("OutputCombiCollection",m_dummy); - declareProperty("CombineTracks",m_dummy_bool); - } InDet::TRT_SegmentsToTrack::~TRT_SegmentsToTrack() @@ -113,6 +101,10 @@ StatusCode InDet::TRT_SegmentsToTrack::initialize() CHECK(detStore()->retrieve(m_idHelper, "AtlasID")); CHECK(m_extrapolator.retrieve()); + ATH_CHECK(m_trkSummaryTool.retrieve( DisableTool{ m_trkSummaryTool.empty() } )); + ATH_CHECK(m_assoTool.retrieve( DisableTool{ m_assoTool.empty() || (m_trkSummaryTool.empty() && m_assoMapName.key().empty()) } )); + ATH_CHECK(m_inputAssoMapName.initialize( !m_inputAssoMapName.key().empty() && m_assoTool.isEnabled())); + ATH_CHECK(m_assoMapName.initialize( !m_assoMapName.key().empty() && m_assoTool.isEnabled())); return StatusCode::SUCCESS; } @@ -145,7 +137,7 @@ StatusCode InDet::TRT_SegmentsToTrack::finalize() StatusCode InDet::TRT_SegmentsToTrack::execute() { int segmentCounter=0; - + const EventContext& ctx = Gaudi::Hive::currentContext(); m_events++; ATH_MSG_DEBUG(name() << " execute() start"); @@ -154,11 +146,11 @@ StatusCode InDet::TRT_SegmentsToTrack::execute() //combine segments if( m_combineSegments) - combineSegments(); + combineSegments(ctx); // input TrackSegment Collection - SG::ReadHandle<Trk::SegmentCollection> inputSegments(m_inputSegmentCollectionName); + SG::ReadHandle<Trk::SegmentCollection> inputSegments(m_inputSegmentCollectionName,ctx); if (!inputSegments.isValid()) { ATH_MSG_ERROR("Could not open: " <<m_inputSegmentCollectionName.key()); sc = StatusCode::FAILURE; @@ -168,12 +160,13 @@ StatusCode InDet::TRT_SegmentsToTrack::execute() //output collections for fitted tracks - SG::WriteHandle<TrackCollection> outputTrackCollection(m_outputTrackCollectionName); - ATH_CHECK(outputTrackCollection.record(std::make_unique<TrackCollection>())); + SG::WriteHandle<TrackCollection> final_outputTrackCollection(m_outputTrackCollectionName,ctx); + ATH_CHECK(final_outputTrackCollection.record(std::make_unique<TrackCollection>())); + std::vector<std::unique_ptr<Trk::Track> > output_track_collection; //try to get truth information - SG::ReadHandle<PRD_MultiTruthCollection> truthCollectionTRT(m_multiTruthCollectionTRTName); + SG::ReadHandle<PRD_MultiTruthCollection> truthCollectionTRT(m_multiTruthCollectionTRTName,ctx); if (!truthCollectionTRT.isValid()){ ATH_MSG_INFO("Could not open PRD_MultiTruthCollection : " << m_multiTruthCollectionTRTName.key()); @@ -233,22 +226,21 @@ StatusCode InDet::TRT_SegmentsToTrack::execute() int nmeas=(*iseg)->numberOfMeasurementBases(); Amg::Vector3D surfpos(.5*((*iseg)->measurement(nmeas/2)->globalPosition()+(*iseg)->measurement(nmeas/2+1)->globalPosition())); Trk::PerigeeSurface persurf(surfpos); - inputMatchPerigee = dynamic_cast<const Trk::Perigee*>(m_extrapolator->extrapolateDirectly(*inputMatchLine,persurf)); + inputMatchPerigee = dynamic_cast<const Trk::Perigee*>(m_extrapolator->extrapolateDirectly(ctx,*inputMatchLine,persurf)); } ATH_MSG_DEBUG("Created inputMatchLine"); - Trk::Track *fittedTrack=0; + std::unique_ptr<Trk::Track> fittedTrack; const Trk::TrackParameters *inputpar=0; if (inputMatchPerigee) inputpar=inputMatchPerigee; else if (inputMatchLine) inputpar=inputMatchLine; if (inputpar) { - - fittedTrack=m_trackFitter->fit(myset, - *inputpar, - m_outlierRemoval, - m_materialEffects ? Trk::muon : Trk::nonInteracting - ); + fittedTrack = m_trackFitter->fit(ctx, + myset, + *inputpar, + m_outlierRemoval, + m_materialEffects ? Trk::muon : Trk::nonInteracting); } if(fittedTrack){ DataVector<const Trk::TrackStateOnSurface>::const_iterator itSet = fittedTrack->trackStateOnSurfaces()->begin(); @@ -263,12 +255,11 @@ StatusCode InDet::TRT_SegmentsToTrack::execute() } const Trk::TrackParameters *myper{}; if (measpar){ - myper=m_extrapolator->extrapolate(*measpar,Trk::PerigeeSurface(),Trk::anyDirection,false, m_materialEffects ? Trk::muon : Trk::nonInteracting); + myper=m_extrapolator->extrapolate(ctx,*measpar,Trk::PerigeeSurface(),Trk::anyDirection,false, m_materialEffects ? Trk::muon : Trk::nonInteracting); } if (!myper){ delete myper; - delete fittedTrack; - fittedTrack=0; + fittedTrack.reset(); } else { DataVector<const Trk::TrackStateOnSurface>* trajectory = new DataVector<const Trk::TrackStateOnSurface>; @@ -314,65 +305,54 @@ StatusCode InDet::TRT_SegmentsToTrack::execute() if (inprod>0) trajectory->insert(trajectory->begin(),pertsos); else trajectory->push_back(pertsos); } - Trk::Track *track=new Trk::Track(fittedTrack->info(),trajectory,fittedTrack->fitQuality()->clone()); - delete fittedTrack; - fittedTrack=track; + std::unique_ptr<Trk::Track> track=std::make_unique<Trk::Track>(fittedTrack->info(),trajectory,fittedTrack->fitQuality()->clone()); + fittedTrack = std::move(track); } } if(fittedTrack){ - bool deltrack=true; - int nHT=nHTHits(fittedTrack); + int nHT=nHTHits(fittedTrack.get()); ATH_MSG_DEBUG("Number of HT hits: "<<nHT); ATH_MSG_DEBUG(" Successful fit of track."); if ((*iseg)->fitQuality()) ATH_MSG_DEBUG("Quality of Segment: chi^2 /ndof "<<(*iseg)->fitQuality()->chiSquared()<<" / "<<(*iseg)->fitQuality()->numberDoF()); ATH_MSG_DEBUG("Quality of Track: chi^2 /ndof "<<fittedTrack->fitQuality()->chiSquared()<<" / "<<fittedTrack->fitQuality()->numberDoF()); - ATH_MSG_DEBUG("Noise probability: "<<getNoiseProbability(fittedTrack)); + ATH_MSG_DEBUG("Noise probability: "<<getNoiseProbability(fittedTrack.get())); ATH_MSG_DEBUG((*fittedTrack)); - if( nTRTHits(fittedTrack)>=m_minTRTHits){ - deltrack=false; - outputTrackCollection->push_back(fittedTrack); - }else{ - deltrack=true; - } - - if( nTRTHits(fittedTrack)<m_minTRTHits){ - ATH_MSG_DEBUG("This tracks has only "<<nTRTHits(fittedTrack)<<" Hits! Will reject it!"); - }else{ - //check if this track is real or fake - if(getNoiseProbability(fittedTrack)>m_noiseCut){ - double truefraction=getRealFractionTRT(fittedTrack); - + if( nTRTHits(fittedTrack.get())>=m_minTRTHits){ + if(getNoiseProbability(fittedTrack.get())>m_noiseCut){ + double truefraction=getRealFractionTRT(fittedTrack.get(),ctx); + int nhits=(*iseg)->numberOfMeasurementBases(); ATH_MSG_DEBUG("Real/Noise : "<< truefraction << " chi2="<<fittedTrack->fitQuality()->chiSquared()/double(fittedTrack->fitQuality()->numberDoF())); if(truefraction>0.5){ ATH_MSG_DEBUG("==> Real Track"); - + if(m_MapReal.find(nhits)==m_MapReal.end()){ m_MapReal[nhits]=1; }else{ m_MapReal[nhits]++; } - + m_nTracksReal++; m_noiseratio+=(1-truefraction); }else{ ATH_MSG_DEBUG(" ==> Fake Track"); - + if(m_MapFake.find(nhits)==m_MapFake.end()){ m_MapFake[nhits]=1; }else{ m_MapFake[nhits]++; } - + m_nTracksFake++; } } + output_track_collection.push_back(std::move(fittedTrack)); + }else{ + ATH_MSG_DEBUG("This tracks has only "<<nTRTHits(fittedTrack.get())<<" Hits! Will reject it!"); } - - if(deltrack) - delete fittedTrack; + }else{ ATH_MSG_DEBUG("Fit did not converge!"); } //end of if(fittedTrack) @@ -383,7 +363,41 @@ StatusCode InDet::TRT_SegmentsToTrack::execute() } //end of if: (*iseg)->numberOfMeasurementBases()>0 } //end of loop over segments - if (!outputTrackCollection.isValid()) { + std::unique_ptr<Trk::PRDtoTrackMap> prd_to_track_map; + if (m_assoTool.isEnabled()) { + // create internal PRD-to-track map + prd_to_track_map = m_assoTool->createPRDtoTrackMap(); + if (!m_inputAssoMapName.key().empty()) { + SG::ReadHandle<Trk::PRDtoTrackMap> input_asso_map(m_inputAssoMapName,ctx); + if (!input_asso_map.isValid()) { + ATH_MSG_FATAL("No valid input PRT-to-track map with key " << m_inputAssoMapName.key()); + } + *prd_to_track_map = *input_asso_map; + ATH_MSG_INFO("PRD to track map input " << m_inputAssoMapName.key() ); + } + for (const std::unique_ptr<Trk::Track> &track : output_track_collection) { + StatusCode sc = m_assoTool->addPRDs(*prd_to_track_map, *track); + } + } + // @TODO sort output track collection ? + final_outputTrackCollection->reserve(output_track_collection.size()); + if (m_trkSummaryTool.isEnabled()) { + for (std::unique_ptr<Trk::Track> &track : output_track_collection) { + m_trkSummaryTool->computeAndReplaceTrackSummary(*track,prd_to_track_map.get()); + final_outputTrackCollection->push_back(std::move(track)); + } + } + else { + for (std::unique_ptr<Trk::Track> &track : output_track_collection) { + final_outputTrackCollection->push_back(std::move(track)); + } + } + if (!m_assoMapName.key().empty()) { + ATH_CHECK(SG::WriteHandle<Trk::PRDtoTrackMap>(m_assoMapName,ctx).record(std::move(prd_to_track_map))); + } + + if (!final_outputTrackCollection.isValid()) { + // @TODO never reached (?) ATH_MSG_ERROR("Could not write track collection " << m_outputTrackCollectionName.key()); return StatusCode::FAILURE; //return sc; @@ -392,12 +406,12 @@ StatusCode InDet::TRT_SegmentsToTrack::execute() return sc; } -int InDet::TRT_SegmentsToTrack::getNumberReal(const InDet::TRT_DriftCircle* driftcircle) +int InDet::TRT_SegmentsToTrack::getNumberReal(const InDet::TRT_DriftCircle* driftcircle,const EventContext& ctx) const { int numBarcodes = 0; typedef PRD_MultiTruthCollection::const_iterator iter; - SG::ReadHandle<PRD_MultiTruthCollection> truthCollectionTRT(m_multiTruthCollectionTRTName); + SG::ReadHandle<PRD_MultiTruthCollection> truthCollectionTRT(m_multiTruthCollectionTRTName,ctx); if(!truthCollectionTRT.isValid()) return 0; std::pair<iter,iter> range = truthCollectionTRT->equal_range(driftcircle->identify()); @@ -407,38 +421,9 @@ int InDet::TRT_SegmentsToTrack::getNumberReal(const InDet::TRT_DriftCircle* drif return numBarcodes; } -double InDet::TRT_SegmentsToTrack::getRealFraction(const Trk::Segment *segment) -{ - double fraction=0.; - int nDriftReal=0; - int nDriftNoise=0; - - - for(unsigned int i=0;i<segment->numberOfMeasurementBases();++i){ - const Trk::RIO_OnTrack* rot=dynamic_cast<const Trk::RIO_OnTrack*>(segment->measurement(i)); - if(rot){ - const Trk::PrepRawData* prd=rot->prepRawData(); - if(prd!=0){ - const InDet::TRT_DriftCircle *dc=dynamic_cast<const InDet::TRT_DriftCircle*>(prd); - if(dc!=0){ - int nreal=getNumberReal(dc); - - if(nreal>0) nDriftReal++; - else nDriftNoise++; - } - } - } - } - - if(nDriftReal>0) - fraction=double(nDriftReal)/double(nDriftNoise+nDriftReal); - - - return fraction; -} -double InDet::TRT_SegmentsToTrack::getRealFractionTRT(const Trk::Track *track) +double InDet::TRT_SegmentsToTrack::getRealFractionTRT(const Trk::Track *track,const EventContext& ctx) const { double fraction=0.; int nDriftReal=0; @@ -459,7 +444,7 @@ double InDet::TRT_SegmentsToTrack::getRealFractionTRT(const Trk::Track *track) const InDet::TRT_DriftCircle *dc=dcot->prepRawData(); if(dc){ - int nreal=getNumberReal(dc); + int nreal=getNumberReal(dc,ctx); if(nreal>0) nDriftReal++; else nDriftNoise++; @@ -477,7 +462,7 @@ double InDet::TRT_SegmentsToTrack::getRealFractionTRT(const Trk::Track *track) } -int InDet::TRT_SegmentsToTrack::nHTHits(const Trk::Track *track) +int InDet::TRT_SegmentsToTrack::nHTHits(const Trk::Track *track) const { int nHT=0; @@ -510,7 +495,7 @@ int InDet::TRT_SegmentsToTrack::nHTHits(const Trk::Track *track) -int InDet::TRT_SegmentsToTrack::nTRTHits(const Trk::Track *track) +int InDet::TRT_SegmentsToTrack::nTRTHits(const Trk::Track *track) const { int nhits=0; @@ -532,7 +517,7 @@ int InDet::TRT_SegmentsToTrack::nTRTHits(const Trk::Track *track) } -double InDet::TRT_SegmentsToTrack::getNoiseProbability(const Trk::Track *track) +double InDet::TRT_SegmentsToTrack::getNoiseProbability(const Trk::Track *track) const { double fraction=0.; int nDriftReal=0; @@ -571,19 +556,19 @@ double InDet::TRT_SegmentsToTrack::getNoiseProbability(const Trk::Track *track) - void InDet::TRT_SegmentsToTrack::combineSegments(void) +void InDet::TRT_SegmentsToTrack::combineSegments(const EventContext& ctx) const { //Idea: // - get from endcap segment z-phi dependence // - get from barrel segment r-phi dependence and z dependence from endcap segment fit - - SG::ReadHandle<Trk::SegmentCollection> BarrelSegments(m_barrelSegments); - SG::ReadHandle<Trk::SegmentCollection> EndcapSegments(m_endcapSegments); + int n_combined_fit=0; + SG::ReadHandle<Trk::SegmentCollection> BarrelSegments(m_barrelSegments,ctx); + SG::ReadHandle<Trk::SegmentCollection> EndcapSegments(m_endcapSegments,ctx); StatusCode sc; - SG::WriteHandle<TrackCollection> outputCombiCollection(m_BECCollectionName); + SG::WriteHandle<TrackCollection> outputCombiCollection(m_BECCollectionName,ctx); sc = outputCombiCollection.record(std::make_unique<TrackCollection>()); if (sc.isFailure()) return; @@ -868,16 +853,18 @@ double InDet::TRT_SegmentsToTrack::getNoiseProbability(const Trk::Track *track) } Amg::Vector3D startMomentum( 0., 0., 1.); - Trk::Track *fittedTrack=0; + std::unique_ptr<Trk::Track> fittedTrack; if(m_materialEffects){ if(inputMatchLine){ - fittedTrack=m_trackFitter->fit(myset2, + fittedTrack=m_trackFitter->fit(ctx, + myset2, *inputMatchLine, false, Trk::muon ); }else if (inputMatchPerigee){ - fittedTrack=m_trackFitter->fit(myset2, + fittedTrack=m_trackFitter->fit(ctx, + myset2, *inputMatchPerigee, false, Trk::muon @@ -885,13 +872,15 @@ double InDet::TRT_SegmentsToTrack::getNoiseProbability(const Trk::Track *track) } }else{ if(inputMatchLine){ - fittedTrack=m_trackFitter->fit(myset2, + fittedTrack=m_trackFitter->fit(ctx, + myset2, *inputMatchLine, false, Trk::nonInteracting ); }else if (inputMatchPerigee){ - fittedTrack=m_trackFitter->fit(myset2, + fittedTrack=m_trackFitter->fit(ctx, + myset2, *inputMatchPerigee, false, Trk::muon @@ -900,8 +889,8 @@ double InDet::TRT_SegmentsToTrack::getNoiseProbability(const Trk::Track *track) } if(fittedTrack){ - m_n_combined_fit++; - outputCombiCollection->push_back(fittedTrack); + n_combined_fit++; + outputCombiCollection->push_back(std::move(fittedTrack)); ATH_MSG_DEBUG("Successful Barrel+Endcap fit of segment. "); ATH_MSG_DEBUG("Quality of Track: "<<fittedTrack->fitQuality()->chiSquared()<<" / "<<fittedTrack->fitQuality()->numberDoF()); ATH_MSG_VERBOSE(*fittedTrack); @@ -916,6 +905,7 @@ double InDet::TRT_SegmentsToTrack::getNoiseProbability(const Trk::Track *track) } } } + m_n_combined_fit += n_combined_fit; if (!outputCombiCollection.isValid()) { ATH_MSG_ERROR("Could not write track Barrel+EC collection TRT_Barrel_EC"); diff --git a/InnerDetector/InDetExample/InDetRecExample/python/TrackingCommon.py b/InnerDetector/InDetExample/InDetRecExample/python/TrackingCommon.py index 17e91c7b06ae4bb405658d49ad6edee388807adf..73355ae4edb3c60a87a1dd31caaa6dda2efd0623 100644 --- a/InnerDetector/InDetExample/InDetRecExample/python/TrackingCommon.py +++ b/InnerDetector/InDetExample/InDetRecExample/python/TrackingCommon.py @@ -1062,6 +1062,10 @@ def getInDetTrackSummaryToolSharedHits(name='InDetTrackSummaryToolSharedHits',** return getInDetTrackSummaryTool( name, **kwargs) +def getInDetTrackSummaryToolTRTTracks(name='InDetTrackSummaryToolTRTTracks',**kwargs) : + # @TODO should switch off PixelToTPID, shared hits (setDefaults(kwargs,doSharedHits=False)) + return getInDetTrackSummaryToolSharedHits(name, **setDefaults(kwargs,doSharedHits=True)) + def getInDetTrigTrackSummaryTool(name='InDetTrackSummaryTool',**kwargs) : return getInDetTrackSummaryTool(name,**setDefaults(kwargs, namePrefix = "InDetTrig", diff --git a/InnerDetector/InDetExample/InDetRecExample/share/ConfiguredBackTracking.py b/InnerDetector/InDetExample/InDetRecExample/share/ConfiguredBackTracking.py index 86338aed21c0b08d7cdc3c453f71ad8c8b5d5980..5294b6f6f01102bbc9e0f1faf09027b10ff2ca4d 100755 --- a/InnerDetector/InDetExample/InDetRecExample/share/ConfiguredBackTracking.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/ConfiguredBackTracking.py @@ -231,8 +231,10 @@ class ConfiguredBackTracking: # if InDetFlags.doCosmics(): InDetTRT_SeededScoringTool = TrackingCommon.getInDetCosmicScoringTool_TRT(NewTrackingCuts) + InDetTRT_SeededSummaryTool = TrackingCommon.getInDetTrackSummaryToolSharedHits() else: InDetTRT_SeededScoringTool = TrackingCommon.getInDetTRT_SeededScoringTool(NewTrackingCuts) + InDetTRT_SeededSummaryTool = TrackingCommon.getInDetTrackSummaryTool() # # --- Load selection tool @@ -262,7 +264,7 @@ class ConfiguredBackTracking: InDetTRT_SeededAmbiguityProcessor = Trk__SimpleAmbiguityProcessorTool(name = 'InDetTRT_SeededAmbiguityProcessor', Fitter = CfgGetter.getPublicTool('InDetTrackFitter'), AssociationTool = TrackingCommon.getInDetPRDtoTrackMapToolGangedPixels(), - TrackSummaryTool = TrackingCommon.getInDetTrackSummaryTool(), + TrackSummaryTool = InDetTRT_SeededSummaryTool, SelectionTool = InDetTRT_SeededAmbiTrackSelectionTool, RefitPrds = not InDetFlags.refitROT(), SuppressTrackFit = False, diff --git a/InnerDetector/InDetExample/InDetRecExample/share/ConfiguredTRTStandalone.py b/InnerDetector/InDetExample/InDetRecExample/share/ConfiguredTRTStandalone.py index 7ac525084aa150937cc611dcad4203e78946a967..9e62585d6153075337e52e42e7912067c5862d79 100644 --- a/InnerDetector/InDetExample/InDetRecExample/share/ConfiguredTRTStandalone.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/ConfiguredTRTStandalone.py @@ -11,7 +11,7 @@ class ConfiguredTRTStandalone: def __init__(self, extension = "",InputCollections = None, NewTrackingCuts = None, BarrelSegments = None, - TrackCollectionKeys=[], TrackCollectionTruthKeys=[] ): + TrackCollectionKeys=[], TrackCollectionTruthKeys=[], PRDtoTrackMap='' ): from InDetRecExample.InDetJobProperties import InDetFlags from InDetRecExample.InDetKeys import InDetKeys @@ -33,7 +33,7 @@ class ConfiguredTRTStandalone: # # --- get list of already associated hits (always do this, even if no other tracking ran before) # - prd_to_track_map = '' + prd_to_track_map = PRDtoTrackMap if usePrdAssociationTool and extension != "_TRT" : prefix='InDetTRTonly_' InDetTRTonly_PRD_Association = TrackingCommon.getInDetTrackPRD_Association(namePrefix = prefix, @@ -134,10 +134,10 @@ class ConfiguredTRTStandalone: InputSegmentsCollection = BarrelSegments, OutputTrackCollection = self.__TRTStandaloneTracks, TrackFitter = CfgGetter.getPublicTool('InDetTrackFitter'), + SummaryTool = TrackingCommon.getInDetTrackSummaryToolTRTTracks(), + AssociationTool = TrackingCommon.getInDetPRDtoTrackMapToolGangedPixels() if prd_to_track_map !='' else None, + InputAssociationMapName = prd_to_track_map, MinNHit = NewTrackingCuts.minTRTonly(), - CombineTracks = False, - OutputCombiCollection = "", - InputSCTCollection = "", OutlierRemoval = True, MaterialEffects = False) #InDetTrkSegmenttoTrk.OutputLevel = VERBOSE diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetRec_jobOptions.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetRec_jobOptions.py index 38558de3029b17ce906dfb2b75175ed733496a56..dd419a0d6f4cb66a27b9f928dce4a96ff9d7fe1d 100755 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetRec_jobOptions.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetRec_jobOptions.py @@ -321,15 +321,13 @@ else: printfunc (InDetTRTonly_PRD_AssociationPhase) from AthenaCommon import CfgGetter + # @TODO create track summary for the following tracks .i.e. add "SummaryTool = TrackingCommon.getInDetTrackSummaryTool()", ? from TRT_SegmentsToTrack.TRT_SegmentsToTrackConf import InDet__TRT_SegmentsToTrack InDetTrkSegmenttoTrkPhase = InDet__TRT_SegmentsToTrack(name = "InDetTRT_SegmentsToTrack_BarrelPhase", InputSegmentsCollection = InDetKeys.TRT_Segments_Phase(), OutputTrackCollection = InDetKeys.TRT_Tracks_Phase(), TrackFitter = CfgGetter.getPublicTool('InDetTrackFitter'), MinNHit = InDetNewTrackingCuts.minTRTonly(), - CombineTracks = False, - OutputCombiCollection = "", - InputSCTCollection = "", OutlierRemoval = True, MaterialEffects = False) topSequence += InDetTrkSegmenttoTrkPhase @@ -346,39 +344,6 @@ else: include ("InDetRecExample/ConfiguredInDetPreProcessingTRT.py") InDetPreProcessingTRT = ConfiguredInDetPreProcessingTRT(True, True) - # ------------------------------------------------------------ - # - # ----------- now we do legacy pattern if requested - # - # ------------------------------------------------------------ - - - # - # --- TRT track segment finding - # - if InDetFlags.doTrackSegmentsTRT(): - # --- load cuts for TRT segment finding - if ('InDetNewTrackingCutsTRT' not in dir()): - printfunc ("InDetRec_jobOptions: InDetNewTrackingCutsTRT not set before - import them now") - from InDetRecExample.ConfiguredNewTrackingCuts import ConfiguredNewTrackingCuts - InDetNewTrackingCutsTRT = ConfiguredNewTrackingCuts("TRT") - InDetNewTrackingCutsTRT.printInfo() - # --- segment finingd - include ("InDetRecExample/ConfiguredTRTSegmentFinding.py") - InDetRecTRTSegementFinding = ConfiguredTRTSegmentFinding ("_TRT", [], - InDetNewTrackingCutsTRT, - InDetKeys.TRT_SegmentsTRT() - ) - # --- making tacks out of segments - - - include ("InDetRecExample/ConfiguredTRTStandalone.py") - InDetRecTRTStandalone = ConfiguredTRTStandalone ("_TRT", [], - InDetNewTrackingCutsTRT, - InDetKeys.TRT_SegmentsTRT(), - # InDetKeys.TRT_SegmentsTRT_EC(), - TrackCollectionKeys, - TrackCollectionTruthKeys) # ------------------------------------------------------------ # @@ -442,6 +407,7 @@ else: # --- add into list for combination InputCombinedInDetTracks += [ InDetRecBackTracking.BackTrackingTracks() ] + # ------------------------------------------------------------ # # --- Large-d0 option (FIXME: Here or should be placed @@ -582,6 +548,40 @@ else: InputCombinedInDetTracks += [ InDetRecTRTStandalone.TRTStandaloneTracks() ] + # ------------------------------------------------------------ + # + # ----------- now we do legacy pattern if requested + # + # ------------------------------------------------------------ + + # + # --- TRT track segment finding + # + if InDetFlags.doTrackSegmentsTRT(): + # --- load cuts for TRT segment finding + if ('InDetNewTrackingCutsTRT' not in dir()): + printfunc ("InDetRec_jobOptions: InDetNewTrackingCutsTRT not set before - import them now") + from InDetRecExample.ConfiguredNewTrackingCuts import ConfiguredNewTrackingCuts + InDetNewTrackingCutsTRT = ConfiguredNewTrackingCuts("TRT") + InDetNewTrackingCutsTRT.printInfo() + # --- segment finingd + include ("InDetRecExample/ConfiguredTRTSegmentFinding.py") + InDetRecTRTSegementFinding = ConfiguredTRTSegmentFinding ("_TRT", [], + InDetNewTrackingCutsTRT, + InDetKeys.TRT_SegmentsTRT() + ) + # --- making tracks out of segments + + + include ("InDetRecExample/ConfiguredTRTStandalone.py") + InDetRecTRTStandalone = ConfiguredTRTStandalone ("_TRT", [], + InDetNewTrackingCutsTRT, + InDetKeys.TRT_SegmentsTRT(), + # InDetKeys.TRT_SegmentsTRT_EC(), + TrackCollectionKeys, + TrackCollectionTruthKeys, + PRDtoTrackMap='InDetTRTonly_PRDtoTrackMap' if InDetFlags.doTRTStandalone() else '' ) + # ------------------------------------------------------------ # # --- Forward Tracklets (after standard reconstruction) diff --git a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecNewTracking.py b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecNewTracking.py index cc629ddaf5b77dd04323abedd4cb025d7f457e7c..01712f83af5aa877b8cbf129de4f16fb584aa8d7 100755 --- a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecNewTracking.py +++ b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecNewTracking.py @@ -598,6 +598,7 @@ class TrigExtProcessor_EF( InDet__InDetTrigExtensProcessor ): self.TrackFitter = InDetTrigExtensionFitter + self.SummaryTool = InDetTrigTrackSummaryTool self.ScoringTool = InDet__InDetAmbiScoringTool('InDetTrigExtScoringTool_'+type) self.RefitPrds = not (InDetTrigFlags.refitROT() or (InDetTrigFlags.trtExtensionType() == 'DAF')) diff --git a/InnerDetector/InDetRecTools/InDetTrackScoringTools/src/InDetAmbiScoringTool.cxx b/InnerDetector/InDetRecTools/InDetTrackScoringTools/src/InDetAmbiScoringTool.cxx index faf950d263797fcf36db44cca7437fc59f30e7d9..fafeaaf5f9e2ce1c9b8fa939d0ad4469e3c4a2d4 100755 --- a/InnerDetector/InDetRecTools/InDetTrackScoringTools/src/InDetAmbiScoringTool.cxx +++ b/InnerDetector/InDetRecTools/InDetTrackScoringTools/src/InDetAmbiScoringTool.cxx @@ -173,17 +173,13 @@ StatusCode InDet::InDetAmbiScoringTool::finalize() Trk::TrackScore InDet::InDetAmbiScoringTool::score( const Trk::Track& track, const bool suppressHoleSearch ) const { - std::unique_ptr<const Trk::TrackSummary> summary; - if ( suppressHoleSearch) { - ATH_MSG_DEBUG ("Get summary for new Track, suppress HoleSearch"); - summary = m_trkSummaryTool->summaryNoHoleSearch(track); - } else { - ATH_MSG_DEBUG ("Get summary for new Track with HoleSearch"); - summary = m_trkSummaryTool->summary(track); + (void) suppressHoleSearch; + if (!track.trackSummary()) { + ATH_MSG_FATAL("Track without a summary"); } + ATH_MSG_VERBOSE ("Track has TrackSummary "<<*track.trackSummary()); + Trk::TrackScore score = Trk::TrackScore( simpleScore(track, *track.trackSummary()) ); - ATH_MSG_VERBOSE ("Track has TrackSummary "<<*summary); - Trk::TrackScore score = Trk::TrackScore( simpleScore(track, *summary) ); ATH_MSG_DEBUG ("Track has Score: "<<score); return score; diff --git a/InnerDetector/InDetRecTools/InDetTrackScoringTools/src/InDetCosmicScoringTool.cxx b/InnerDetector/InDetRecTools/InDetTrackScoringTools/src/InDetCosmicScoringTool.cxx index ad8a47ca0e01c85e51bd7f6dd7c24aca8cbc2172..f158171261bed12f283c8727714e70262430e431 100755 --- a/InnerDetector/InDetRecTools/InDetTrackScoringTools/src/InDetCosmicScoringTool.cxx +++ b/InnerDetector/InDetRecTools/InDetTrackScoringTools/src/InDetCosmicScoringTool.cxx @@ -60,17 +60,12 @@ StatusCode InDet::InDetCosmicScoringTool::finalize() Trk::TrackScore InDet::InDetCosmicScoringTool::score( const Trk::Track& track, const bool suppressHoleSearch ) const { - std::unique_ptr<const Trk::TrackSummary> summary; - if ( suppressHoleSearch) { - ATH_MSG_DEBUG ("Get summary for new Track, suppress HoleSearch"); - summary = m_trkSummaryTool->summaryNoHoleSearch(track); - } else { - ATH_MSG_DEBUG ("Get summary for new Track with HoleSearch"); - summary = m_trkSummaryTool->summary(track); + (void) suppressHoleSearch; + if (!track.trackSummary()) { + ATH_MSG_FATAL("Track without a summary"); } - - ATH_MSG_VERBOSE( "Track has TrackSummary "<<*summary ); - Trk::TrackScore score = Trk::TrackScore( simpleScore(track, *summary) ); + ATH_MSG_VERBOSE( "Track has TrackSummary "<< *track.trackSummary() ); + Trk::TrackScore score = Trk::TrackScore( simpleScore(track, *track.trackSummary()) ); ATH_MSG_DEBUG( "Track has Score: "<<score ); return score; } diff --git a/InnerDetector/InDetRecTools/InDetTrackScoringTools/src/InDetTrtTrackScoringTool.cxx b/InnerDetector/InDetRecTools/InDetTrackScoringTools/src/InDetTrtTrackScoringTool.cxx index 5a127b3b71d582c1ee99336d8b3e93d3d00e21e5..81096a576178276ec536a6e50d5f3cb87d6cb55f 100755 --- a/InnerDetector/InDetRecTools/InDetTrackScoringTools/src/InDetTrtTrackScoringTool.cxx +++ b/InnerDetector/InDetRecTools/InDetTrackScoringTools/src/InDetTrtTrackScoringTool.cxx @@ -107,17 +107,12 @@ StatusCode InDet::InDetTrtTrackScoringTool::finalize() Trk::TrackScore InDet::InDetTrtTrackScoringTool::score( const Trk::Track& track, const bool suppressHoleSearch ) const { - std::unique_ptr<const Trk::TrackSummary> summary; - if ( suppressHoleSearch) { - ATH_MSG_DEBUG ("Get summary for new Track, suppress HoleSearch"); - summary = m_trkSummaryTool->summaryNoHoleSearch(track); - } else { - ATH_MSG_DEBUG ("Get summary for new Track with HoleSearch"); - summary = m_trkSummaryTool->summary(track); + (void) suppressHoleSearch; + if (!track.trackSummary()) { + ATH_MSG_FATAL("Track without a summary"); } - - ATH_MSG_VERBOSE("Track has TrackSummary "<<*summary); - Trk::TrackScore score = Trk::TrackScore( simpleScore(track, *summary) ); + ATH_MSG_VERBOSE("Track has TrackSummary "<<*track.trackSummary()); + Trk::TrackScore score = Trk::TrackScore( simpleScore(track, *track.trackSummary()) ); ATH_MSG_VERBOSE("Track has Score: "<<score); return score; } diff --git a/InnerDetector/InDetTrigRecAlgs/InDetTrigExtensProcessor/InDetTrigExtensProcessor/InDetTrigExtensProcessor.h b/InnerDetector/InDetTrigRecAlgs/InDetTrigExtensProcessor/InDetTrigExtensProcessor/InDetTrigExtensProcessor.h index eb729499ccb7e77f11547fe5e96cd431bc596102..4db1dea0a36f84302cf8e4216f14a58fb6c2aebd 100755 --- a/InnerDetector/InDetTrigRecAlgs/InDetTrigExtensProcessor/InDetTrigExtensProcessor/InDetTrigExtensProcessor.h +++ b/InnerDetector/InDetTrigRecAlgs/InDetTrigExtensProcessor/InDetTrigExtensProcessor/InDetTrigExtensProcessor.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 */ ///////////////////////////////////////////////////////////////////////////// @@ -29,6 +29,7 @@ #include "TrkTrack/TrackCollection.h" #include "TrkTrack/TrackExtensionMap.h" #include "TrkFitterInterfaces/ITrackFitter.h" +#include "TrkToolInterfaces/IExtendedTrackSummaryTool.h" #include "TrkToolInterfaces/ITrackScoringTool.h" // Trigger specific stuff @@ -82,6 +83,8 @@ private: ToolHandle< Trk::ITrackFitter > m_ITrackFitter; // + /**\todo make this const, once createSummary method is const*/ + ToolHandle<Trk::IExtendedTrackSummaryTool> m_trkSummaryTool; ToolHandle< Trk::ITrackScoringTool > m_scoringTool; TrackCollection* m_newtracks; diff --git a/InnerDetector/InDetTrigRecAlgs/InDetTrigExtensProcessor/src/InDetTrigExtensProcessor.cxx b/InnerDetector/InDetTrigRecAlgs/InDetTrigExtensProcessor/src/InDetTrigExtensProcessor.cxx index 9abffc2a2b688a6432e229b868643caaea70dc16..01d815b7d0139908ab7d1afa1e5f4ef381da09e5 100755 --- a/InnerDetector/InDetTrigRecAlgs/InDetTrigExtensProcessor/src/InDetTrigExtensProcessor.cxx +++ b/InnerDetector/InDetTrigRecAlgs/InDetTrigExtensProcessor/src/InDetTrigExtensProcessor.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 */ /////////////////////////////////////////////////////////////////// @@ -41,6 +41,7 @@ InDet::InDetTrigExtensProcessor::InDetTrigExtensProcessor(const std::string &nam m_tracks(0), m_trackExtensionMap(0), m_ITrackFitter("Trk::KalmanFitter/InDetTrigTrackFitter"), + m_trkSummaryTool("", this), m_scoringTool("Trk::TrackScoringTool/InDetTrigScoringTool"), m_newtracks(0), m_cosmics(false) @@ -49,6 +50,7 @@ InDet::InDetTrigExtensProcessor::InDetTrigExtensProcessor(const std::string &nam // Get parameter values from jobOptions file declareProperty("TrackFitter", m_ITrackFitter); + declareProperty("SummaryTool" , m_trkSummaryTool); declareProperty("ScoringTool", m_scoringTool); declareProperty("runOutlier", m_runOutlier); declareProperty("RefitPrds", m_refitPrds,"switch whether to do the fit with re-calibrated clusters (true) or not"); @@ -81,6 +83,16 @@ HLT::ErrorCode InDet::InDetTrigExtensProcessor::hltInitialize() { Trk::ParticleSwitcher particleSwitch; m_ParticleHypothesis = particleSwitch.particle[m_matEffects]; + if (!m_trkSummaryTool.empty()) { + if ( m_trkSummaryTool.retrieve().isFailure()) { + msg() << MSG::FATAL << "Failed to retrieve tool " << m_scoringTool << endmsg; + return HLT::ErrorCode(HLT::Action::ABORT_JOB, HLT::Reason::BAD_JOB_SETUP); + } + } + else { + m_trkSummaryTool.disable(); + } + // get scoring tool if ( m_scoringTool.retrieve().isFailure() ) { msg() << MSG::FATAL << "Failed to retrieve tool " << m_scoringTool << endmsg; @@ -279,9 +291,12 @@ HLT::ErrorCode InDet::InDetTrigExtensProcessor::hltExecute(const HLT::TriggerEle // score old and new tool and decide which one to push back Trk::TrackScore oldScore = m_scoringTool->score( **itr, m_suppressHoleSearch ); if (outputLevel <= MSG::DEBUG) msg()<<MSG::DEBUG<<"original track has score: "<<oldScore<<endmsg; + if (!newtrack->trackSummary() && m_trkSummaryTool.isEnabled()) { + m_trkSummaryTool->computeAndReplaceTrackSummary(*newtrack,nullptr /** no shared hits */, m_suppressHoleSearch); + } Trk::TrackScore newScore = m_scoringTool->score( *newtrack, m_suppressHoleSearch ); if (outputLevel <= MSG::DEBUG) msg()<<MSG::DEBUG<<"new track has score : "<<newScore<<endmsg; - + if (newScore > oldScore) { if (outputLevel <= MSG::DEBUG) msg()<<MSG::DEBUG<<"take extended track, it's better !"<< endmsg; diff --git a/Tracking/TrkTools/TrkAmbiguityProcessor/src/SimpleAmbiguityProcessorTool.cxx b/Tracking/TrkTools/TrkAmbiguityProcessor/src/SimpleAmbiguityProcessorTool.cxx index 65a534190509111ccf10664763bc034dce63edca..caa5b510de24169a48b47c1488d5a65f7cedc798 100644 --- a/Tracking/TrkTools/TrkAmbiguityProcessor/src/SimpleAmbiguityProcessorTool.cxx +++ b/Tracking/TrkTools/TrkAmbiguityProcessor/src/SimpleAmbiguityProcessorTool.cxx @@ -287,6 +287,11 @@ void Trk::SimpleAmbiguityProcessorTool::addTrack(Trk::Track* in_track, stat.incrementCounterByRegion(ECounter::kNgoodFits,bremTrack.get()); // rerun score + if (m_trackSummaryTool.isEnabled()) { + m_trackSummaryTool->computeAndReplaceTrackSummary(*bremTrack, + &prdToTrackMap, + suppressHoleSearch); + } score = m_scoringTool->score( *bremTrack, suppressHoleSearch ); // do we accept the track ?