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