ATLAS Offline Software
Loading...
Searching...
No Matches
MdtAmtReadOut Class Reference

#include <MdtAmtReadOut.h>

Inheritance diagram for MdtAmtReadOut:
Collaboration diagram for MdtAmtReadOut:

Public Member Functions

 MdtAmtReadOut ()
 ~MdtAmtReadOut ()=default
void decodeWord (uint32_t dataWord)
void encodeWord (uint16_t headerVal)
bool is_BOT ()
bool is_EOT ()
bool is_TMC ()
bool is_TSM ()
bool is_TCM ()
bool is_TES ()
bool is_TWC ()
uint16_t tdcId ()
uint16_t ecnt ()
uint16_t bcId ()
uint16_t jt ()
uint16_t channel ()
uint16_t coarse ()
uint16_t fine ()
uint16_t width ()
bool errflag ()
uint16_t errstatus ()
uint32_t masked ()
bool isLeading ()
uint32_t makeBOT (uint16_t tdcId, uint16_t ecnt, uint16_t bcid)
uint32_t makeEOT (uint16_t jt, uint16_t ecnt, uint16_t wcnt)
uint32_t makeTSM (uint16_t jt, uint16_t channel, bool leading, bool errflag, uint16_t coarse, uint16_t fine)
uint32_t makeTCM (uint16_t jt, uint16_t channel, uint16_t width, uint16_t coarse, uint16_t fine)
uint32_t makeTMC (uint16_t jt, uint32_t masked)

Protected Member Functions

constexpr std::pair< uint32_t, uint16_t > getBitsWord (const uint16_t bstart, const uint16_t bstop)
uint32_t getBits (std::pair< uint32_t, uint16_t > wordbstop) const

Static Protected Member Functions

static uint32_t setBits (uint16_t nData, const uint16_t *inputData, const uint16_t *inputPos)
static uint32_t setBits (uint16_t nData, const uint32_t *inputData, const uint16_t *inputPos)

Protected Attributes

uint32_t m_word

Private Member Functions

void setZero ()

Private Attributes

uint32_t m_dataWord
uint16_t m_wordHeader
uint16_t m_tdcId
uint16_t m_ecnt
uint16_t m_bcId
uint16_t m_wcnt
uint16_t m_jt
uint16_t m_channel
uint16_t m_coarse
uint16_t m_fine
uint16_t m_width
bool m_errflag
uint16_t m_errstatus
uint32_t m_masked
bool m_leading

Static Private Attributes

static constexpr uint16_t s_headerPos = 28
static constexpr uint16_t s_headerBits = 0xf
static constexpr uint16_t s_BOTvalue1 = 0xa
static constexpr uint16_t s_BOTvalue2 = 0xb
static constexpr uint16_t s_EOTvalue = 0xc
static constexpr uint16_t s_TMCvalue = 0x2
static constexpr uint16_t s_TSMvalue = 0x3
static constexpr uint16_t s_TCMvalue = 0x4
static constexpr uint16_t s_TESvalue = 0x6
static constexpr uint16_t s_TWCvalue = 0x8

Detailed Description

Definition at line 15 of file MdtAmtReadOut.h.

Constructor & Destructor Documentation

◆ MdtAmtReadOut()

MdtAmtReadOut::MdtAmtReadOut ( )

Definition at line 12 of file MdtAmtReadOut.cxx.

12 :
13 m_dataWord(0),
14 m_wordHeader(0),
15 m_tdcId(0),
16 m_ecnt(0),
17 m_bcId(0),
18 m_wcnt(0),
19 m_jt(0),
20 m_channel(0),
21 m_coarse(0),
22 m_fine(0),
23 m_width(0),
24 m_errflag(0),
25 m_errstatus(0),
26 m_masked(0),
27 m_leading(false) {}
uint16_t m_tdcId
uint16_t m_errstatus
uint32_t m_dataWord
uint16_t m_bcId
uint16_t m_fine
uint32_t m_masked
uint16_t m_width
uint16_t m_wordHeader
uint16_t m_ecnt
uint16_t m_channel
uint16_t m_coarse
uint16_t m_wcnt

◆ ~MdtAmtReadOut()

MdtAmtReadOut::~MdtAmtReadOut ( )
default

Member Function Documentation

◆ bcId()

uint16_t MdtAmtReadOut::bcId ( )
inline

