ATLAS Offline Software
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 
15 class MdtAmtReadOut : public MdtReadOut {
16 private:
17  // Raw data word
19  // Data word header
21 
22  // Header info: event counter, bunch crossing ID and tdc number
26 
27  // Footer info: words counter
29 
30  // Data info:
36  bool m_errflag;
38 
40  bool m_leading;
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 
72 public:
73  // Constructor and destructor
74  MdtAmtReadOut();
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; }
110  uint32_t masked() { return m_masked; }
111  bool isLeading() { return m_leading; }
112 
113  // Methods to encode data in 32 bits words
114 
118 
120 
122 
123 private:
124  void setZero();
125 };
126 
127 #endif // MUONBYTESTREAM_MDTAMTREADOUT_H
MdtAmtReadOut::makeEOT
uint32_t makeEOT(uint16_t jt, uint16_t ecnt, uint16_t wcnt)
Definition: MdtAmtReadOut.cxx:112
MdtAmtReadOut::m_errstatus
uint16_t m_errstatus
Definition: MdtAmtReadOut.h:37
MdtAmtReadOut::fine
uint16_t fine()
Definition: MdtAmtReadOut.h:106
MdtAmtReadOut::is_TES
bool is_TES()
Definition: MdtAmtReadOut.h:93
MdtAmtReadOut::m_tdcId
uint16_t m_tdcId
Definition: MdtAmtReadOut.h:23
MdtAmtReadOut::s_TSMvalue
static constexpr uint16_t s_TSMvalue
Definition: MdtAmtReadOut.h:61
MdtAmtReadOut::s_BOTvalue1
static constexpr uint16_t s_BOTvalue1
Definition: MdtAmtReadOut.h:51
MdtAmtReadOut::makeTCM
uint32_t makeTCM(uint16_t jt, uint16_t channel, uint16_t width, uint16_t coarse, uint16_t fine)
Definition: MdtAmtReadOut.cxx:142
MdtAmtReadOut::channel
uint16_t channel()
Definition: MdtAmtReadOut.h:104
MdtAmtReadOut::s_TCMvalue
static constexpr uint16_t s_TCMvalue
Definition: MdtAmtReadOut.h:64
MdtAmtReadOut::m_errflag
bool m_errflag
Definition: MdtAmtReadOut.h:36
MdtAmtReadOut::makeBOT
uint32_t makeBOT(uint16_t tdcId, uint16_t ecnt, uint16_t bcid)
Definition: MdtAmtReadOut.cxx:92
MdtAmtReadOut
Definition: MdtAmtReadOut.h:15
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
MdtAmtReadOut::makeTMC
uint32_t makeTMC(uint16_t jt, uint32_t masked)
Definition: MdtAmtReadOut.cxx:156
MdtAmtReadOut::m_bcId
uint16_t m_bcId
Definition: MdtAmtReadOut.h:25
MdtReadOut
Definition: MdtReadOut.h:14
MdtAmtReadOut::setZero
void setZero()
Definition: MdtAmtReadOut.cxx:74
MdtAmtReadOut::is_TCM
bool is_TCM()
Definition: MdtAmtReadOut.h:91
MdtAmtReadOut::s_EOTvalue
static constexpr uint16_t s_EOTvalue
Definition: MdtAmtReadOut.h:55
MdtAmtReadOut::m_wcnt
uint16_t m_wcnt
Definition: MdtAmtReadOut.h:28
MdtAmtReadOut::m_masked
uint32_t m_masked
Definition: MdtAmtReadOut.h:39
MdtAmtReadOut::m_jt
uint16_t m_jt
Definition: MdtAmtReadOut.h:31
MdtAmtReadOut::~MdtAmtReadOut
~MdtAmtReadOut()=default
MdtAmtReadOut::s_TMCvalue
static constexpr uint16_t s_TMCvalue
Definition: MdtAmtReadOut.h:58
MdtAmtReadOut::m_coarse
uint16_t m_coarse
Definition: MdtAmtReadOut.h:33
MdtAmtReadOut::s_BOTvalue2
static constexpr uint16_t s_BOTvalue2
Definition: MdtAmtReadOut.h:52
MdtAmtReadOut::encodeWord
void encodeWord(uint16_t headerVal)
MdtAmtReadOut::tdcId
uint16_t tdcId()
Definition: MdtAmtReadOut.h:99
MdtAmtReadOut::m_fine
uint16_t m_fine
Definition: MdtAmtReadOut.h:34
MdtAmtReadOut::m_wordHeader
uint16_t m_wordHeader
Definition: MdtAmtReadOut.h:20
MdtAmtReadOut::errstatus
uint16_t errstatus()
Definition: MdtAmtReadOut.h:109
MdtAmtReadOut::m_ecnt
uint16_t m_ecnt
Definition: MdtAmtReadOut.h:24
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:93
MdtAmtReadOut::jt
uint16_t jt()
Definition: MdtAmtReadOut.h:103
MdtReadOut.h
MdtAmtReadOut::s_TWCvalue
static constexpr uint16_t s_TWCvalue
Definition: MdtAmtReadOut.h:70
MdtAmtReadOut::m_leading
bool m_leading
Definition: MdtAmtReadOut.h:40
MdtAmtReadOut::s_TESvalue
static constexpr uint16_t s_TESvalue
Definition: MdtAmtReadOut.h:67
MdtAmtReadOut::m_width
uint16_t m_width
Definition: MdtAmtReadOut.h:35
MdtAmtReadOut::makeTSM
uint32_t makeTSM(uint16_t jt, uint16_t channel, bool leading, bool errflag, uint16_t coarse, uint16_t fine)
Definition: MdtAmtReadOut.cxx:121
MdtAmtReadOut::decodeWord
void decodeWord(uint32_t dataWord)
Definition: MdtAmtReadOut.cxx:29
MdtAmtReadOut::m_dataWord
uint32_t m_dataWord
Definition: MdtAmtReadOut.h:18
xAOD::bcid
setEventNumber setTimeStamp bcid
Definition: EventInfo_v1.cxx:133
MdtAmtReadOut::s_headerPos
static constexpr uint16_t s_headerPos
Definition: MdtAmtReadOut.h:46
MdtAmtReadOut::masked
uint32_t masked()
Definition: MdtAmtReadOut.h:110
MdtAmtReadOut::is_TMC
bool is_TMC()
Definition: MdtAmtReadOut.h:87
MdtAmtReadOut::is_TWC
bool is_TWC()
Definition: MdtAmtReadOut.h:96
MdtAmtReadOut::coarse
uint16_t coarse()
Definition: MdtAmtReadOut.h:105
MdtAmtReadOut::errflag
bool errflag()
Definition: MdtAmtReadOut.h:108
MdtAmtReadOut::MdtAmtReadOut
MdtAmtReadOut()
Definition: MdtAmtReadOut.cxx:12
MdtAmtReadOut::ecnt
uint16_t ecnt()
Definition: MdtAmtReadOut.h:100
MdtAmtReadOut::s_headerBits
static constexpr uint16_t s_headerBits
Definition: MdtAmtReadOut.h:47
MdtAmtReadOut::is_EOT
bool is_EOT()
Definition: MdtAmtReadOut.h:85
MdtAmtReadOut::is_TSM
bool is_TSM()
Definition: MdtAmtReadOut.h:89
MdtAmtReadOut::isLeading
bool isLeading()
Definition: MdtAmtReadOut.h:111
MdtAmtReadOut::is_BOT
bool is_BOT()
Definition: MdtAmtReadOut.h:83
MdtAmtReadOut::bcId
uint16_t bcId()
Definition: MdtAmtReadOut.h:101
MdtAmtReadOut::width
uint16_t width()
Definition: MdtAmtReadOut.h:107
MdtAmtReadOut::m_channel
uint16_t m_channel
Definition: MdtAmtReadOut.h:32