ATLAS Offline Software
Loading...
Searching...
No Matches
MdtAmtReadOut.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef MUONBYTESTREAM_MDTAMTREADOUT_H
6#define MUONBYTESTREAM_MDTAMTREADOUT_H
7
8#include <stdint.h>
9
10#include "MdtReadOut.h"
11
12// Decoding methods for MDT Amt raw data words
13// S. Rosati Feb 2003
14
15class MdtAmtReadOut : public MdtReadOut {
16private:
17 // Raw data word
18 uint32_t m_dataWord;
19 // Data word header
20 uint16_t m_wordHeader;
21
22 // Header info: event counter, bunch crossing ID and tdc number
23 uint16_t m_tdcId;
24 uint16_t m_ecnt;
25 uint16_t m_bcId;
26
27 // Footer info: words counter
28 uint16_t m_wcnt;
29
30 // Data info:
31 uint16_t m_jt;
32 uint16_t m_channel;
33 uint16_t m_coarse;
34 uint16_t m_fine;
35 uint16_t m_width;
37 uint16_t m_errstatus;
38
39 uint32_t m_masked;
41
42 // Define the data structure and the word header values
43
44 // Word header Position and values
45 // The word header occupies the 4 highest bits of each TDC data word
46 static constexpr uint16_t s_headerPos = 28;
47 static constexpr uint16_t s_headerBits = 0xf;
48
49 // Beginning of TDC: two possible header values
50 // for channels 00-15 and 16-17 respectively
51 static constexpr uint16_t s_BOTvalue1 = 0xa;
52 static constexpr uint16_t s_BOTvalue2 = 0xb;
53
54 // End of TDC
55 static constexpr uint16_t s_EOTvalue = 0xc;
56
57 // TDC single measurement
58 static constexpr uint16_t s_TMCvalue = 0x2;
59
60 // TDC single measurement
61 static constexpr uint16_t s_TSMvalue = 0x3;
62
63 // TDC combined measurement
64 static constexpr uint16_t s_TCMvalue = 0x4;
65
66 // TDC error status
67 static constexpr uint16_t s_TESvalue = 0x6;
68
69 // add the CSM trailer word count for operation with TDC trailer suppression
70 static constexpr uint16_t s_TWCvalue = 0x8;
71
72public:
73 // Constructor and destructor
75 ~MdtAmtReadOut() = default;
76
77 // Methods for decoding and encoding dataWords
78 void decodeWord(uint32_t dataWord);
79 void encodeWord(uint16_t headerVal);
80
81 // Methods to identify the word type
82 // Beginning of TDC
83 bool is_BOT() { return ((m_wordHeader == s_BOTvalue1) || (m_wordHeader == s_BOTvalue2)); };
84 // End of TDC
85 bool is_EOT() { return (m_wordHeader == s_EOTvalue); };
86 // TDC masked channels
87 bool is_TMC() { return (m_wordHeader == s_TMCvalue); };
88 // TDC single measurement
89 bool is_TSM() { return (m_wordHeader == s_TSMvalue); };
90 // TDC combined measurement
91 bool is_TCM() { return (m_wordHeader == s_TCMvalue); };
92 // TDC error status
93 bool is_TES() { return (m_wordHeader == s_TESvalue); };
94
95 // trailer word count (actually a CSM word)
96 bool is_TWC() { return (m_wordHeader == s_TWCvalue); };
97
98 // Methods to retrieve the decoded word content
99 uint16_t tdcId() { return m_tdcId; }
100 uint16_t ecnt() { return m_ecnt; }
101 uint16_t bcId() { return m_bcId; }
102
103 uint16_t jt() { return m_jt; }
104 uint16_t channel() { return m_channel; }
105 uint16_t coarse() { return m_coarse; }
106 uint16_t fine() { return m_fine; }
107 uint16_t width() { return m_width; }
108 bool errflag() { return m_errflag; }
109 uint16_t errstatus() { return m_errstatus; }
110 uint32_t masked() { return m_masked; }
111 bool isLeading() { return m_leading; }
112
113 // Methods to encode data in 32 bits words
114
115 uint32_t makeBOT(uint16_t tdcId, uint16_t ecnt, uint16_t bcid);
116 uint32_t makeEOT(uint16_t jt, uint16_t ecnt, uint16_t wcnt);
117 uint32_t makeTSM(uint16_t jt, uint16_t channel, bool leading, bool errflag, uint16_t coarse, uint16_t fine);
118
119 uint32_t makeTCM(uint16_t jt, uint16_t channel, uint16_t width, uint16_t coarse, uint16_t fine);
120
121 uint32_t makeTMC(uint16_t jt, uint32_t masked);
122
123private:
124 void setZero();
125};
126
127#endif // MUONBYTESTREAM_MDTAMTREADOUT_H
const double width
uint16_t ecnt()
static constexpr uint16_t s_EOTvalue
static constexpr uint16_t s_headerPos
uint16_t m_tdcId
~MdtAmtReadOut()=default
uint32_t makeTSM(uint16_t jt, uint16_t channel, bool leading, bool errflag, uint16_t coarse, uint16_t fine)
uint16_t m_errstatus
static constexpr uint16_t s_TMCvalue
uint32_t m_dataWord
uint16_t m_bcId
uint32_t makeTMC(uint16_t jt, uint32_t masked)
uint16_t m_fine
uint16_t coarse()
uint16_t tdcId()
void encodeWord(uint16_t headerVal)
static constexpr uint16_t s_headerBits
uint16_t bcId()
static constexpr uint16_t s_TCMvalue
static constexpr uint16_t s_TESvalue
uint16_t jt()
uint16_t channel()
uint32_t m_masked
static constexpr uint16_t s_TSMvalue
uint32_t masked()
uint16_t width()
uint32_t makeEOT(uint16_t jt, uint16_t ecnt, uint16_t wcnt)
uint32_t makeTCM(uint16_t jt, uint16_t channel, uint16_t width, uint16_t coarse, uint16_t fine)
static constexpr uint16_t s_BOTvalue1
void decodeWord(uint32_t dataWord)
static constexpr uint16_t s_TWCvalue
uint16_t m_width
uint16_t m_wordHeader
uint16_t m_ecnt
uint16_t errstatus()
uint32_t makeBOT(uint16_t tdcId, uint16_t ecnt, uint16_t bcid)
uint16_t m_channel
uint16_t m_coarse
static constexpr uint16_t s_BOTvalue2
uint16_t fine()
uint16_t m_wcnt