CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1TcsWord.cc
Go to the documentation of this file.
1 
17 // this class header
19 
20 // system include files
21 #include <iomanip>
22 
23 // user include files
26 
27 // forward declarations
28 
29 // constructors
30 
31 // empty constructor, all members set to zero;
33 {
34 
35  m_boardId = 0;
36  m_bxNr = 0;
37  m_daqNr = 0;
38  m_triggerType = 0;
39  m_status = 0;
41  m_partRunNr = 0;
43  m_partTrigNr = 0;
44  m_eventNr = 0;
45  m_orbitNr = 0;
46 
47 }
48 
49 // constructor from unpacked values;
51  cms_uint16_t boardIdValue,
52  cms_uint16_t bxNrValue,
53  cms_uint16_t daqNrValue,
54  cms_uint16_t triggerTypeValue,
55  cms_uint16_t statusValue,
56  cms_uint16_t luminositySegmentNrValue,
57  cms_uint32_t partRunNrValue,
58  cms_uint32_t assignedPartitionsValue,
59  cms_uint32_t partTrigNrValue,
60  cms_uint32_t eventNrValue,
61  cms_uint64_t orbitNrValue )
62 {
63 
64  m_boardId = boardIdValue;
65  m_bxNr = bxNrValue;
66  m_daqNr = daqNrValue;
67  m_triggerType = triggerTypeValue;
68  m_status = statusValue;
69  m_luminositySegmentNr = luminositySegmentNrValue;
70  m_partRunNr = partRunNrValue;
71  m_assignedPartitions = assignedPartitionsValue;
72  m_partTrigNr = partTrigNrValue;
73  m_eventNr = eventNrValue;
74  m_orbitNr = orbitNrValue;
75 
76 }
77 
78 // destructor
80 {
81 
82  // empty
83 
84 }
85 
86 // equal operator
88 {
89 
90  if (m_boardId != result.m_boardId) {
91  return false;
92  }
93 
94  if (m_bxNr != result.m_bxNr) {
95  return false;
96  }
97 
98  if (m_daqNr != result.m_daqNr) {
99  return false;
100  }
101 
102  if (m_triggerType != result.m_triggerType) {
103  return false;
104  }
105 
106  if (m_status != result.m_status) {
107  return false;
108  }
109 
111  return false;
112  }
113 
114  if (m_partRunNr != result.m_partRunNr) {
115  return false;
116  }
117 
119  return false;
120  }
121 
122  if (m_partTrigNr != result.m_partTrigNr) {
123  return false;
124  }
125 
126  if (m_eventNr != result.m_eventNr) {
127  return false;
128  }
129 
130  if (m_orbitNr != result.m_orbitNr) {
131  return false;
132  }
133 
134  // all members identical
135  return true;
136 
137 }
138 
139 // unequal operator
141 {
142 
143  return !( result == *this);
144 
145 }
146 
147 // methods
148 
149 // set the BoardId value from a 64-bits word
151 {
152  m_boardId = (word64 & BoardIdMask) >> BoardIdShift;
153 
154 }
155 
156 // set the BoardId value in a 64-bits word, having the index iWord
157 // in the GTFE raw record
159 {
160 
161  if (iWord == BoardIdWord) {
162  word64 = word64 | (static_cast<cms_uint64_t> (m_boardId) << BoardIdShift);
163  }
164 
165 }
166 
167 
168 // set the BxNr value from a 64-bits word
169 void L1TcsWord::setBxNr(const cms_uint64_t& word64)
170 {
171 
172  m_bxNr = (word64 & BxNrMask) >> BxNrShift;
173 
174 }
175 
176 // set the BxNr value in a 64-bits word, having the index iWord
177 // in the GTFE EVM raw record
178 void L1TcsWord::setBxNrWord64(cms_uint64_t& word64, int iWord)
179 {
180 
181  if (iWord == BxNrWord) {
182  word64 = word64 | (static_cast<cms_uint64_t> (m_bxNr) << BxNrShift);
183  }
184 
185 }
186 
187 
188 
189 // set the DaqNr value from a 64-bits word
191 {
192 
193  m_daqNr = (word64 & DaqNrMask) >> DaqNrShift;
194 
195 }
196 
197 // set the DaqNr value in a 64-bits word, having the index iWord
198 // in the GTFE EVM raw record
199 void L1TcsWord::setDaqNrWord64(cms_uint64_t& word64, int iWord)
200 {
201 
202  if (iWord == DaqNrWord) {
203  word64 = word64 | (static_cast<cms_uint64_t> (m_daqNr) << DaqNrShift);
204  }
205 
206 }
207 
208 
209 // set the TriggerType value from a 64-bits word
211 {
212 
214 
215 }
216 
217 // set the TriggerType value in a 64-bits word, having the index iWord
218 // in the GTFE EVM raw record
220 {
221 
222  if (iWord == TriggerTypeWord) {
223  word64 = word64 |
224  (static_cast<cms_uint64_t> (m_triggerType) << TriggerTypeShift);
225  }
226 
227 }
228 
229 
230 // set the Status value from a 64-bits word
232 {
233 
234  m_status = (word64 & StatusMask) >> StatusShift;
235 
236 }
237 
238 // set the Status value in a 64-bits word, having the index iWord
239 // in the GTFE EVM raw record
240 void L1TcsWord::setStatusWord64(cms_uint64_t& word64, int iWord)
241 {
242 
243  if (iWord == StatusWord) {
244  word64 = word64 | (static_cast<cms_uint64_t> (m_status) << StatusShift);
245  }
246 
247 }
248 
249 
250 
251 // set the luminosity segment number value from a 64-bits word
253 {
254 
257 
258 }
259 
260 // set the luminosity segment number value in a 64-bits word, having the index iWord
261 // in the GTFE EVM raw record
263 {
264 
265  if (iWord == LuminositySegmentNrWord) {
266  word64 = word64 |
268  }
269 
270 }
271 
272 
273 
274 // set the PartRunNr value from a 64-bits word
276 {
277 
278  m_partRunNr = (word64 & PartRunNrMask) >> PartRunNrShift;
279 
280 }
281 
282 // set the PartRunNr value in a 64-bits word, having the index iWord
283 // in the GTFE EVM raw record
285 {
286 
287  if (iWord == PartRunNrWord) {
288  word64 = word64 |
289  (static_cast<cms_uint64_t> (m_partRunNr) << PartRunNrShift);
290  }
291 
292 }
293 
294 
295 
296 // set the AssignedPartitions value from a 64-bits word
298 {
299 
302 
303 }
304 
305 // set the AssignedPartitions value in a 64-bits word, having the index iWord
306 // in the GTFE EVM raw record
308 {
309 
310  if (iWord == AssignedPartitionsWord) {
311  word64 = word64 |
312  (static_cast<cms_uint64_t> (m_assignedPartitions)
314  }
315 
316 }
317 
318 
319 
320 // set the PartTrigNr value from a 64-bits word
322 {
323 
325 
326 }
327 
328 // set the PartTrigNr value in a 64-bits word, having the index iWord
329 // in the GTFE EVM raw record
331 {
332 
333  if (iWord == PartTrigNrWord) {
334  word64 = word64 |
335  (static_cast<cms_uint64_t> (m_partTrigNr) << PartTrigNrShift);
336  }
337 
338 }
339 
340 
341 
342 // set the EventNr value from a 64-bits word
344 {
345 
346  m_eventNr = (word64 & EventNrMask) >> EventNrShift;
347 
348 }
349 
350 // set the EventNr value in a 64-bits word, having the index iWord
351 // in the GTFE EVM raw record
353 {
354 
355  if (iWord == EventNrWord) {
356  word64 = word64 |
357  (static_cast<cms_uint64_t> (m_eventNr) << EventNrShift);
358  }
359 
360 }
361 
362 
363 
364 // set the OrbitNr value from a 64-bits word
366 {
367 
368  m_orbitNr = (word64 & OrbitNrMask) >> OrbitNrShift;
369 
370 }
371 
372 // set the OrbitNr value in a 64-bits word, having the index iWord
373 // in the GTFE EVM raw record
375 {
376 
377  if (iWord == OrbitNrWord) {
378  word64 = word64 | (static_cast<cms_uint64_t> (m_orbitNr) << OrbitNrShift);
379  }
380 
381 }
382 
383 
384 // reset the content of a L1TcsWord
386 {
387 
388  m_boardId = 0;
389  m_bxNr = 0;
390  m_daqNr = 0;
391  m_triggerType = 0;
392  m_status = 0;
394  m_partRunNr = 0;
396  m_partTrigNr = 0;
397  m_eventNr = 0;
398  m_orbitNr = 0;
399 
400 
401 }
402 
403 
404 // pretty print
405 void L1TcsWord::print(std::ostream& myCout) const
406 {
407 
408  myCout << "\n L1TcsWord::print \n" << std::endl;
409 
410  int iWord = 0;
411 
412  myCout << "\n Word " << iWord << std::endl;
413 
414  myCout << " Board Id: "
415  << std::hex << " hex: " << " "<< std::setw(4) << std::setfill('0') << m_boardId
416  << std::setfill(' ')
417  << std::dec << " dec: " << m_boardId
418  << std::endl;
419 
420 
421  myCout << " BxNr: "
422  << std::hex << " hex: " << " " << std::setw(3) << std::setfill('0') << m_bxNr
423  << std::setfill(' ')
424  << std::dec << " dec: " << m_bxNr
425  << std::endl;
426 
427 
428  myCout << " DaqNr: "
429  << std::hex << " hex: " << " " << std::setw(1) << m_daqNr
430  << std::dec << " dec: " << m_daqNr
431  << std::endl;
432 
433  myCout << " TriggerType: "
434  << std::hex << " hex: " << " " << std::setw(1) << m_triggerType
435  << std::dec << " dec: " << m_triggerType
436  << std::endl;
437 
438  myCout << " Status: "
439  << std::hex << " hex: " << " " << std::setw(1) << m_status
440  << std::dec << " dec: " << m_status
441  << std::endl;
442 
443  myCout << " LuminositySegmentNr: "
444  << std::hex << " hex: " << " " << std::setw(4) << m_luminositySegmentNr
445  << std::dec << " dec: " << m_luminositySegmentNr
446  << std::endl;
447 
448 
449  iWord++;
450  myCout << "\n Word " << iWord << std::endl;
451 
452  myCout << " PartRunNr: "
453  << std::hex << " hex: " << " " << std::setw(8) << std::setfill('0') << m_partRunNr
454  << std::setfill(' ')
455  << std::dec << " dec: " << m_partRunNr
456  << std::endl;
457 
458  myCout << " AssignedPartitions: "
459  << std::hex << " hex: " << " " << std::setw(8) << std::setfill('0')
461  << std::setfill(' ')
462  << std::dec << " dec: " << m_assignedPartitions
463  << std::endl;
464 
465 
466  iWord++;
467  myCout << "\n Word " << iWord << std::endl;
468 
469  myCout << " PartTrigNr: "
470  << std::hex << " hex: " << " " << std::setw(8) << std::setfill('0') << m_partTrigNr
471  << std::setfill(' ')
472  << std::dec << " dec: " << m_partTrigNr
473  << std::endl;
474 
475 
476  myCout << " EventNr: "
477  << std::hex << " hex: " << " " << std::setw(8) << std::setfill('0') << m_eventNr
478  << std::setfill(' ')
479  << std::dec << " dec: " << m_eventNr
480  << std::endl;
481 
482  iWord++;
483  myCout << "\n Word " << iWord << std::endl;
484 
485  myCout << " OrbitNr: "
486  << std::hex << " hex: " << "" << std::setw(12) << std::setfill('0') << m_orbitNr
487  << std::setfill(' ')
488  << std::dec << " dec: " << m_orbitNr
489  << std::endl;
490 
491  iWord++;
492  myCout << "\n Word " << iWord << std::endl;
493 
494  myCout << " Empty word "
495  << std::endl;
496 
497 }
498 
499 
500 // unpack TCS
501 // tcsPtr pointer to the beginning of the TCS block in the raw data
502 void L1TcsWord::unpack(const unsigned char* tcsPtr)
503 {
504  LogDebug("L1GtTcsWord")
505  << "\nUnpacking TCS block.\n"
506  << std::endl;
507 
508  const cms_uint64_t* payload =
509  reinterpret_cast<cms_uint64_t*>(const_cast<unsigned char*>(tcsPtr));
510 
511  setBoardId(payload[BoardIdWord]);
512  setBxNr(payload[BxNrWord]);
513  setDaqNr(payload[DaqNrWord]);
515  setStatus(payload[StatusWord]);
517 
518  setPartRunNr(payload[PartRunNrWord]);
520 
521  setPartTrigNr(payload[PartTrigNrWord]);
522  setEventNr(payload[EventNrWord]);
523 
524  setOrbitNrFrom(payload[OrbitNrWord]);
525 
526  if ( edm::isDebugEnabled() ) {
527 
528  for (int iWord = 0; iWord < BlockSize; ++iWord) {
529  LogTrace("L1GtTcsWord")
530  << std::setw(4) << iWord << " "
531  << std::hex << std::setfill('0')
532  << std::setw(16) << payload[iWord]
533  << std::dec << std::setfill(' ')
534  << std::endl;
535  }
536 
537  }
538 
539 }
540 
541 // static class members
542 
543 // block description in the raw GT record
544 
545 // block size in 64bits words (BlockSize * 64 bits)
546 const int L1TcsWord::BlockSize = 5;
547 
548 // word 0
549 
550 // index of the word in the TCS block containig the variable
551 const int L1TcsWord::BoardIdWord = 0;
552 const int L1TcsWord::BxNrWord = 0;
553 const int L1TcsWord::DaqNrWord = 0;
554 const int L1TcsWord::TriggerTypeWord = 0;
555 const int L1TcsWord::StatusWord = 0;
557 
558 // mask to get the 64-bit-value from the corresponding word in the TCS block
559 const cms_uint64_t L1TcsWord::BoardIdMask = 0xFFFF000000000000ULL;
560 const cms_uint64_t L1TcsWord::BxNrMask = 0x00000FFF00000000ULL;
561 const cms_uint64_t L1TcsWord::DaqNrMask = 0x000000000F000000ULL;
562 const cms_uint64_t L1TcsWord::TriggerTypeMask = 0x0000000000F00000ULL;
563 const cms_uint64_t L1TcsWord::StatusMask = 0x00000000000F0000ULL;
564 const cms_uint64_t L1TcsWord::LuminositySegmentNrMask = 0x000000000000FFFFULL;
565 
566 // shift to the right to get the value from the "64-bit-value"
567 const int L1TcsWord::BoardIdShift = 48;
568 const int L1TcsWord::BxNrShift = 32;
569 const int L1TcsWord::DaqNrShift = 24;
570 const int L1TcsWord::TriggerTypeShift = 20;
571 const int L1TcsWord::StatusShift = 16;
573 
574 // word 1
575 
576 const int L1TcsWord::PartRunNrWord = 1;
578 
579 const cms_uint64_t L1TcsWord::PartRunNrMask = 0xFFFFFFFF00000000ULL;
580 const cms_uint64_t L1TcsWord::AssignedPartitionsMask = 0x00000000FFFFFFFFULL;
581 
582 const int L1TcsWord::PartRunNrShift = 32;
584 
585 // word 2
586 
587 const int L1TcsWord::PartTrigNrWord = 2;
588 const int L1TcsWord::EventNrWord = 2;
589 
590 const cms_uint64_t L1TcsWord::PartTrigNrMask = 0xFFFFFFFF00000000ULL;
591 const cms_uint64_t L1TcsWord::EventNrMask = 0x00000000FFFFFFFFULL;
592 
593 const int L1TcsWord::PartTrigNrShift = 32;
594 const int L1TcsWord::EventNrShift = 0;
595 
596 // word 3
597 
598 const int L1TcsWord::OrbitNrWord = 3;
599 
600 const cms_uint64_t L1TcsWord::OrbitNrMask = 0x0000FFFFFFFFFFFFULL;
601 
602 const int L1TcsWord::OrbitNrShift = 0;
603 
604 
605 // word 4
606 
607 // empty
608 
609 
610 
#define LogDebug(id)
cms_uint16_t m_triggerType
trigger type, identical with event type in CMS header (event type)
Definition: L1TcsWord.h:390
bool isDebugEnabled()
L1TcsWord()
constructors
Definition: L1TcsWord.cc:32
static const int OrbitNrWord
Definition: L1TcsWord.h:365
cms_uint32_t m_partRunNr
partition run number
Definition: L1TcsWord.h:401
void setBoardIdWord64(cms_uint64_t &word64, int iWord)
Definition: L1TcsWord.cc:158
static const int PartRunNrShift
Definition: L1TcsWord.h:349
void setBxNrWord64(cms_uint64_t &word64, int iWord)
Definition: L1TcsWord.cc:178
void reset()
reset the content of a L1TcsWord
Definition: L1TcsWord.cc:385
void setBxNr(const cms_uint16_t bxNrValue)
Definition: L1TcsWord.h:94
static const int OrbitNrShift
Definition: L1TcsWord.h:369
cms_uint32_t m_partTrigNr
Definition: L1TcsWord.h:412
void setAssignedPartitions(const cms_uint32_t assignedPartitionsValue)
Definition: L1TcsWord.h:213
cms_uint16_t m_bxNr
bunch cross number as counted in the TCS chip
Definition: L1TcsWord.h:384
static const int BxNrShift
Definition: L1TcsWord.h:335
void setOrbitNrFrom(const cms_uint64_t &word64)
set the OrbitNr value from a 64-bits word
Definition: L1TcsWord.cc:365
static const cms_uint64_t OrbitNrMask
Definition: L1TcsWord.h:367
static const cms_uint64_t LuminositySegmentNrMask
Definition: L1TcsWord.h:331
cms_uint16_t m_daqNr
number of DAQ partition to which the L1A has been sent
Definition: L1TcsWord.h:387
void setLuminositySegmentNr(const cms_uint16_t luminositySegmentNrValue)
Definition: L1TcsWord.h:173
void setAssignedPartitionsWord64(cms_uint64_t &word64, int iWord)
Definition: L1TcsWord.cc:307
static const cms_uint64_t BxNrMask
Definition: L1TcsWord.h:327
void setOrbitNrWord64(cms_uint64_t &word64, int iWord)
Definition: L1TcsWord.cc:374
static const cms_uint64_t PartTrigNrMask
Definition: L1TcsWord.h:357
static const int EventNrWord
Definition: L1TcsWord.h:355
void setStatus(const cms_uint16_t statusValue)
Definition: L1TcsWord.h:154
void setTriggerTypeWord64(cms_uint64_t &word64, int iWord)
Definition: L1TcsWord.cc:219
static const int PartRunNrWord
Definition: L1TcsWord.h:343
void setPartRunNr(const cms_uint32_t partRunNrValue)
Definition: L1TcsWord.h:193
void print(std::ostream &myCout) const
pretty print the content of a L1TcsWord
Definition: L1TcsWord.cc:405
static const cms_uint64_t StatusMask
Definition: L1TcsWord.h:330
static const int LuminositySegmentNrWord
Definition: L1TcsWord.h:323
void setPartTrigNr(const cms_uint32_t partTrigNrValue)
Definition: L1TcsWord.h:233
tuple result
Definition: query.py:137
static const int DaqNrShift
Definition: L1TcsWord.h:336
bool operator!=(const L1TcsWord &) const
unequal operator
Definition: L1TcsWord.cc:140
cms_uint32_t m_eventNr
event number since last L1 reset generated in TCS chip
Definition: L1TcsWord.h:415
cms_uint16_t m_boardId
board identifier
Definition: L1TcsWord.h:381
static const cms_uint64_t DaqNrMask
Definition: L1TcsWord.h:328
static const int PartTrigNrWord
Definition: L1TcsWord.h:354
unsigned short cms_uint16_t
Definition: typedefs.h:13
static const cms_uint64_t BoardIdMask
Definition: L1TcsWord.h:326
static const int BxNrWord
Definition: L1TcsWord.h:319
static const cms_uint64_t EventNrMask
Definition: L1TcsWord.h:358
cms_uint64_t m_orbitNr
orbit number since start of run (48 bits, in fact)
Definition: L1TcsWord.h:420
static const int LuminositySegmentNrShift
Definition: L1TcsWord.h:339
static const int PartTrigNrShift
Definition: L1TcsWord.h:360
void setLuminositySegmentNrWord64(cms_uint64_t &word64, int iWord)
Definition: L1TcsWord.cc:262
cms_uint16_t m_luminositySegmentNr
luminosity segment number
Definition: L1TcsWord.h:396
unsigned int cms_uint32_t
Definition: typedefs.h:15
#define LogTrace(id)
static const int StatusWord
Definition: L1TcsWord.h:322
static const int AssignedPartitionsWord
Definition: L1TcsWord.h:344
static const int BoardIdShift
Definition: L1TcsWord.h:334
void setBoardId(const cms_uint16_t boardIdValue)
set BoardId from a BoardId value
Definition: L1TcsWord.h:74
static const int BoardIdWord
Definition: L1TcsWord.h:318
static const int DaqNrWord
Definition: L1TcsWord.h:320
static const cms_uint64_t PartRunNrMask
Definition: L1TcsWord.h:346
cms_uint16_t m_status
0000 = normal rate; 1000 = low rate = warning
Definition: L1TcsWord.h:393
static const int StatusShift
Definition: L1TcsWord.h:338
static const cms_uint64_t TriggerTypeMask
Definition: L1TcsWord.h:329
static const int BlockSize
Definition: L1TcsWord.h:313
void setEventNrWord64(cms_uint64_t &word64, int iWord)
Definition: L1TcsWord.cc:352
void unpack(const unsigned char *tcsPtr)
Definition: L1TcsWord.cc:502
void setPartRunNrWord64(cms_uint64_t &word64, int iWord)
Definition: L1TcsWord.cc:284
static const int EventNrShift
Definition: L1TcsWord.h:361
static const int TriggerTypeShift
Definition: L1TcsWord.h:337
cms_uint32_t m_assignedPartitions
Definition: L1TcsWord.h:406
void setPartTrigNrWord64(cms_uint64_t &word64, int iWord)
Definition: L1TcsWord.cc:330
void setTriggerType(const cms_uint16_t triggerTypeValue)
Definition: L1TcsWord.h:134
unsigned long long cms_uint64_t
Definition: typedefs.h:17
void setEventNr(const cms_uint32_t eventNrValue)
Definition: L1TcsWord.h:253
void setDaqNrWord64(cms_uint64_t &word64, int iWord)
Definition: L1TcsWord.cc:199
static const int TriggerTypeWord
Definition: L1TcsWord.h:321
void setDaqNr(const cms_uint16_t daqNrValue)
Definition: L1TcsWord.h:114
static const cms_uint64_t AssignedPartitionsMask
Definition: L1TcsWord.h:347
bool operator==(const L1TcsWord &) const
equal operator
Definition: L1TcsWord.cc:87
static const int AssignedPartitionsShift
Definition: L1TcsWord.h:350
virtual ~L1TcsWord()
destructor
Definition: L1TcsWord.cc:79
void setStatusWord64(cms_uint64_t &word64, int iWord)
Definition: L1TcsWord.cc:240