ATLAS Offline Software
TRT_LoLumRawData.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // TRT_LoLumRawData.h
7 // Header file for class TRT_LoLumRawData
9 // (c) ATLAS Detector software
11 // Class to implement RawData for TRT, full encoding
13 // Version 1.0 14/10/2002 Veronique Boisvert
15 
16 #ifndef INDETRAWDATA_TRT_LOLUMRAWDATA_H
17 #define INDETRAWDATA_TRT_LOLUMRAWDATA_H
18 
19 // Base class
21 #include "CxxUtils/CachedValue.h"
22 
23 // Data members classes
24 
25 class TRT_LoLumRawData final : public TRT_RDORawData{
26 
28  // Public methods:
30 public:
31 
32  // Constructor with parameters:
33  // offline hashId of the readout element,
34  // the word
35  TRT_LoLumRawData(const Identifier rdoId, const unsigned int word);
39  TRT_LoLumRawData& operator=(TRT_LoLumRawData&&) noexcept = default;
40  virtual ~TRT_LoLumRawData() = default;
41 
42  // High level threshold:
43  virtual bool highLevel() const override final;
44  bool highLevel(int /* BX */) const;
45 
46  // Time over threshold in ns for valid digits; zero otherwise:
47  virtual double timeOverThreshold() const override final {
48  unsigned int leadingEdge = driftTimeBin();
49  unsigned int trailingEdge = this->trailingEdge();
50  if (leadingEdge && trailingEdge) {
51  return (trailingEdge - leadingEdge + 1) * m_driftTimeBinWidth;
52  };
53  return 0.;
54  };
55 
56  // drift time in bin
57  virtual int driftTimeBin() const override final {
58  if (!m_island.isValid()) {
59  Island tmpIsland;
60  findLargestIsland(m_word, tmpIsland);
61  m_island.set(tmpIsland);
62  }
63  return m_island.ptr()->m_leadingEdge;
64  };
65 
66  int trailingEdge() const {
67  if (!m_island.isValid()) {
68  Island tmpIsland;
69  findLargestIsland(m_word, tmpIsland);
70  m_island.set(tmpIsland);
71  }
72  return m_island.ptr()->m_trailingEdge;
73  };
74 
75  bool firstBinHigh() const; // True if first time bin is high
76  bool lastBinHigh() const; // True if last time bin is high
77 
78 protected:
79  // width of the drift time bins
80  static constexpr double m_driftTimeBinWidth = 3.125;
81 
82  // bit masks used in interpretation of bit pattern
83  static constexpr unsigned int m_maskFourLastBits=0xFFFFFF0; // 1 1 11111111 1 11111111 1 11110000
84  static constexpr unsigned int m_maskThreeLastBits=0xFFFFFF8; // 1 1 11111111 1 11111111 1 11111000
85 
86 public:
87  // width of the drift time bins
88  static constexpr double getDriftTimeBinWidth() {
89  return m_driftTimeBinWidth;
90  };
91 
92  struct Island {
93  unsigned int m_leadingEdge = 0;
94  unsigned int m_trailingEdge = 0;
95  };
96  // Find the relevant island of bits from the bit pattern, defined as the largest island with the latest leading edge
97  static void findLargestIsland(unsigned int word, Island& island);
98  // Check if the middle HT bit is set
99  inline
100  static bool highLevel(unsigned int word) {
101  // return (m_word & 0x04020100); // check any of the three HT bits
102  return (word & 0x00020000); // check only middle HT bit
103  }
104 
105 public:
106  // public default constructor needed for I/O, but should not be
107  // called from an alg
109 
111  // Private data:
113 private:
115 
116 };
117 
119 // Inline methods:
121 
122 /*
123  * highLevel() -
124  * Returns true if there is a high threshold hit in the middle bunch crossing, false
125  * otherwise
126  */
127 inline
129 {
130  return highLevel(m_word);
131 }
132 
133 /*
134  * highLevel( BX ) -
135  * Returns true if there is a high threshold hit in bunch crossing BX, false
136  * otherwise. BX is 1 for the earliest bunch crossing and 3 for the latest
137  * bunch crossing.
138  */
139 inline
140 bool TRT_LoLumRawData::highLevel(int BX) const
141 {
142  if ( (BX < 1) || (BX > 3) )
143  return false;
144 
145  return (m_word & ( 1 << (9 * BX - 1) ));
146 
147 }
148 
149 /*
150  * firstBinHigh() -
151  * Returns true if the first low threshold time bin it high, false otherwise.
152  */
153 inline bool
155 {
156  return (m_word & 0x02000000);
157 }
158 
159 
160 /*
161  * lastBinHigh() -
162  * Returns true if the last low threshold time bin it high, false otherwise.
163  */
164 inline bool
166 {
167  return (m_word & 0x1);
168 }
169 
170 
171 #endif // INDETRAWDATA_TRT_LOLUMRAWDATA_H
172 
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
TRT_LoLumRawData::m_island
CxxUtils::CachedValue< Island > m_island
Definition: TRT_LoLumRawData.h:114
TRT_LoLumRawData::highLevel
virtual bool highLevel() const override final
Definition: TRT_LoLumRawData.h:128
TRT_LoLumRawData::lastBinHigh
bool lastBinHigh() const
Definition: TRT_LoLumRawData.h:165
TRT_LoLumRawData
Definition: TRT_LoLumRawData.h:25
TRT_LoLumRawData::m_driftTimeBinWidth
static constexpr double m_driftTimeBinWidth
Definition: TRT_LoLumRawData.h:80
TRT_RDORawData.h
TRT_LoLumRawData::Island
Definition: TRT_LoLumRawData.h:92
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
TRT_LoLumRawData::TRT_LoLumRawData
TRT_LoLumRawData()
Definition: TRT_LoLumRawData.cxx:23
TRT_LoLumRawData::m_maskThreeLastBits
static constexpr unsigned int m_maskThreeLastBits
Definition: TRT_LoLumRawData.h:84
TRT_LoLumRawData::getDriftTimeBinWidth
static constexpr double getDriftTimeBinWidth()
Definition: TRT_LoLumRawData.h:88
TRT_RDORawData
Definition: TRT_RDORawData.h:24
TRT_LoLumRawData::driftTimeBin
virtual int driftTimeBin() const override final
Definition: TRT_LoLumRawData.h:57
TRT_LoLumRawData::firstBinHigh
bool firstBinHigh() const
Definition: TRT_LoLumRawData.h:154
TRT_LoLumRawData::findLargestIsland
static void findLargestIsland(unsigned int word, Island &island)
Definition: TRT_LoLumRawData.cxx:33
TRT_LoLumRawData::TRT_LoLumRawData
TRT_LoLumRawData(const TRT_LoLumRawData &)=default
CxxUtils::CachedValue
Cached value with atomic update.
Definition: CachedValue.h:55
InDetRawData::m_word
unsigned int m_word
Definition: InDetRawData.h:72
TRT_LoLumRawData::trailingEdge
int trailingEdge() const
Definition: TRT_LoLumRawData.h:66
TRT_LoLumRawData::TRT_LoLumRawData
TRT_LoLumRawData(TRT_LoLumRawData &&) noexcept=default
CachedValue.h
Cached value with atomic update.
TRT_LoLumRawData::timeOverThreshold
virtual double timeOverThreshold() const override final
Definition: TRT_LoLumRawData.h:47
TRT_LoLumRawData::Island::m_leadingEdge
unsigned int m_leadingEdge
Definition: TRT_LoLumRawData.h:93
TRT_LoLumRawData::Island::m_trailingEdge
unsigned int m_trailingEdge
Definition: TRT_LoLumRawData.h:94
TRT_LoLumRawData::m_maskFourLastBits
static constexpr unsigned int m_maskFourLastBits
Definition: TRT_LoLumRawData.h:83
python.CaloScaleNoiseConfig.default
default
Definition: CaloScaleNoiseConfig.py:79
TRT_LoLumRawData::highLevel
static bool highLevel(unsigned int word)
Definition: TRT_LoLumRawData.h:100
Identifier
Definition: IdentifierFieldParser.cxx:14