ATLAS Offline Software
TrackScoringTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
7 #include "TrackScoringTool.h"
8 #include "TrkTrack/Track.h"
12 
13 #include "CLHEP/GenericFunctions/CumulativeChiSquare.hh"
14 #include <cmath> //for log10
15 
17  const std::string& n,
18  const IInterface* p )
19  :
20  AthAlgTool(t,n,p),
21  m_summaryTypeScore(Trk::numberOfTrackSummaryTypes)
22 {
23  declareInterface<ITrackScoringTool>(this);
24 
25  //set some test values
27  m_summaryTypeScore[Trk::numberOfPixelHoles] = -10; // a hole is bad
28 
29  m_summaryTypeScore[Trk::numberOfInnermostPixelLayerHits] = 10; // addition for being b-layer
30 
31  m_summaryTypeScore[Trk::numberOfGangedPixels] = -5; // decrease for being ganged
32 
33  m_summaryTypeScore[Trk::numberOfSCTHits] = 10; // half of a pixel, since only 1dim
34  m_summaryTypeScore[Trk::numberOfSCTHoles] = -5; // a hole is bad !
35 
36  m_summaryTypeScore[Trk::numberOfTRTHits] = 2; // 5 straws ~ 1 SCT
37  m_summaryTypeScore[Trk::numberOfTRTHighThresholdHits] = 1; // addition for being TR
38 
39  m_summaryTypeScore[Trk::numberOfOutliersOnTrack] = -2; // an outlier might happen
40 
41  // scoring for Muons is missing
49 }
50 
53  if (!track.trackSummary()) {
54  ATH_MSG_FATAL("Attempt to score a track without a summary.");
55  }
56 
57  Trk::TrackScore score = TrackScore( simpleScore(track, *track.trackSummary()) );
58  return score;
59 }
60 
62 Trk::TrackScoringTool::simpleScore( const Track& track, const TrackSummary& trackSummary ) const{
63  // --- reject bad tracks
64  if (track.fitQuality() && track.fitQuality()->numberDoF() < 0) {
65  ATH_MSG_VERBOSE("numberDoF < 0, reject it");
66  return TrackScore(0);
67  }
68  // --- now start scoring
69  TrackScore score(100); // score of 100 per track
70 
71  // --- prob(chi2,NDF), protect for chi2<0
72  if (track.fitQuality()!=nullptr && track.fitQuality()->chiSquared() > 0 && track.fitQuality()->numberDoF() > 0) {
73  score+= std::log10(1.0-Genfun::CumulativeChiSquare(track.fitQuality()->numberDoF())(track.fitQuality()->chiSquared()));
74  }
75 
76  // --- summary score analysis
77  for (int i=0; i<Trk::numberOfTrackSummaryTypes; ++i) {
78  int value = trackSummary.get(static_cast<Trk::SummaryType>(i));
79  //value is -1 if undefined.
80  if (value>0) {
81  score+=m_summaryTypeScore[i]*value;
82  ATH_MSG_VERBOSE("\tType ["<<i<<"], value \t= "<<value<<"], score \t="<<score);
83  }
84  }
85  return score;
86 }
Trk::numberOfPixelHits
@ numberOfPixelHits
number of pixel layers on track with absence of hits
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:57
ITrackSummaryTool.h
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
TrackScoringTool.h
Trk::numberOfTRTHighThresholdHits
@ numberOfTRTHighThresholdHits
total number of TRT hits which pass the high threshold
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:87
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
Trk::numberOfInnermostPixelLayerHits
@ numberOfInnermostPixelLayerHits
these are the hits in the 1st pixel layer
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:53
Trk::TrackScoringTool::simpleScore
TrackScore simpleScore(const Track &track, const TrackSummary &trackSummary) const override
create a score based on how good the passed TrackSummary is
Definition: TrackScoringTool.cxx:62
Trk::numberOfCscEtaHits
@ numberOfCscEtaHits
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:108
Trk::TrackScoringTool::TrackScoringTool
TrackScoringTool(const std::string &, const std::string &, const IInterface *)
Definition: TrackScoringTool.cxx:16
Trk::numberOfTrackSummaryTypes
@ numberOfTrackSummaryTypes
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:189
athena.value
value
Definition: athena.py:122
Trk::numberOfOutliersOnTrack
@ numberOfOutliersOnTrack
100 times the standard deviation of the chi2 from the surfaces
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:148
Trk::numberOfTgcPhiHits
@ numberOfTgcPhiHits
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:105
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
Trk::numberOfSCTHoles
@ numberOfSCTHoles
number of Holes in both sides of a SCT module
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:73
Track.h
Trk::TrackScoringTool::m_summaryTypeScore
std::vector< TrackScore > m_summaryTypeScore
holds the scores assigned to each Trk::SummaryType from the track's Trk::TrackSummary
Definition: TrackScoringTool.h:35
lumiFormat.i
int i
Definition: lumiFormat.py:92
beamspotman.n
n
Definition: beamspotman.py:731
Trk::numberOfSCTHits
@ numberOfSCTHits
number of SCT holes
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:71
Trk::TrackScore
float TrackScore
Definition: TrackScore.h:10
Trk::TrackScoringTool::score
TrackScore score(const Track &track) const override
create a score based on how good the passed track is
Definition: TrackScoringTool.cxx:52
TrackSummary.h
xAOD::numberOfTrackSummaryTypes
@ numberOfTrackSummaryTypes
Definition: TrackingPrimitives.h:319
Trk::numberOfTgcEtaHits
@ numberOfTgcEtaHits
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:106
Trk::numberOfPixelHoles
@ numberOfPixelHoles
number of pixels which have a ganged ambiguity.
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:59
Trk::numberOfGangedPixels
@ numberOfGangedPixels
number of Ganged Pixels flagged as fakes
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:61
Trk::numberOfTRTHits
@ numberOfTRTHits
number of TRT outliers
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:79
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Trk::numberOfRpcPhiHits
@ numberOfRpcPhiHits
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:109
Trk::TrackSummary
A summary of the information contained by a track.
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:287
RIO_OnTrack.h
xAOD::score
@ score
Definition: TrackingPrimitives.h:513
Track
Definition: TriggerChamberClusterOnTrackCreator.h:21
Trk::SummaryType
SummaryType
enumerates the different types of information stored in Summary.
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:45
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
Trk::numberOfRpcEtaHits
@ numberOfRpcEtaHits
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:110
Trk::TrackSummary::get
int get(const SummaryType &type) const
returns the summary information for the passed SummaryType.
AthAlgTool
Definition: AthAlgTool.h:26
FitQuality.h
Trk::numberOfCscPhiHits
@ numberOfCscPhiHits
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:107
Trk::numberOfMdtHits
@ numberOfMdtHits
number of mdt hits
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:103