Definition at line 101 of file MdtAmtReadOut.h.

101{ return m_bcId; }

◆ channel()

uint16_t MdtAmtReadOut::channel ( )
inline

Definition at line 104 of file MdtAmtReadOut.h.

104{ return m_channel; }

◆ coarse()

uint16_t MdtAmtReadOut::coarse ( )
inline

Definition at line 105 of file MdtAmtReadOut.h.

105{ return m_coarse; }

◆ decodeWord()

void MdtAmtReadOut::decodeWord ( uint32_t dataWord)

Definition at line 29 of file MdtAmtReadOut.cxx.

29 {
30 // Zero all the decoded quantities
31 setZero();
32 m_dataWord = dataWord;
33 m_word = dataWord;
34 m_wordHeader = (dataWord >> s_headerPos) & s_headerBits;
35
36 if (is_TSM()) // TDC single measurement
37 {
39 m_jt = getBits(getBitsWord(25, 24));
40 m_channel = getBits(getBitsWord(23, 19));
41 m_errflag = getBits(getBitsWord(17, 17));
43 m_fine = getBits(getBitsWord(4, 0));
44 } else if (is_TCM()) // TDC combined measurement
45 {
46 m_jt = getBits(getBitsWord(25, 24));
47 m_channel = getBits(getBitsWord(23, 19));
48 m_width = getBits(getBitsWord(18, 11));
50 m_fine = getBits(getBitsWord(4, 0));
51 } else if (is_BOT()) // Beginning of TDC
52 {
53 // One header bit is used for TDC numbers > 15
54 m_tdcId = getBits(getBitsWord(28, 24));
55 m_ecnt = getBits(getBitsWord(23, 12));
56 m_bcId = getBits(getBitsWord(11, 0));
57 } else if (is_EOT()) // End of TDC
58 {
59 m_ecnt = getBits(getBitsWord(23, 12));
60 m_wcnt = getBits(getBitsWord(11, 0));
61 } else if (is_TMC()) // TDC masked channels flag
62 {
63 m_jt = getBits(getBitsWord(25, 24));
65 } else if (is_TES()) // TDC error status
66 {
67 m_jt = getBits(getBitsWord(25, 24));
69 }
70 // special decoding of the CSM trailer word count - nothing to do here
71 else if (is_TWC()) {}
72}
static constexpr uint16_t s_headerPos
static constexpr uint16_t s_headerBits
uint32_t getBits(std::pair< uint32_t, uint16_t > wordbstop) const
Definition MdtReadOut.h:27
uint32_t m_word
Definition MdtReadOut.h:38
constexpr std::pair< uint32_t, uint16_t > getBitsWord(const uint16_t bstart, const uint16_t bstop)
Definition MdtReadOut.h:20
setBGCode setTAP setLVL2ErrorBits bool

◆ ecnt()

uint16_t MdtAmtReadOut::ecnt ( )
inline

Definition at line 100 of file MdtAmtReadOut.h.

100{ return m_ecnt; }

◆ encodeWord()

void MdtAmtReadOut::encodeWord ( uint16_t headerVal)

◆ errflag()

bool MdtAmtReadOut::errflag ( )
inline

Definition at line 108 of file MdtAmtReadOut.h.

108{ return m_errflag; }

◆ errstatus()

uint16_t MdtAmtReadOut::errstatus ( )
inline

Definition at line 109 of file MdtAmtReadOut.h.

109{ return m_errstatus; }

◆ fine()

uint16_t MdtAmtReadOut::fine ( )
inline

Definition at line 106 of file MdtAmtReadOut.h.

106{ return m_fine; }

◆ getBits()

uint32_t MdtReadOut::getBits ( std::pair< uint32_t, uint16_t > wordbstop) const
inlineprotectedinherited

Definition at line 27 of file MdtReadOut.h.

27 {
28 uint32_t result = (m_word >> wordbstop.second) & (wordbstop.first | 1);
29 return result;
30 }
setEventNumber uint32_t

◆ getBitsWord()

std::pair< uint32_t, uint16_t > MdtReadOut::getBitsWord ( const uint16_t bstart,
const uint16_t bstop )
inlineconstexprprotectedinherited

Definition at line 20 of file MdtReadOut.h.

