ATLAS Offline Software
Loading...
Searching...
No Matches
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
6
7#include <cassert>
8
12#include "TrkTrack/Track.h"
14
15namespace 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) {
61 score = simpleScore(track, *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) {
92 score += m_summaryTypeScore[i] * value;
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
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
PublicToolHandle< MuonEDMPrinterTool > m_printer
ToolHandle< Trk::IExtendedTrackSummaryTool > m_trkSummaryTool
MuonTrackScoringTool(const std::string &, const std::string &, const IInterface *)
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
std::vector< Trk::TrackScore > m_summaryTypeScore
holds the scores assigned to each Trk::SummaryType from the track's Trk::TrackSummary
virtual Trk::TrackScore score(const Trk::Track &track, bool checkBasicSel) const override
create a score based on how good the passed track is
virtual StatusCode initialize() override
A summary of the information contained by a track.
int get(const SummaryType &type) const
returns the summary information for the passed SummaryType.
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
Ensure that the ATLAS eigen extensions are properly loaded.
float TrackScore
Definition TrackScore.h:10
SummaryType
enumerates the different types of information stored in Summary.
@ numberOfGangedPixels
number of Ganged Pixels flagged as fakes
@ numberOfPixelHits
number of pixel layers on track with absence of hits
@ numberOfMmHits
number of TGC Eta measurements missing from the track
@ numberOfStgcEtaHits
number of TGC Eta measurements missing from the track
@ numberOfInnermostPixelLayerHits
these are the hits in the 1st pixel layer
@ numberOfTRTHighThresholdHits
total number of TRT hits which pass the high threshold
@ numberOfSCTHoles
number of Holes in both sides of a SCT module
@ numberOfStgcPhiHits
number of TGC Phi measurements missing from the track
@ numberOfPixelHoles
number of pixels which have a ganged ambiguity.
@ numberOfOutliersOnTrack
100 times the standard deviation of the chi2 from the surfaces