ATLAS Offline Software
Loading...
Searching...
No Matches
InDetTrackSummaryHelperTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7// forward declares
12#include "TrkTrack/Track.h"
14// normal includes
15#include "Identifier/Identifier.h"
21
22#include <cassert>
23
24//==========================================================================
26 const std::string& t,
27 const std::string& n,
28 const IInterface* p)
29 : base_class(t, n, p)
30{}
31
32//==========================================================================
33
34StatusCode
36{
37 if (m_usePixel) {
38 if (detStore()->retrieve(m_pixelId, "PixelID").isFailure()) {
39 ATH_MSG_ERROR("Could not get PixelID helper !");
40 return StatusCode::FAILURE;
41 }
42 }
43
44 if (m_useSCT) {
45 if (detStore()->retrieve(m_sctId, "SCT_ID").isFailure()) {
46 ATH_MSG_ERROR("Could not get SCT_ID helper !");
47 return StatusCode::FAILURE;
48 }
49 }
50
51 if (m_useTRT) {
52 if (detStore()->retrieve(m_trtId, "TRT_ID").isFailure()) {
53 ATH_MSG_ERROR("Could not get TRT_ID helper !");
54 return StatusCode::FAILURE;
55 }
56 }
57
58 ATH_CHECK(m_holeSearchTool.retrieve(DisableTool{m_holeSearchTool.empty()}));
60 DisableTool{not m_useTRT or m_TRTStrawSummaryTool.empty()}));
61
62 return StatusCode::SUCCESS;
63}
64
65//==========================================================================
66void
68 const EventContext& ctx,
69 const Trk::Track& track,
70 const Trk::RIO_OnTrack* rot,
71 const Trk::TrackStateOnSurface* tsos,
72 std::vector<int>& information,
73 std::bitset<Trk::numberOfDetectorTypes>& hitPattern) const
74{
75 const Identifier& id = rot->identify();
76 bool isOutlier = tsos->type(Trk::TrackStateOnSurface::Outlier);
77 bool ispatterntrack = (track.info().trackFitter() == Trk::TrackInfo::Unknown);
78
79 if (m_usePixel and m_pixelId->is_pixel(id)
80 and (not isOutlier or ispatterntrack)) {
81 // ME: outliers on pattern tracks may be
82 // reintegrated by fitter, so count them as hits
83
84 information[Trk::numberOfPixelHits]++;
85 if (m_pixelId->layer_disk(id) == 0 and m_pixelId->is_barrel(id))
87 if (m_pixelId->layer_disk(id) == 1 and m_pixelId->is_barrel(id))
89
90 // check to see if there's an ambiguity with the ganged cluster.
91 const PixelClusterOnTrack* pix = nullptr;
93 pix = static_cast<const PixelClusterOnTrack*>(rot);
94 }
95 if (not pix) {
96 ATH_MSG_ERROR("Could not cast pixel RoT to PixelClusterOnTrack!");
97 } else {
98 if (pix->isBroadCluster())
99 information[Trk::numberOfPixelSpoiltHits]++;
100 if (pix->hasClusterAmbiguity()) {
101 information[Trk::numberOfGangedPixels]++;
102 if (pix->isFake())
103 information[Trk::numberOfGangedFlaggedFakes]++;
104 }
105
106 if ((m_pixelId->is_barrel(id))) {
107 int offset = m_pixelId->layer_disk(id);
108 if (not hitPattern.test(offset))
109 information[Trk::numberOfContribPixelLayers]++;
110 hitPattern.set(offset); // assumes numbered consecutively
111 } else {
112 int offset = static_cast<int>(Trk::pixelEndCap0); // get int value of first pixel endcap disc
113 offset += m_pixelId->layer_disk(id);
114 if (not hitPattern.test(offset))
115 information[Trk::numberOfContribPixelLayers]++;
116 hitPattern.set(offset); // assumes numbered consecutively
117 }
118 }
119
120 } else if (m_useSCT and m_sctId->is_sct(id)
121 and (not isOutlier or ispatterntrack)) {
122 // ME: outliers on pattern tracks may be
123 // reintegrated by fitter, so count them as hits
124
125 information[Trk::numberOfSCTHits]++;
126
127 const InDet::SCT_ClusterOnTrack* sctclus = nullptr;
129 sctclus = static_cast<const InDet::SCT_ClusterOnTrack*>(rot);
130 }
131 if (not sctclus) {
132 ATH_MSG_ERROR("Could not cast SCT RoT to SCT_ClusterOnTrack!");
133 } else {
134 if (sctclus->isBroadCluster())
135 information[Trk::numberOfSCTSpoiltHits]++;
136 }
137
138 if ((m_sctId->is_barrel(id))) {
139 int offset = static_cast<int>(Trk::sctBarrel0);
140 hitPattern.set(offset + m_sctId->layer_disk(id)); // assumes numbered consecutively
141 } else {
142 int offset = static_cast<int>(Trk::sctEndCap0); // get int value of first sct endcap disc
143 hitPattern.set(offset + m_sctId->layer_disk(id)); // assumes numbered consecutively
144 }
145
146 } else if (m_useTRT and m_trtId->is_trt(id)) {
147 bool isArgonStraw = false;
148 bool isKryptonStraw = false;
149 if (not m_TRTStrawSummaryTool.empty()) {
150 int statusHT = m_TRTStrawSummaryTool->getStatusHT(id, ctx);
151 if (statusHT == TRTCond::StrawStatus::Argon or
152 statusHT == TRTCond::StrawStatus::Dead or
154 isArgonStraw = true;
155 }
156 if (statusHT == TRTCond::StrawStatus::Krypton or
158 isKryptonStraw = true;
159 }
160 }
161 if (not isArgonStraw and not isKryptonStraw) {
162 information[Trk::numberOfTRTXenonHits]++;
163 }
164
165 if (isOutlier and not ispatterntrack) {
166 // ME: outliers on pattern tracks may be
167 // reintegrated by fitter, so count them as hits
168 information[Trk::numberOfTRTOutliers]++;
169
170 const InDet::TRT_DriftCircleOnTrack* trtDriftCircle = nullptr;
172 trtDriftCircle = static_cast<const InDet::TRT_DriftCircleOnTrack*>(rot);
173 }
174 if (not trtDriftCircle) {
175 ATH_MSG_ERROR("Could not cast TRT RoT to TRT_DriftCircleOnTracknot ");
176 } else {
177 if (trtDriftCircle->highLevel() and not isArgonStraw and
178 not isKryptonStraw)
180 }
181 } else {
182 information[Trk::numberOfTRTHits]++;
183 double error2 = rot->localCovariance()(0, 0);
184 if (error2 > 1)
185 information[Trk::numberOfTRTTubeHits]++;
186
187 const InDet::TRT_DriftCircleOnTrack* trtDriftCircle = nullptr;
189 trtDriftCircle = static_cast<const InDet::TRT_DriftCircleOnTrack*>(rot);
190 }
191 if (not trtDriftCircle) {
192 ATH_MSG_ERROR("Could not cast TRT RoT to TRT_DriftCircleOnTracknot ");
193 } else {
194 if (trtDriftCircle->highLevel()) {
195 if (not isArgonStraw and not isKryptonStraw)
197 assert(Trk::numberOfTRTHighThresholdHitsTotal < information.size());
199 }
200 }
201 }
202
203 }
204
205}
206
207void
209 const EventContext& ctx,
210 const Trk::Track& track,
211 const Trk::CompetingRIOsOnTrack* crot,
212 const Trk::TrackStateOnSurface* tsos,
213 std::vector<int>& information,
214 std::bitset<Trk::numberOfDetectorTypes>& hitPattern) const
215{
216 // re-produce prior behaviour (i.e. just take most probable ROT)
217 analyse(ctx,
218 track,
219 &crot->rioOnTrack(crot->indexOfMaxAssignProb()),
220 tsos,
221 information,
222 hitPattern);
223}
224
225void
227 const Trk::Track& track,
228 std::vector<int>& information,
229 const Trk::ParticleHypothesis partHyp) const
230{
231 ATH_MSG_DEBUG("Do hole search within HELPER, PLEASE FIX THIS AFTER 16.0.X");
232 m_holeSearchTool->countHoles(track, information, partHyp);
233}
234
235
236
237void
239 const EventContext&,
240 const Trk::Track&,
241 Trk::TrackSummary&) const
242{
243}
244
245StatusCode
247{
248 return StatusCode::SUCCESS;
249}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
This is an Identifier helper class for the Pixel subdetector.
This is an Identifier helper class for the SCT subdetector.
This is an Identifier helper class for the TRT subdetector.
virtual void addDetailedTrackSummary(const EventContext &ctx, const Trk::Track &, Trk::TrackSummary &) const override final
ToolHandle< ITRT_StrawStatusSummaryTool > m_TRTStrawSummaryTool
virtual StatusCode initialize() override
standard AlgTool methods: initialise retrieves Tools, finalize does nothing
virtual void analyse(const EventContext &ctx, const Trk::Track &track, const Trk::RIO_OnTrack *rot, const Trk::TrackStateOnSurface *tsos, std::vector< int > &information, std::bitset< Trk::numberOfDetectorTypes > &hitPattern) const override final
ToolHandle< Trk::ITrackHoleSearchTool > m_holeSearchTool
InDetTrackSummaryHelperTool(const std::string &, const std::string &, const IInterface *)
constructor
virtual void searchForHoles(const Trk::Track &track, std::vector< int > &information, const Trk::ParticleHypothesis partHyp=Trk::pion) const override final
Input : track, partHyp Output: Changes in information This method first calls the method getListOfHit...
const PixelID * m_pixelId
ID pixel helper.
Specific class to represent the pixel measurements.
Specific class to represent the SCT measurements.
Represents 'corrected' measurements from the TRT (for example, corrected for wire sag).
bool highLevel() const
returns true if the high level threshold was passed
Base class for all CompetingRIOsOnTack implementations, extends the common MeasurementBase.
unsigned int indexOfMaxAssignProb() const
Index of the ROT with the highest assignment probability.
virtual const RIO_OnTrack & rioOnTrack(unsigned int) const =0
returns the RIO_OnTrack (also known as ROT) objects depending on the integer.
const Amg::MatrixX & localCovariance() const
Interface method to get the localError.
Class to handle RIO On Tracks ROT) for InDet and Muons, it inherits from the common MeasurementBase.
Definition RIO_OnTrack.h:70
Identifier identify() const
return the identifier -extends MeasurementBase
virtual bool rioType(RIO_OnTrackType::Type type) const =0
Method checking the Rio On Track type.
represents the track state (measurement, material, fit parameters and quality) at a surface.
bool type(const TrackStateOnSurfaceType type) const
Use this method to find out if the TSoS is of a certain type: i.e.
@ Outlier
This TSoS contains an outlier, that is, it contains a MeasurementBase/RIO_OnTrack which was not used ...
A summary of the information contained by a track.
ParticleHypothesis
Enumeration for Particle hypothesis respecting the interaction with material.
@ pixelEndCap0
three pixel discs (on each side)
@ numberOfContribPixelLayers
number of contributing layers of the pixel detector
@ numberOfGangedPixels
number of Ganged Pixels flagged as fakes
@ numberOfPixelHits
number of pixel layers on track with absence of hits
@ numberOfTRTHighThresholdOutliers
number of dead TRT straws crossed
@ numberOfNextToInnermostPixelLayerHits
these are the pixel hits, including the b-layer
@ numberOfInnermostPixelLayerHits
these are the hits in the 1st pixel layer
@ numberOfTRTHighThresholdHits
total number of TRT hits which pass the high threshold
@ numberOfGangedFlaggedFakes
number of dead pixel sensors crossed
@ numberOfTRTTubeHits
number of TRT hits on track in straws with xenon
@ numberOfTRTHighThresholdHitsTotal
number of TRT hits used for dE/dx computation