ATLAS Offline Software
Loading...
Searching...
No Matches
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
10namespace 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
#define IDTRKSEL_MSG_WARNING(the_msg)
Derived DataVector<T>.
Definition DataVector.h:795
Specific class to represent the SCT measurements.
RIO_OnTrack base class for Silicon detector in the InnerDetector.
virtual const Amg::Vector3D & globalPosition() const override
returns global position (gathered through Surface constraint)
This class is the pure abstract base class for all fittable tracking measurements.
Class to handle RIO On Tracks ROT) for InDet and Muons, it inherits from the common MeasurementBase.
Definition RIO_OnTrack.h:70
Class mimicking the AthMessaging class from the offline software.
std::tuple< uint8_t, uint8_t > getSiHitsTopBottom(const Trk::Track &track, const asg::AsgMessaging &msgHelper)