20 {
21 uint32_t word = 0;
22 for (uint16_t i = bstop; i < bstart; i++) word = ((word | 1) << 1);
23 return std::make_pair(word, bstop);
24 }

◆ is_BOT()

bool MdtAmtReadOut::is_BOT ( )
inline

Definition at line 83 of file MdtAmtReadOut.h.

83{ return ((m_wordHeader == s_BOTvalue1) || (m_wordHeader == s_BOTvalue2)); };
static constexpr uint16_t s_BOTvalue1
static constexpr uint16_t s_BOTvalue2

◆ is_EOT()

bool MdtAmtReadOut::is_EOT ( )
inline

Definition at line 85 of file MdtAmtReadOut.h.

85{ return (m_wordHeader == s_EOTvalue); };
static constexpr uint16_t s_EOTvalue

◆ is_TCM()

bool MdtAmtReadOut::is_TCM ( )
inline

Definition at line 91 of file MdtAmtReadOut.h.

91{ return (m_wordHeader == s_TCMvalue); };
static constexpr uint16_t s_TCMvalue

◆ is_TES()

bool MdtAmtReadOut::is_TES ( )
inline

Definition at line 93 of file MdtAmtReadOut.h.

93{ return (m_wordHeader == s_TESvalue); };
static constexpr uint16_t s_TESvalue

◆ is_TMC()

bool MdtAmtReadOut::is_TMC ( )
inline

Definition at line 87 of file MdtAmtReadOut.h.

87{ return (m_wordHeader == s_TMCvalue); };
static constexpr uint16_t s_TMCvalue

◆ is_TSM()

bool MdtAmtReadOut::is_TSM ( )
inline

Definition at line 89 of file MdtAmtReadOut.h.

89{ return (m_wordHeader == s_TSMvalue); };
static constexpr uint16_t s_TSMvalue

◆ is_TWC()

bool MdtAmtReadOut::is_TWC ( )
inline

Definition at line 96 of file MdtAmtReadOut.h.

96{ return (m_wordHeader == s_TWCvalue); };
static constexpr uint16_t s_TWCvalue

◆ isLeading()

bool MdtAmtReadOut::isLeading ( )
inline

Definition at line 111 of file MdtAmtReadOut.h.

111{ return m_leading; }

◆ jt()

uint16_t MdtAmtReadOut::jt ( )
inline

Definition at line 103 of file MdtAmtReadOut.h.

103{ return m_jt; }

◆ makeBOT()

uint32_t MdtAmtReadOut::makeBOT ( uint16_t tdcId,
uint16_t ecnt,
uint16_t bcid )

Definition at line 92 of file MdtAmtReadOut.cxx.

92 {
93 uint16_t inputData[4];
94 uint16_t inputPos[4] = {s_headerPos, 24, 12, 0};
95 uint16_t nData = 4;
96
97 if (tdcId < 16) {
98 inputData[0] = s_BOTvalue1;
99 } else {
100 inputData[0] = s_BOTvalue2;
101 tdcId -= 16;
102 }
103
104 inputData[1] = tdcId;
105 inputData[2] = ecnt;
106 inputData[3] = bcid;
107
108 return setBits(nData, inputData, inputPos);
109}
uint16_t ecnt()
uint16_t tdcId()
static uint32_t setBits(uint16_t nData, const uint16_t *inputData, const uint16_t *inputPos)
setEventNumber setTimeStamp bcid
setWord1 uint16_t

◆ makeEOT()

uint32_t MdtAmtReadOut::makeEOT ( uint16_t jt,
uint16_t ecnt,
uint16_t wcnt )

Definition at line 112 of file MdtAmtReadOut.cxx.

112 {
113 uint16_t inputData[5] = {s_EOTvalue, 0, jt, ecnt, wcnt};
114 uint16_t inputPos[5] = {s_headerPos, 26, 24, 12, 0};
115 uint16_t nData = 5;
116
117 return setBits(nData, inputData, inputPos);
118}
uint16_t jt()

◆ makeTCM()

uint32_t MdtAmtReadOut::makeTCM ( uint16_t jt,
uint16_t channel,
uint16_t width,
uint16_t coarse,
uint16_t fine )

Definition at line 142 of file MdtAmtReadOut.cxx.

