CMS 3D CMS Logo

L1GtfeWord.cc
Go to the documentation of this file.
1 
15 // this class header
17 
18 // system include files
19 #include <iomanip>
20 
21 // user include files
22 
25 
26 // constructors
27 
28 // empty constructor, all members set to zero;
30  : m_boardId(0),
31  m_recordLength1(0),
32  m_recordLength(0),
33  m_bxNr(0),
34  m_setupVersion(0),
35  m_activeBoards(0),
36  m_altNrBxBoard(0),
37  m_totalTriggerNr(0) {
38  // empty
39 }
40 
41 // constructor from unpacked values;
43  cms_uint16_t recordLength1Value,
44  cms_uint16_t recordLengthValue,
45  cms_uint16_t bxNrValue,
46  cms_uint32_t setupVersionValue,
47  cms_uint16_t activeBoardsValue,
48  cms_uint16_t altNrBxBoardValue,
49  cms_uint32_t totalTriggerNrValue)
50  : m_boardId(boardIdValue),
51  m_recordLength1(recordLength1Value),
52  m_recordLength(recordLengthValue),
53  m_bxNr(bxNrValue),
54  m_setupVersion(setupVersionValue),
55  m_activeBoards(activeBoardsValue),
56  m_altNrBxBoard(altNrBxBoardValue),
57  m_totalTriggerNr(totalTriggerNrValue)
58 
59 {
60  // empty
61 }
62 
63 // destructor
65  // empty now
66 }
67 
68 // equal operator
70  if (m_boardId != result.m_boardId) {
71  return false;
72  }
73 
74  if (m_recordLength1 != result.m_recordLength1) {
75  return false;
76  }
77 
78  if (m_recordLength != result.m_recordLength) {
79  return false;
80  }
81 
82  if (m_bxNr != result.m_bxNr) {
83  return false;
84  }
85 
86  if (m_setupVersion != result.m_setupVersion) {
87  return false;
88  }
89 
90  if (m_activeBoards != result.m_activeBoards) {
91  return false;
92  }
93 
94  if (m_altNrBxBoard != result.m_altNrBxBoard) {
95  return false;
96  }
97 
98  if (m_totalTriggerNr != result.m_totalTriggerNr) {
99  return false;
100  }
101 
102  // all members identical
103  return true;
104 }
105 
106 // unequal operator
107 bool L1GtfeWord::operator!=(const L1GtfeWord& result) const { return !(result == *this); }
108 
109 // methods
110 
111 // set the BoardId value from a 64-bits word
112 void L1GtfeWord::setBoardId(const cms_uint64_t& word64) { m_boardId = (word64 & BoardIdMask) >> BoardIdShift; }
113 
114 // set the BoardId value in a 64-bits word, having the index iWord
115 // in the GTFE raw record
116 void L1GtfeWord::setBoardIdWord64(cms_uint64_t& word64, int iWord) {
117  if (iWord == BoardIdWord) {
118  word64 = word64 | (static_cast<cms_uint64_t>(m_boardId) << BoardIdShift);
119  }
120 }
121 
122 // set the RecordLength1 value from a 64-bits word
125 }
126 
127 // set the RecordLength1 value in a 64-bits word, having the index iWord
128 // in the GTFE raw record
130  if (iWord == RecordLength1Word) {
131  word64 = word64 | (static_cast<cms_uint64_t>(m_recordLength1) << RecordLength1Shift);
132  }
133 }
134 
135 // set the RecordLength value from a 64-bits word
138 }
139 
140 // set the RecordLength value in a 64-bits word, having the index iWord
141 // in the GTFE raw record
143  if (iWord == RecordLengthWord) {
144  word64 = word64 | (static_cast<cms_uint64_t>(m_recordLength) << RecordLengthShift);
145  }
146 }
147 
148 // set the BxNr value from a 64-bits word
149 void L1GtfeWord::setBxNr(const cms_uint64_t& word64) { m_bxNr = (word64 & BxNrMask) >> BxNrShift; }
150 
151 // set the BxNr value in a 64-bits word, having the index iWord
152 // in the GTFE raw record
153 void L1GtfeWord::setBxNrWord64(cms_uint64_t& word64, int iWord) {
154  if (iWord == BxNrWord) {
155  word64 = word64 | (static_cast<cms_uint64_t>(m_bxNr) << BxNrShift);
156  }
157 }
158 
159 // set the SetupVersion value from a 64-bits word
162 }
163 
164 // set the SetupVersion value in a 64-bits word, having the index iWord
165 // in the GTFE raw record
167  if (iWord == SetupVersionWord) {
168  word64 = word64 | (static_cast<cms_uint64_t>(m_setupVersion) << SetupVersionShift);
169  }
170 }
171 
172 // get / set BST flag: 0 or 1 - via setup version (no private member)
173 const int L1GtfeWord::bstFlag() const {
174  int bstFlagValue = 0;
175  bstFlagValue = static_cast<int>(m_setupVersion & BstFlagMask);
176 
177  return bstFlagValue;
178 }
179 
180 void L1GtfeWord::setBstFlag(const int bstFlagValue) {
181  m_setupVersion = m_setupVersion | (static_cast<cms_uint32_t>(bstFlagValue) & BstFlagMask);
182 }
183 
184 // set the ActiveBoards value from a 64-bits word
187 }
188 
189 // set the ActiveBoards value in a 64-bits word, having the index iWord
190 // in the GTFE raw record
192  if (iWord == ActiveBoardsWord) {
193  word64 = word64 | (static_cast<cms_uint64_t>(m_activeBoards) << ActiveBoardsShift);
194  }
195 }
196 
197 // set the ActiveBoards value in a 64-bits word, having the index iWord
198 // in the GTFE raw record from the value activeBoardsValue
199 void L1GtfeWord::setActiveBoardsWord64(cms_uint64_t& word64, int iWord, cms_int16_t activeBoardsValue) {
200  if (iWord == ActiveBoardsWord) {
201  word64 = word64 | (static_cast<cms_uint64_t>(activeBoardsValue) << ActiveBoardsShift);
202  }
203 }
204 
205 // set the AltNrBxBoard value from a 64-bits word
208 }
209 
210 // set the AltNrBxBoard value in a 64-bits word, having the index iWord
211 // in the GTFE raw record
213  if (iWord == AltNrBxBoardWord) {
214  word64 = word64 | (static_cast<cms_uint64_t>(m_altNrBxBoard) << AltNrBxBoardShift);
215  }
216 }
217 
218 // set the AltNrBxBoard value in a 64-bits word, having the index iWord
219 // in the GTFE raw record from the value altNrBxBoardValue
220 void L1GtfeWord::setAltNrBxBoardWord64(cms_uint64_t& word64, int iWord, cms_int16_t altNrBxBoardValue) {
221  if (iWord == AltNrBxBoardWord) {
222  word64 = word64 | (static_cast<cms_uint64_t>(altNrBxBoardValue) << AltNrBxBoardShift);
223  }
224 }
225 
226 // set the TotalTriggerNr value from a 64-bits word
229 }
230 
231 // set the TotalTriggerNr value in a 64-bits word, having the index iWord
232 // in the GTFE raw record
234  if (iWord == TotalTriggerNrWord) {
235  word64 = word64 | (static_cast<cms_uint64_t>(m_totalTriggerNr) << TotalTriggerNrShift);
236  }
237 }
238 
239 // reset the content of a L1GtfeWord
241  m_boardId = 0;
242  m_recordLength1 = 0;
243  m_recordLength = 0;
244  m_bxNr = 0;
245  m_setupVersion = 0;
246  //
247  m_activeBoards = 0;
248  m_altNrBxBoard = 0;
249  m_totalTriggerNr = 0;
250 }
251 
252 // pretty print the content of a L1GtfeWord
253 void L1GtfeWord::print(std::ostream& myCout) const {
254  myCout << "\n L1GtfeWord::print \n" << std::endl;
255 
256  myCout << " BoardId: " << std::hex << " hex: "
257  << " " << std::setw(2) << std::setfill('0') << m_boardId << std::setfill(' ') << std::dec
258  << " dec: " << m_boardId << std::endl;
259 
260  myCout << " BX for alternative 1: " << std::hex << " hex: "
261  << " " << std::setw(1) << m_recordLength1 << std::dec << " dec: " << m_recordLength1 << std::endl;
262 
263  myCout << " BX for alternative 0: " << std::hex << " hex: "
264  << " " << std::setw(1) << m_recordLength << std::dec << " dec: " << m_recordLength << std::endl;
265 
266  myCout << " BxNr: " << std::hex << " hex: "
267  << " " << std::setw(3) << std::setfill('0') << m_bxNr << std::setfill(' ') << std::dec
268  << " dec: " << m_bxNr << std::endl;
269 
270  myCout << " SetupVersion: " << std::hex << " hex: " << std::setw(8) << std::setfill('0') << m_setupVersion
271  << std::setfill(' ') << std::dec << " dec: " << m_setupVersion << std::endl;
272 
273  //
274 
275  myCout << " ActiveBoards: " << std::hex << " hex: "
276  << " " << std::setw(4) << std::setfill('0') << m_activeBoards << std::setfill(' ') << std::dec
277  << " dec: " << m_activeBoards << std::endl;
278 
279  myCout << " AltNrBxBoard: " << std::hex << " hex: "
280  << " " << std::setw(4) << std::setfill('0') << m_altNrBxBoard << std::setfill(' ') << std::dec
281  << " dec: " << m_altNrBxBoard << std::endl;
282 
283  myCout << " TotalTriggerNr: " << std::hex << " hex: " << std::setw(8) << std::setfill('0') << m_totalTriggerNr
284  << std::setfill(' ') << std::dec << " dec: " << m_totalTriggerNr << std::endl;
285 }
286 
287 // unpack GTFE
288 // gtfePtr pointer to the beginning of the GTFE block in the raw data
289 
290 void L1GtfeWord::unpack(const unsigned char* gtfePtr) {
291  LogDebug("L1GtfeWord") << "\nUnpacking GTFE block.\n" << std::endl;
292 
293  const cms_uint64_t* payload = reinterpret_cast<cms_uint64_t const*>(gtfePtr);
294 
303 
304  if (edm::isDebugEnabled()) {
305  for (int iWord = 0; iWord < BlockSize; ++iWord) {
306  LogTrace("L1GtfeWord") << std::setw(4) << iWord << " " << std::hex << std::setfill('0') << std::setw(16)
307  << payload[iWord] << std::dec << std::setfill(' ') << std::endl;
308  }
309  }
310 }
311 
312 // static class members
313 
314 // block description in the raw GT record
315 
316 // block size in 64bits words
317 const int L1GtfeWord::BlockSize = 2; // 2 x 64bits
318 
319 const int L1GtfeWord::BoardIdWord = 0;
320 const int L1GtfeWord::RecordLength1Word = 0;
321 const int L1GtfeWord::RecordLengthWord = 0;
322 const int L1GtfeWord::BxNrWord = 0;
323 const int L1GtfeWord::SetupVersionWord = 0;
324 
325 const cms_uint64_t L1GtfeWord::BoardIdMask = 0xFF00000000000000ULL;
326 const cms_uint64_t L1GtfeWord::RecordLength1Mask = 0x00F0000000000000ULL;
327 const cms_uint64_t L1GtfeWord::RecordLengthMask = 0x000F000000000000ULL;
328 const cms_uint64_t L1GtfeWord::BxNrMask = 0x00000FFF00000000ULL;
329 const cms_uint64_t L1GtfeWord::SetupVersionMask = 0x00000000FFFFFFFFULL;
330 
332 
333 // shifts could be computed from masks...
334 const int L1GtfeWord::BoardIdShift = 56;
335 const int L1GtfeWord::RecordLength1Shift = 52;
336 const int L1GtfeWord::RecordLengthShift = 48;
337 const int L1GtfeWord::BxNrShift = 32;
338 const int L1GtfeWord::SetupVersionShift = 0;
339 
340 //
341 const int L1GtfeWord::ActiveBoardsWord = 1;
342 const int L1GtfeWord::AltNrBxBoardWord = 1;
343 const int L1GtfeWord::TotalTriggerNrWord = 1;
344 
345 const cms_uint64_t L1GtfeWord::ActiveBoardsMask = 0xFFFF000000000000ULL;
346 const cms_uint64_t L1GtfeWord::AltNrBxBoardMask = 0x0000FFFF00000000ULL;
347 const cms_uint64_t L1GtfeWord::TotalTriggerNrMask = 0x00000000FFFFFFFFULL;
348 
349 const int L1GtfeWord::ActiveBoardsShift = 48;
350 const int L1GtfeWord::AltNrBxBoardShift = 32;
351 const int L1GtfeWord::TotalTriggerNrShift = 0;
short cms_int16_t
Definition: typedefs.h:12
bool isDebugEnabled()
virtual void print(std::ostream &myCout) const
pretty print the content of a L1GtfeWord
Definition: L1GtfeWord.cc:253
const int bstFlag() const
get / set BST flag: 0 or 1 - via setup version (no private member)
Definition: L1GtfeWord.cc:173
bool operator!=(const L1GtfeWord &) const
unequal operator
Definition: L1GtfeWord.cc:107
void setRecordLength1Word64(cms_uint64_t &word64, int iWord)
Definition: L1GtfeWord.cc:129
void setBxNr(cms_uint16_t bxNrValue)
Definition: L1GtfeWord.h:95
static const cms_uint64_t TotalTriggerNrMask
Definition: L1GtfeWord.h:211
static const cms_uint64_t BoardIdMask
Definition: L1GtfeWord.h:189
static const int RecordLength1Shift
Definition: L1GtfeWord.h:199
static const int ActiveBoardsWord
Definition: L1GtfeWord.h:205
static const int BlockSize
Definition: L1GtfeWord.h:181
bool operator==(const L1GtfeWord &) const
equal operator
Definition: L1GtfeWord.cc:69
void setActiveBoardsWord64(cms_uint64_t &word64, int iWord)
Definition: L1GtfeWord.cc:191
void setRecordLength(cms_uint16_t recordLengthValue)
Definition: L1GtfeWord.h:84
static const cms_uint64_t SetupVersionMask
Definition: L1GtfeWord.h:193
cms_uint16_t m_recordLength
record length for alternative 0
Definition: L1GtfeWord.h:225
void setSetupVersionWord64(cms_uint64_t &word64, int iWord)
Definition: L1GtfeWord.cc:166
#define LogTrace(id)
cms_uint16_t m_boardId
board identifier
Definition: L1GtfeWord.h:219
void setAltNrBxBoard(cms_uint16_t altNrBxBoardValue)
Definition: L1GtfeWord.h:136
L1GtfeWord()
constructors
Definition: L1GtfeWord.cc:29
void setTotalTriggerNr(cms_uint32_t totalTriggerNrValue)
Definition: L1GtfeWord.h:151
virtual void reset()
reset the content of a L1GtfeWord
Definition: L1GtfeWord.cc:240
static const cms_uint64_t RecordLength1Mask
Definition: L1GtfeWord.h:190
static const cms_uint64_t RecordLengthMask
Definition: L1GtfeWord.h:191
static const int TotalTriggerNrWord
Definition: L1GtfeWord.h:207
static const cms_uint64_t AltNrBxBoardMask
Definition: L1GtfeWord.h:210
static const int SetupVersionWord
Definition: L1GtfeWord.h:187
unsigned short cms_uint16_t
Definition: typedefs.h:13
static const int SetupVersionShift
Definition: L1GtfeWord.h:202
void setRecordLength1(cms_uint16_t recordLengthValue)
Definition: L1GtfeWord.h:73
void setBoardIdWord64(cms_uint64_t &word64, int iWord)
Definition: L1GtfeWord.cc:116
static const int RecordLengthShift
Definition: L1GtfeWord.h:200
unsigned int cms_uint32_t
Definition: typedefs.h:15
cms_uint16_t m_activeBoards
active boards contributing to EVM respectively DAQ record
Definition: L1GtfeWord.h:232
void setBoardId(cms_uint16_t boardIdValue)
set BoardId from a BoardId value
Definition: L1GtfeWord.h:61
static const int TotalTriggerNrShift
Definition: L1GtfeWord.h:215
static const int RecordLength1Word
Definition: L1GtfeWord.h:184
static const int ActiveBoardsShift
Definition: L1GtfeWord.h:213
void setAltNrBxBoardWord64(cms_uint64_t &word64, int iWord)
Definition: L1GtfeWord.cc:212
void setActiveBoards(cms_uint16_t activeBoardsValue)
Definition: L1GtfeWord.h:121
static const cms_uint64_t ActiveBoardsMask
Definition: L1GtfeWord.h:209
cms_uint16_t m_bxNr
bunch cross number as counted in the GTFE board
Definition: L1GtfeWord.h:228
static const cms_uint64_t BxNrMask
Definition: L1GtfeWord.h:192
static const int RecordLengthWord
Definition: L1GtfeWord.h:185
static const int BxNrShift
Definition: L1GtfeWord.h:201
cms_uint16_t m_altNrBxBoard
Definition: L1GtfeWord.h:238
void setBxNrWord64(cms_uint64_t &word64, int iWord)
Definition: L1GtfeWord.cc:153
static const int BoardIdWord
Definition: L1GtfeWord.h:183
unsigned long long cms_uint64_t
Definition: typedefs.h:17
void setTotalTriggerNrWord64(cms_uint64_t &word64, int iWord)
Definition: L1GtfeWord.cc:233
static const int AltNrBxBoardShift
Definition: L1GtfeWord.h:214
cms_uint32_t m_totalTriggerNr
total number of L1A sent since start of run
Definition: L1GtfeWord.h:241
cms_uint32_t m_setupVersion
Definition: L1GtfeWord.h:229
void setSetupVersion(cms_uint32_t setupVersionValue)
Definition: L1GtfeWord.h:106
static const int BxNrWord
Definition: L1GtfeWord.h:186
static const int BoardIdShift
Definition: L1GtfeWord.h:198
void setBstFlag(const int)
Definition: L1GtfeWord.cc:180
static const int AltNrBxBoardWord
Definition: L1GtfeWord.h:206
cms_uint16_t m_recordLength1
record length for alternative 1
Definition: L1GtfeWord.h:222
virtual void unpack(const unsigned char *gtfePtr)
Definition: L1GtfeWord.cc:290
void setRecordLengthWord64(cms_uint64_t &word64, int iWord)
Definition: L1GtfeWord.cc:142
static const cms_uint32_t BstFlagMask
Definition: L1GtfeWord.h:195
virtual ~L1GtfeWord()
destructor
Definition: L1GtfeWord.cc:64
#define LogDebug(id)