ATLAS Offline Software
MuonTrackScoringTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "MuonTrackScoringTool.h"
6 
7 #include <cassert>
8 
12 #include "TrkTrack/Track.h"
14 
15 namespace Muon {
16 
17  MuonTrackScoringTool::MuonTrackScoringTool(const std::string& t, const std::string& n, const IInterface* p) :
18  AthAlgTool(t, n, p), m_summaryTypeScore(Trk::numberOfTrackSummaryTypes) {
19  declareInterface<Trk::ITrackScoringTool>(this);
20 
21  // set some test values
23  m_summaryTypeScore[Trk::numberOfPixelHoles] = -10; // a hole is bad
24 
25  m_summaryTypeScore[Trk::numberOfInnermostPixelLayerHits] = 10; // addition for being b-layer
26 
27  m_summaryTypeScore[Trk::numberOfGangedPixels] = -5; // decrease for being ganged
28 
29  m_summaryTypeScore[Trk::numberOfSCTHits] = 10; // half of a pixel, since only 1dim
30  m_summaryTypeScore[Trk::numberOfSCTHoles] = -5; // a hole is bad !
31 
32  m_summaryTypeScore[Trk::numberOfTRTHits] = 2; // 5 straws ~ 1 SCT
33  m_summaryTypeScore[Trk::numberOfTRTHighThresholdHits] = 1; // addition for being TR
34  m_summaryTypeScore[Trk::numberOfOutliersOnTrack] = -2; // an outlier might happen
35 
36  // scoring for Muons is missing
44  // New Small Wheel
48  }
49 
51  ATH_CHECK(m_trkSummaryTool.retrieve());
52  ATH_MSG_DEBUG("Retrieved tool " << m_trkSummaryTool);
53 
54  return StatusCode::SUCCESS;
55  }
56 
57  Trk::TrackScore MuonTrackScoringTool::score(const Trk::Track& track, bool /*checkBasicSel*/) const {
59  const Trk::TrackSummary* summary = track.trackSummary();
60  if (summary) {
62  } else {
63  // This is potentially slow, so might need revisiting.
64  std::unique_ptr<Trk::TrackSummary> tmpSummary = m_trkSummaryTool->summaryNoHoleSearch(track);
65  score = simpleScore(track, *tmpSummary);
66  }
67  return score;
68  }
69 
71  // --- reject bad tracks
72  if (track.fitQuality() && track.fitQuality()->numberDoF() < 0) {
73  ATH_MSG_VERBOSE("numberDoF < 0, reject it");
74  return Trk::TrackScore(0);
75  }
76 
77  ATH_MSG_DEBUG(m_printer->print(track));
78 
79  // --- now start scoring
80  Trk::TrackScore score(200); // score of 100 per track
81 
82  // --- prob(chi2,NDF), protect for chi2<0
83  if (track.fitQuality() != nullptr && track.fitQuality()->chiSquared() > 0 && track.fitQuality()->numberDoF() > 0) {
84  score += 5 * track.fitQuality()->numberDoF() - track.fitQuality()->chiSquared();
85  }
86 
87  // --- summary score analysis
88  for (int i = 0; i < Trk::numberOfTrackSummaryTypes; ++i) {
89  int value = trackSummary.get(static_cast<Trk::SummaryType>(i));
90  // value is -1 if undefined.
91  if (value > 0) {
93  ATH_MSG_VERBOSE("\tType [" << i << "], value \t= " << value << "], score \t=" << score);
94  }
95  }
96  if (score == 0)
97  score =
98  0.000001; // since 0 is the bad track score; you'd have to get very unlucky to get a score of exactly 0 but it can happen
99  ATH_MSG_DEBUG(" Track Score " << score);
100 
101  return score;
102  }
103 } // namespace Muon
Muon::MuonTrackScoringTool::score
virtual Trk::TrackScore score(const Trk::Track &track, bool checkBasicSel) const override
create a score based on how good the passed track is
Definition: MuonTrackScoringTool.cxx:57
Trk::numberOfPixelHits
@ numberOfPixelHits
number of pixel layers on track with absence of hits
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:57
TrkDetElementBase.h
Trk::numberOfTRTHighThresholdHits
@ numberOfTRTHighThresholdHits
total number of TRT hits which pass the high threshold
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:87
Trk::numberOfInnermostPixelLayerHits
@ numberOfInnermostPixelLayerHits
these are the hits in the 1st pixel layer
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:53
Trk::Track
The ATLAS Track class.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
Trk::numberOfCscEtaHits
@ numberOfCscEtaHits
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:108
MuonTrackScoringTool.h
Trk::numberOfTrackSummaryTypes
@ numberOfTrackSummaryTypes
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:189
athena.value
value
Definition: athena.py:124
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
Muon::MuonTrackScoringTool::simpleScore
virtual Trk::TrackScore simpleScore(const Trk::Track &track, const Trk::TrackSummary &trackSummary) const override
create a score based on how good the passed TrackSummary is
Definition: MuonTrackScoringTool.cxx:70
Muon
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
Definition: TrackSystemController.h:45
Trk::numberOfSCTHoles
@ numberOfSCTHoles
number of Holes in both sides of a SCT module
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:73
Muon::MuonTrackScoringTool::m_printer
PublicToolHandle< MuonEDMPrinterTool > m_printer
Definition: MuonTrackScoringTool.h:43
Trk::numberOfMmHits
@ numberOfMmHits
number of TGC Eta measurements missing from the track
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:132
Track.h
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
lumiFormat.i
int i
Definition: lumiFormat.py:85
beamspotman.n
n
Definition: beamspotman.py:731
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Trk::numberOfSCTHits
@ numberOfSCTHits
number of SCT holes
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:71
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
Trk::TrackScore
float TrackScore
Definition: TrackScore.h:10
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
TrackSummary.h
Muon::MuonTrackScoringTool::m_trkSummaryTool
ToolHandle< Trk::IExtendedTrackSummaryTool > m_trkSummaryTool
Definition: MuonTrackScoringTool.h:42
Muon::MuonTrackScoringTool::initialize
virtual StatusCode initialize() override
Definition: MuonTrackScoringTool.cxx:50
xAOD::numberOfTrackSummaryTypes
@ numberOfTrackSummaryTypes
Definition: TrackingPrimitives.h:319
Trk::numberOfStgcEtaHits
@ numberOfStgcEtaHits
number of TGC Eta measurements missing from the track
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:128
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
Muon::MuonTrackScoringTool::m_summaryTypeScore
std::vector< Trk::TrackScore > m_summaryTypeScore
holds the scores assigned to each Trk::SummaryType from the track's Trk::TrackSummary
Definition: MuonTrackScoringTool.h:47
Trk::numberOfStgcPhiHits
@ numberOfStgcPhiHits
number of TGC Phi measurements missing from the track
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:130
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
Muon::MuonTrackScoringTool::MuonTrackScoringTool
MuonTrackScoringTool(const std::string &, const std::string &, const IInterface *)
Definition: MuonTrackScoringTool.cxx:17
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
SCT_Monitoring::summary
@ summary
Definition: SCT_MonitoringNumbers.h:65