ATLAS Offline Software
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
10 #include "InDetIdentifier/TRT_ID.h"
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 
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 //==========================================================================
66 void
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)
196  information[Trk::numberOfTRTHighThresholdHits]++;
197  assert(Trk::numberOfTRTHighThresholdHitsTotal < information.size());
199  }
200  }
201  }
202 
203  }
204 
205 }
206 
207 void
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 
225 void
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 
237 void
239  const EventContext&,
240  const Trk::Track&,
241  Trk::TrackSummary&) const
242 {
243 }
244 
247 {
248  return StatusCode::SUCCESS;
249 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
PixelID.h
This is an Identifier helper class for the Pixel subdetector. This class is a factory for creating co...
AtlasDetectorID::is_pixel
bool is_pixel(Identifier id) const
Definition: AtlasDetectorID.h:760
Trk::numberOfPixelHits
@ numberOfPixelHits
number of pixel layers on track with absence of hits
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:57
Trk::numberOfContribPixelLayers
@ numberOfContribPixelLayers
number of contributing layers of the pixel detector
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:49
SCT_ClusterOnTrack.h
SCT_ID.h
This is an Identifier helper class for the SCT subdetector. This class is a factory for creating comp...
Trk::numberOfTRTHighThresholdHits
@ numberOfTRTHighThresholdHits
total number of TRT hits which pass the high threshold
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:87
Trk::numberOfTRTHighThresholdOutliers
@ numberOfTRTHighThresholdOutliers
number of dead TRT straws crossed
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:93
Trk::numberOfInnermostPixelLayerHits
@ numberOfInnermostPixelLayerHits
these are the hits in the 1st pixel layer
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:53
TrackParameters.h
CompetingRIOsOnTrack.h
Trk::Track
The ATLAS Track class.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
AtlasDetectorID::is_sct
bool is_sct(Identifier id) const
Definition: AtlasDetectorID.h:770
Trk::numberOfPixelSpoiltHits
@ numberOfPixelSpoiltHits
number of DBM Hits
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:67
Trk::sctEndCap0
@ sctEndCap0
and 9 sct discs (on each side)
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:246
TRT_ID.h
This is an Identifier helper class for the TRT subdetector. This class is a factory for creating comp...
InDet::InDetTrackSummaryHelperTool::m_TRTStrawSummaryTool
ToolHandle< ITRT_StrawStatusSummaryTool > m_TRTStrawSummaryTool
Definition: InDetTrackSummaryHelperTool.h:118
Trk::sctBarrel0
@ sctBarrel0
four sct barrel layers
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:241
Trk::numberOfNextToInnermostPixelLayerHits
@ numberOfNextToInnermostPixelLayerHits
these are the pixel hits, including the b-layer
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:55
Trk::RIO_OnTrack::rioType
virtual bool rioType(RIO_OnTrackType::Type type) const =0
Method checking the Rio On Track type.
Trk::RIO_OnTrack
Definition: RIO_OnTrack.h:70
AtlasDetectorID::is_trt
bool is_trt(Identifier id) const
Definition: AtlasDetectorID.h:782
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
InDet::InDetTrackSummaryHelperTool::addDetailedTrackSummary
virtual void addDetailedTrackSummary(const EventContext &ctx, const Trk::Track &, Trk::TrackSummary &) const override final
Definition: InDetTrackSummaryHelperTool.cxx:238
InDet::TRT_DriftCircleOnTrack
Definition: TRT_DriftCircleOnTrack.h:53
TRTCond::StrawStatus::Dead
@ Dead
Definition: StrawStatus.h:18
TRTCond::StrawStatus::EmulateKrypton
@ EmulateKrypton
Definition: StrawStatus.h:18
InDetTrackSummaryHelperTool.h
Trk::TrackStateOnSurface::Outlier
@ Outlier
This TSoS contains an outlier, that is, it contains a MeasurementBase/RIO_OnTrack which was not used ...
Definition: TrackStateOnSurface.h:122
Track.h
Trk::ParticleHypothesis
ParticleHypothesis
Definition: ParticleHypothesis.h:25
Trk::pixelEndCap0
@ pixelEndCap0
three pixel discs (on each side)
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:237
Trk::TrackStateOnSurface::type
bool type(const TrackStateOnSurfaceType type) const
Use this method to find out if the TSoS is of a certain type: i.e.
Trk::CompetingRIOsOnTrack::rioOnTrack
virtual const RIO_OnTrack & rioOnTrack(unsigned int) const =0
returns the RIO_OnTrack (also known as ROT) objects depending on the integer.
PixelID::is_barrel
bool is_barrel(const Identifier &id) const
Test for barrel - WARNING: id MUST be pixel id, otherwise answer is not accurate. Use SiliconID for g...
Definition: PixelID.h:605
InDet::InDetTrackSummaryHelperTool::finalize
virtual StatusCode finalize() override
Definition: InDetTrackSummaryHelperTool.cxx:246
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
Trk::numberOfTRTTubeHits
@ numberOfTRTTubeHits
number of TRT hits on track in straws with xenon
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:97
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
Trk::RIO_OnTrackType::SCTCluster
@ SCTCluster
Definition: RIO_OnTrack.h:58
Trk::numberOfTRTOutliers
@ numberOfTRTOutliers
number of TRT holes
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:81
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
InDet::InDetTrackSummaryHelperTool::m_usePixel
BooleanProperty m_usePixel
Definition: InDetTrackSummaryHelperTool.h:125
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
InDet::InDetTrackSummaryHelperTool::m_trtId
const TRT_ID * m_trtId
ID TRT helper.
Definition: InDetTrackSummaryHelperTool.h:110
Trk::CompetingRIOsOnTrack
Base class for all CompetingRIOsOnTack implementations, extends the common MeasurementBase.
Definition: CompetingRIOsOnTrack.h:64
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
TRT_DriftCircleOnTrack.h
TRTCond::StrawStatus::EmulateArgon
@ EmulateArgon
Definition: StrawStatus.h:18
Trk::MeasurementBase::localCovariance
const Amg::MatrixX & localCovariance() const
Interface method to get the localError.
Definition: MeasurementBase.h:138
InDet::InDetTrackSummaryHelperTool::m_holeSearchTool
ToolHandle< Trk::ITrackHoleSearchTool > m_holeSearchTool
Definition: InDetTrackSummaryHelperTool.h:112
Trk::RIO_OnTrackType::TRT_DriftCircle
@ TRT_DriftCircle
Definition: RIO_OnTrack.h:59
Trk::numberOfGangedPixels
@ numberOfGangedPixels
number of Ganged Pixels flagged as fakes
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:61
InDet::InDetTrackSummaryHelperTool::searchForHoles
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...
Definition: InDetTrackSummaryHelperTool.cxx:226
PixelID::layer_disk
int layer_disk(const Identifier &id) const
Definition: PixelID.h:626
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
Trk::numberOfTRTHits
@ numberOfTRTHits
number of TRT outliers
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:79
Trk::TrackStateOnSurface
represents the track state (measurement, material, fit parameters and quality) at a surface.
Definition: TrackStateOnSurface.h:71
InDet::InDetTrackSummaryHelperTool::m_useTRT
BooleanProperty m_useTRT
Definition: InDetTrackSummaryHelperTool.h:127
Trk::TrackSummary
A summary of the information contained by a track.
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:287
RIO_OnTrack.h
Trk::numberOfSCTSpoiltHits
@ numberOfSCTSpoiltHits
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:78
SCT_ID::layer_disk
int layer_disk(const Identifier &id) const
Definition: SCT_ID.h:734
InDet::InDetTrackSummaryHelperTool::analyse
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
Definition: InDetTrackSummaryHelperTool.cxx:67
InDet::PixelClusterOnTrack
Definition: PixelClusterOnTrack.h:51
InDet::InDetTrackSummaryHelperTool::InDetTrackSummaryHelperTool
InDetTrackSummaryHelperTool(const std::string &, const std::string &, const IInterface *)
constructor
Definition: InDetTrackSummaryHelperTool.cxx:25
InDet::InDetTrackSummaryHelperTool::m_useSCT
BooleanProperty m_useSCT
Definition: InDetTrackSummaryHelperTool.h:126
Trk::RIO_OnTrack::identify
Identifier identify() const
return the identifier -extends MeasurementBase
Definition: RIO_OnTrack.h:152
convertTimingResiduals.offset
offset
Definition: convertTimingResiduals.py:71
Trk::numberOfGangedFlaggedFakes
@ numberOfGangedFlaggedFakes
number of dead pixel sensors crossed
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:63
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
Trk::numberOfTRTHighThresholdHitsTotal
@ numberOfTRTHighThresholdHitsTotal
number of TRT hits used for dE/dx computation
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:89
pix
Definition: PixelMapping.cxx:16
PixelClusterOnTrack.h
InDet::InDetTrackSummaryHelperTool::m_pixelId
const PixelID * m_pixelId
ID pixel helper.
Definition: InDetTrackSummaryHelperTool.h:104
Trk::CompetingRIOsOnTrack::indexOfMaxAssignProb
unsigned int indexOfMaxAssignProb() const
Index of the ROT with the highest assignment probability.
Definition: CompetingRIOsOnTrack.cxx:101
Trk::RIO_OnTrackType::PixelCluster
@ PixelCluster
Definition: RIO_OnTrack.h:57
TRTCond::StrawStatus::Argon
@ Argon
Definition: StrawStatus.h:18
Trk::numberOfTRTXenonHits
@ numberOfTRTXenonHits
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:99
InDet::InDetTrackSummaryHelperTool::initialize
virtual StatusCode initialize() override
standard AlgTool methods: initialise retrieves Tools, finalize does nothing
Definition: InDetTrackSummaryHelperTool.cxx:35
TRTCond::StrawStatus::Krypton
@ Krypton
Definition: StrawStatus.h:18
TrackStateOnSurface.h
InDet::SCT_ClusterOnTrack
Definition: SCT_ClusterOnTrack.h:44
SCT_ID::is_barrel
bool is_barrel(const Identifier &id) const
Test for barrel - WARNING: id MUST be sct id, otherwise answer is not accurate. Use SiliconID for gen...
Definition: SCT_ID.h:721
InDet::InDetTrackSummaryHelperTool::m_sctId
const SCT_ID * m_sctId
ID SCT helper.
Definition: InDetTrackSummaryHelperTool.h:107
Trk::TrackInfo::Unknown
@ Unknown
Track fitter not defined.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/TrackInfo.h:41
Identifier
Definition: IdentifierFieldParser.cxx:14