ATLAS Offline Software
TRT_DriftCircle.icc
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 namespace InDet {
6 
7 inline unsigned int
8 TRT_DriftCircle::getWord() const
9 {
10  return m_word;
11 }
12 
13 inline int
14 TRT_DriftCircle::driftTimeBin() const
15 {
16  if (!m_island.isValid()) {
17  Island tmpIsland;
18  TRT_LoLumRawData::findLargestIsland(m_word, tmpIsland);
19  m_island.set(tmpIsland);
20  }
21  return m_island.ptr()->m_leadingEdge;
22 }
23 
24 inline int
25 TRT_DriftCircle::trailingEdge() const
26 {
27  if (!m_island.isValid()) {
28  Island tmpIsland;
29  TRT_LoLumRawData::findLargestIsland(m_word, tmpIsland);
30  m_island.set(tmpIsland);
31  }
32  return m_island.ptr()->m_trailingEdge;
33 }
34 
35 inline bool
36 TRT_DriftCircle::highLevel() const
37 {
38  return TRT_LoLumRawData::highLevel(m_word);
39 }
40 
41 inline bool
42 TRT_DriftCircle::firstBinHigh() const
43 {
44  return (m_word & 0x02000000);
45 }
46 
47 inline bool
48 TRT_DriftCircle::lastBinHigh() const
49 {
50  return (m_word & 0x1);
51 }
52 
53 inline double
54 TRT_DriftCircle::timeOverThreshold() const {
55  unsigned int leadingEdge = driftTimeBin();
56  unsigned int trailingEdge = this->trailingEdge();
57  if (leadingEdge && trailingEdge) {
58  return (trailingEdge - leadingEdge + 1) *
59  TRT_LoLumRawData::getDriftTimeBinWidth();
60  };
61  return 0.;
62 }
63 
64 inline double
65 TRT_DriftCircle::rawDriftTime() const {
66  return (driftTimeBin() + 0.5) * TRT_LoLumRawData::getDriftTimeBinWidth();
67 }
68 
69 inline bool
70 TRT_DriftCircle::driftTimeValid() const
71 {
72  return m_word & 0x08000000;
73 }
74 
75 inline double
76 TRT_DriftCircle::driftTime(bool& valid) const
77 {
78  valid = driftTimeValid();
79  return rawDriftTime();
80 }
81 
82 inline void
83 TRT_DriftCircle::setDriftTimeValid(bool valid)
84 {
85  unsigned maskfalse = 0xF7FFFFFF;
86  unsigned masktrue = 0x08000000;
87  if (valid) {
88  m_word |= masktrue;
89  } else {
90  m_word &= maskfalse;
91  }
92 }
93 
94 
95 inline int
96 TRT_DriftCircle::numberOfHighsBetweenEdges() const
97 {
98  // should return always 0 with the largest island algorithm
99  int LE = driftTimeBin();
100  int TE = trailingEdge();
101  unsigned mask = 0x02000000;
102  int nhigh = 0;
103  int i;
104  for (i = 0; i < 24; ++i) {
105  if ((m_word & mask) && i >= LE && i <= TE)
106  nhigh++;
107  mask >>= 1;
108  if (i == 7 || i == 15)
109  mask >>= 1;
110  }
111  return nhigh;
112 }
113 
114 inline int
115 TRT_DriftCircle::numberOfLowsBetweenEdges() const
116 {
117  // should return always 0 with the largest island algorithm
118  int LE = driftTimeBin();
119  int TE = trailingEdge();
120  return (TE - LE + 1 - numberOfHighsBetweenEdges());
121 }
122 
123 inline bool
124 TRT_DriftCircle::isNoise() const
125 {
126  if (numberOfHighsBetweenEdges() < 3)
127  return true;
128  if (timeOverThreshold() < 7.)
129  return true;
130  return false;
131 }
132 
133 inline bool
134 TRT_DriftCircle::type(Trk::PrepRawDataType type) const
135 {
136  return type == Trk::PrepRawDataType::TRT_DriftCircle;
137 }
138 
139 inline const InDetDD::TRT_BaseElement*
140 TRT_DriftCircle::detectorElement() const
141 {
142  return m_detEl;
143 }
144 
145 }