ATLAS Offline Software
InDetAccessor.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 #include "InDetAccessor.h"
5 #ifndef XAOD_ANALYSIS
9 
10 namespace InDetAccessor {
11  std::tuple<uint8_t,uint8_t> getSiHitsTopBottom( const Trk::Track& track, const asg::AsgMessaging &msgHelper) {
12  std::tuple<uint8_t, uint8_t> top_bottom {0,0};
13 
14  const DataVector<const Trk::MeasurementBase>* trkMeasurements = track.measurementsOnTrack();
15  if (!trkMeasurements) {
16  IDTRKSEL_MSG_WARNING( "Null pointer to Trk::MeasurementBase vector." );
17  }
18  else {
19  // code in here is mostly adapted from InDetCosmicTrackSelectorTool
20  for (const Trk::MeasurementBase* measurement : *trkMeasurements) {
21  const Trk::RIO_OnTrack* rot = dynamic_cast<const Trk::RIO_OnTrack*>(measurement);
22  if (!rot) {
23  continue;
24  }
25  const InDet::SiClusterOnTrack* siclus
26  = dynamic_cast<const InDet::SiClusterOnTrack*>(rot);
27  if (!siclus) {
28  continue;
29  }
30  float ypos = siclus->globalPosition().y();
31  if (ypos == 0) {
32  continue; // neither top nor bottom
33  }
34 
35  const InDet::SCT_ClusterOnTrack* sctclus
36  = dynamic_cast<const InDet::SCT_ClusterOnTrack*>(siclus);
37  if (!sctclus) {
38  // Pixel hit
39  if (ypos > 0) {
40  std::get<0>(top_bottom) +=2;
41  }
42  else {
43  std::get<1>(top_bottom)+=2;
44  }
45  } else {
46  // SCT hit
47  if (ypos > 0) {
48  std::get<0>(top_bottom)++;
49  }
50  else {
51  std::get<1>(top_bottom)++;
52  }
53  }
54  }
55  }
56  return top_bottom;
57  }
58 }
59 #endif
IDTRKSEL_MSG_WARNING
#define IDTRKSEL_MSG_WARNING(the_msg)
Definition: InDetAccessor.h:24
SCT_ClusterOnTrack.h
InDetAccessor
Definition: InDetTrackSelectionTool.h:32
Trk::Track
The ATLAS Track class.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
InDetAccessor::getSiHitsTopBottom
std::tuple< uint8_t, uint8_t > getSiHitsTopBottom(const Trk::Track &track, const asg::AsgMessaging &msgHelper)
Definition: InDetAccessor.cxx:11
Trk::RIO_OnTrack
Definition: RIO_OnTrack.h:70
SiClusterOnTrack.h
InDetAccessor.h
InDet::SiClusterOnTrack::globalPosition
virtual const Amg::Vector3D & globalPosition() const override
returns global position (gathered through Surface constraint)
Definition: SiClusterOnTrack.h:115
DataVector< const Trk::MeasurementBase >
Trk::MeasurementBase
Definition: MeasurementBase.h:58
RIO_OnTrack.h
asg::AsgMessaging
Class mimicking the AthMessaging class from the offline software.
Definition: AsgMessaging.h:40
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
InDet::SiClusterOnTrack
Definition: SiClusterOnTrack.h:39
InDet::SCT_ClusterOnTrack
Definition: SCT_ClusterOnTrack.h:44