142 {
143 uint16_t inputData[7] = {(uint16_t)s_TCMvalue,
144 0,
145 static_cast<uint16_t>(jt & 0x2),
146 static_cast<uint16_t>(channel & 0x1f),
147 static_cast<uint16_t>(width & 0xff),
148 static_cast<uint16_t>(coarse & 0x3f),
149 static_cast<uint16_t>(fine & 0x1f)};
150 uint16_t inputPos[7] = {s_headerPos, 26, 24, 19, 11, 5, 0};
151 uint16_t nData = 7;
152
153 return setBits(nData, inputData, inputPos);
154}
uint16_t coarse()
uint16_t channel()
uint16_t width()
uint16_t fine()

◆ makeTMC()

uint32_t MdtAmtReadOut::makeTMC ( uint16_t jt,
uint32_t masked )

Definition at line 156 of file MdtAmtReadOut.cxx.

156 {
157 uint16_t masked_low = masked & 0xffff;
158 uint16_t masked_high = masked & 0xff0000;
159
160 uint16_t inputData[5] = {s_TMCvalue, 0, jt, masked_high, masked_low};
161 uint16_t inputPos[5] = {s_headerPos, 26, 24, 16, 0};
162 uint16_t nData = 5;
163
164 return setBits(nData, inputData, inputPos);
165}
uint32_t masked()

◆ makeTSM()

uint32_t MdtAmtReadOut::makeTSM ( uint16_t jt,
uint16_t channel,
bool leading,
bool errflag,
uint16_t coarse,
uint16_t fine )

Definition at line 121 of file MdtAmtReadOut.cxx.

121 {
122 uint16_t lead = 1;
123 uint16_t err = 0;
124 if (leading) lead = 0;
125 if (errflag) err = 1;
126
127 uint16_t inputData[8] = {(uint16_t)s_TSMvalue,
128 0,
129 static_cast<uint16_t>(jt & 0x2),
130 static_cast<uint16_t>(channel & 0x1f),
131 static_cast<uint16_t>(lead & 0x1),
132 static_cast<uint16_t>(err & 0x1),
133 static_cast<uint16_t>(coarse & 0xfff),
134 static_cast<uint16_t>(fine & 0x1f)};
135 uint16_t inputPos[8] = {s_headerPos, 26, 24, 19, 18, 17, 5, 0};
136 uint16_t nData = 8;
137
138 return setBits(nData, inputData, inputPos);
139}

◆ masked()

uint32_t MdtAmtReadOut::masked ( )
inline

Definition at line 110 of file MdtAmtReadOut.h.

110{ return m_masked; }

◆ setBits() [1/2]

uint32_t MdtReadOut::setBits ( uint16_t nData,
const uint16_t * inputData,
const uint16_t * inputPos )
staticprotectedinherited

Definition at line 14 of file MdtReadOut.cxx.

14 {
15 uint32_t result = 0;
16 uint32_t input = 0;
17 uint16_t pos = 0;
18 for (uint16_t i = 0; i < nData; i++) {
19 input = *(inputData + i);
20 pos = *(inputPos + i);
21 result = result | (input << pos);
22 }
23 return result;
24}

◆ setBits() [2/2]

uint32_t MdtReadOut::setBits ( uint16_t nData,
const uint32_t * inputData,
const uint16_t * inputPos )
staticprotectedinherited

Definition at line 27 of file MdtReadOut.cxx.

27 {
28 uint32_t result = 0;
29 uint32_t input = 0;
30 uint16_t pos = 0;
31 for (uint16_t i = 0; i < nData; i++) {
32 input = *(inputData + i);
33 pos = *(inputPos + i);
34 result = result | (input << pos);
35 }
36 return result;
37}

◆ setZero()

void MdtAmtReadOut::setZero ( )
private

Definition at line 74 of file MdtAmtReadOut.cxx.

74 {
75 m_tdcId = 0;
76 m_ecnt = 0;
77 m_bcId = 0;
78 m_wcnt = 0;
79 m_jt = 0;
80 m_channel = 0;
81 m_coarse = 0;
82 m_fine = 0;
83 m_width = 0;
84 m_errflag = 0;
85 m_errstatus = 0;
86 m_masked = 0;
87 m_leading = false;
88}

◆ tdcId()

uint16_t MdtAmtReadOut::tdcId ( )
inline

Definition at line 99 of file MdtAmtReadOut.h.

99{ return m_tdcId; }

◆ width()

uint16_t MdtAmtReadOut::width ( )
inline

