ATLAS Offline Software
Loading...
Searching...
No Matches
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
22
23// Data members classes
24
25class TRT_LoLumRawData final : public TRT_RDORawData{
26
28 // Public methods:
30public:
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);
37 TRT_LoLumRawData(TRT_LoLumRawData&&) noexcept = default;
38 TRT_LoLumRawData& operator=(const TRT_LoLumRawData&) = default;
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
78protected:
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
86public:
87 // width of the drift time bins
88 static constexpr double getDriftTimeBinWidth() {
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
105public:
106 // public default constructor needed for I/O, but should not be
107 // called from an alg
109
111 // Private data:
113private:
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 */
127inline
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 */
139inline
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 */
153inline 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 */
164inline bool
166{
167 return (m_word & 0x1);
168}
169
170
171#endif // INDETRAWDATA_TRT_LOLUMRAWDATA_H
172
Cached value with atomic update.
Cached value with atomic update.
Definition CachedValue.h:55
unsigned int m_word
virtual double timeOverThreshold() const override final
bool firstBinHigh() const
static constexpr double m_driftTimeBinWidth
TRT_LoLumRawData(const Identifier rdoId, const unsigned int word)
bool lastBinHigh() const
virtual bool highLevel() const override final
static constexpr double getDriftTimeBinWidth()
TRT_LoLumRawData(const TRT_LoLumRawData &)=default
static constexpr unsigned int m_maskThreeLastBits
int trailingEdge() const
static bool highLevel(unsigned int word)
static constexpr unsigned int m_maskFourLastBits
virtual int driftTimeBin() const override final
TRT_LoLumRawData(TRT_LoLumRawData &&) noexcept=default
CxxUtils::CachedValue< Island > m_island
static void findLargestIsland(unsigned int word, Island &island)
TRT_RDORawData(const Identifier rdoId, const unsigned int word)