ATLAS Offline Software
MdtAmtReadOut.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "MdtAmtReadOut.h"
6 
7 //#include "GaudiKernel/ISvcLocator.h"
8 //#include "GaudiKernel/Bootstrap.h"
9 //#include "GaudiKernel/MsgStream.h"
10 //#include "GaudiKernel/IMessageSvc.h"
11 
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) {}
28 
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  {
38  m_leading = (bool)getBits(getBitsWord(18, 18));
39  m_jt = getBits(getBitsWord(25, 24));
40  m_channel = getBits(getBitsWord(23, 19));
41  m_errflag = getBits(getBitsWord(17, 17));
42  m_coarse = getBits(getBitsWord(16, 5));
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));
49  m_coarse = getBits(getBitsWord(10, 5));
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));
64  m_masked = getBits(getBitsWord(23, 0));
65  } else if (is_TES()) // TDC error status
66  {
67  m_jt = getBits(getBitsWord(25, 24));
68  m_errflag = getBits(getBitsWord(6, 0));
69  }
70  // special decoding of the CSM trailer word count - nothing to do here
71  else if (is_TWC()) {}
72 }
73 
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 }
89 
90 // Encoding methods
91 // Beginning of TDC
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 }
110 
111 // End of TDC
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 }
119 
120 // Make a TDC single measurement word
121 uint32_t MdtAmtReadOut::makeTSM(uint16_t jt, uint16_t channel, bool leading, bool errflag, uint16_t coarse, uint16_t fine) {
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 }
140 
141 // Make a TDC combined measurement word
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 }
155 
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 }
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
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
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
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:24
MdtReadOut::m_word
uint32_t m_word
Definition: MdtReadOut.h:38
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
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::getBits
uint32_t getBits(std::pair< uint32_t, uint16_t > wordbstop) const
Definition: MdtReadOut.h:27
plotBeamSpotCompare.x2
x2
Definition: plotBeamSpotCompare.py:218
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::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::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::m_ecnt
uint16_t m_ecnt
Definition: MdtAmtReadOut.h:24
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
dqt_zlumi_pandas.err
err
Definition: dqt_zlumi_pandas.py:182
MdtAmtReadOut.h
MdtAmtReadOut::jt
uint16_t jt()
Definition: MdtAmtReadOut.h:103
MdtAmtReadOut::m_leading
bool m_leading
Definition: MdtAmtReadOut.h:40
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
MdtReadOut::setBits
static uint32_t setBits(uint16_t nData, const uint16_t *inputData, const uint16_t *inputPos)
Definition: MdtReadOut.cxx:14
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
Base_Fragment.width
width
Definition: Sherpa_i/share/common/Base_Fragment.py:59
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
xAOD::bool
setBGCode setTAP setLVL2ErrorBits bool
Definition: TrigDecision_v1.cxx:60
MdtAmtReadOut::is_BOT
bool is_BOT()
Definition: MdtAmtReadOut.h:83
MdtReadOut::getBitsWord
constexpr std::pair< uint32_t, uint16_t > getBitsWord(const uint16_t bstart, const uint16_t bstop)
Definition: MdtReadOut.h:20
MdtAmtReadOut::width
uint16_t width()
Definition: MdtAmtReadOut.h:107
MdtAmtReadOut::m_channel
uint16_t m_channel
Definition: MdtAmtReadOut.h:32