Definition at line 107 of file MdtAmtReadOut.h.

107{ return m_width; }

Member Data Documentation

◆ m_bcId

uint16_t MdtAmtReadOut::m_bcId
private

Definition at line 25 of file MdtAmtReadOut.h.

◆ m_channel

uint16_t MdtAmtReadOut::m_channel
private

Definition at line 32 of file MdtAmtReadOut.h.

◆ m_coarse

uint16_t MdtAmtReadOut::m_coarse
private

Definition at line 33 of file MdtAmtReadOut.h.

◆ m_dataWord

uint32_t MdtAmtReadOut::m_dataWord
private

Definition at line 18 of file MdtAmtReadOut.h.

◆ m_ecnt

uint16_t MdtAmtReadOut::m_ecnt
private

Definition at line 24 of file MdtAmtReadOut.h.

◆ m_errflag

bool MdtAmtReadOut::m_errflag
private

Definition at line 36 of file MdtAmtReadOut.h.

◆ m_errstatus

uint16_t MdtAmtReadOut::m_errstatus
private

Definition at line 37 of file MdtAmtReadOut.h.

◆ m_fine

uint16_t MdtAmtReadOut::m_fine
private

Definition at line 34 of file MdtAmtReadOut.h.

◆ m_jt

uint16_t MdtAmtReadOut::m_jt
private

Definition at line 31 of file MdtAmtReadOut.h.

◆ m_leading

bool MdtAmtReadOut::m_leading
private

Definition at line 40 of file MdtAmtReadOut.h.

◆ m_masked

uint32_t MdtAmtReadOut::m_masked
private

Definition at line 39 of file MdtAmtReadOut.h.

◆ m_tdcId

uint16_t MdtAmtReadOut::m_tdcId
private

Definition at line 23 of file MdtAmtReadOut.h.

◆ m_wcnt

uint16_t MdtAmtReadOut::m_wcnt
private

Definition at line 28 of file MdtAmtReadOut.h.

◆ m_width

uint16_t MdtAmtReadOut::m_width
private

Definition at line 35 of file MdtAmtReadOut.h.

◆ m_word

uint32_t MdtReadOut::m_word
protectedinherited

Definition at line 38 of file MdtReadOut.h.

◆ m_wordHeader

uint16_t MdtAmtReadOut::m_wordHeader
private

Definition at line 20 of file MdtAmtReadOut.h.

◆ s_BOTvalue1

uint16_t MdtAmtReadOut::s_BOTvalue1 = 0xa
staticconstexprprivate

Definition at line 51 of file MdtAmtReadOut.h.

◆ s_BOTvalue2

uint16_t MdtAmtReadOut::s_BOTvalue2 = 0xb
staticconstexprprivate

Definition at line 52 of file MdtAmtReadOut.h.

◆ s_EOTvalue

uint16_t MdtAmtReadOut::s_EOTvalue = 0xc
staticconstexprprivate

Definition at line 55 of file MdtAmtReadOut.h.

◆ s_headerBits

uint16_t MdtAmtReadOut::s_headerBits = 0xf
staticconstexprprivate

Definition at line 47 of file MdtAmtReadOut.h.

◆ s_headerPos

uint16_t MdtAmtReadOut::s_headerPos = 28
staticconstexprprivate

Definition at line 46 of file MdtAmtReadOut.h.

◆ s_TCMvalue

uint16_t MdtAmtReadOut::s_TCMvalue = 0x4
staticconstexprprivate

Definition at line 64 of file MdtAmtReadOut.h.

◆ s_TESvalue

uint16_t MdtAmtReadOut::s_TESvalue = 0x6
staticconstexprprivate

Definition at line 67 of file MdtAmtReadOut.h.

◆ s_TMCvalue

uint16_t MdtAmtReadOut::s_TMCvalue = 0x2
staticconstexprprivate

Definition at line 58 of file MdtAmtReadOut.h.

◆ s_TSMvalue

uint16_t MdtAmtReadOut::s_TSMvalue = 0x3
staticconstexprprivate

Definition at line 61 of file MdtAmtReadOut.h.

◆ s_TWCvalue

uint16_t MdtAmtReadOut::s_TWCvalue = 0x8
staticconstexprprivate

Definition at line 70 of file MdtAmtReadOut.h.


The documentation for this class was generated from the following files: