CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1GtFdlWord.cc
Go to the documentation of this file.
1 
17 // this class header
19 
20 // system include files
21 #include <iostream>
22 #include <iomanip>
23 #include <vector>
24 #include <string>
25 
26 // user include files
27 
30 
31 // constructors
32 
33 // empty constructor, all members set to zero;
35 {
36 
37  m_boardId = 0;
38  m_bxInEvent = 0;
39  m_bxNr = 0;
40  m_eventNr = 0;
41 
42  // technical triggers std::vector<bool>
47 
48  // decision word std::vector<bool>
49  m_gtDecisionWord.reserve(
51  m_gtDecisionWord.assign(
53 
54  // extended decision word std::vector<bool>
59 
63 
64  m_noAlgo = 0;
65 
66  m_finalOR = 0;
67 
68 
69  m_orbitNr = 0;
70  m_lumiSegmentNr = 0;
71  m_localBxNr = 0;
72 
73 }
74 
75 // constructor from unpacked values;
76 L1GtFdlWord::L1GtFdlWord(cms_uint16_t boardIdValue, int bxInEventValue,
77  cms_uint16_t bxNrValue, cms_uint32_t eventNrValue,
78  TechnicalTriggerWord gtTechnicalTriggerWordValue,
79  DecisionWord gtDecisionWordValue,
80  DecisionWordExtended gtDecisionWordExtendedValue,
81  cms_uint16_t gtPrescaleFactorIndexTechValue,
82  cms_uint16_t gtPrescaleFactorIndexAlgoValue,
83  cms_uint16_t noAlgoValue, cms_uint16_t finalORValue,
84  cms_uint32_t orbitNrValue, cms_uint16_t lumiSegmentNrValue,
85  cms_uint16_t localBxNrValue) :
86  m_boardId(boardIdValue), m_bxInEvent(bxInEventValue), m_bxNr(bxNrValue),
87  m_eventNr(eventNrValue),
88  m_gtTechnicalTriggerWord(gtTechnicalTriggerWordValue),
89  m_gtDecisionWord(gtDecisionWordValue),
90  m_gtDecisionWordExtended(gtDecisionWordExtendedValue),
91  m_gtPrescaleFactorIndexTech(gtPrescaleFactorIndexTechValue),
92  m_gtPrescaleFactorIndexAlgo(gtPrescaleFactorIndexAlgoValue),
93  m_noAlgo(noAlgoValue), m_finalOR(finalORValue),
94  m_orbitNr(orbitNrValue), m_lumiSegmentNr(lumiSegmentNrValue),
95  m_localBxNr(localBxNrValue)
96 
97 {
99 
100  // the rest done in initialization list
101 }
102 
103 // destructor
105 {
106 
107  // empty now
108 }
109 
110 // equal operator
112 {
113 
114  if (m_boardId != result.m_boardId) {
115  return false;
116  }
117 
118  if (m_bxInEvent != result.m_bxInEvent) {
119  return false;
120  }
121 
122  if (m_bxNr != result.m_bxNr) {
123  return false;
124  }
125  if (m_eventNr != result.m_eventNr) {
126  return false;
127  }
128 
130  return false;
131  }
132 
133  if (m_gtDecisionWord != result.m_gtDecisionWord) {
134  return false;
135  }
136 
138  return false;
139  }
140 
141  if (m_physicsDeclared != result.m_physicsDeclared) {
142  return false;
143  }
144 
146  return false;
147  }
148 
150  return false;
151  }
152 
153  if (m_noAlgo != result.m_noAlgo) {
154  return false;
155  }
156 
157  if (m_finalOR != result.m_finalOR) {
158  return false;
159  }
160 
161  if (m_orbitNr != result.m_orbitNr) {
162  return false;
163  }
164 
165  if (m_lumiSegmentNr != result.m_lumiSegmentNr) {
166  return false;
167  }
168 
169  if (m_localBxNr != result.m_localBxNr) {
170  return false;
171  }
172 
173  // all members identical
174  return true;
175 
176 }
177 
178 // unequal operator
180 {
181 
182  return !( result == *this);
183 
184 }
185 
186 
187 // methods
188 
189 // set the BoardId value from a 64-bits word
191 {
192  m_boardId = (word64 & BoardIdMask) >> BoardIdShift;
193 
194 }
195 
196 // set the BoardId value in a 64-bits word, having the index iWord
197 // in the GTFE raw record
198 void L1GtFdlWord::setBoardIdWord64(cms_uint64_t& word64, const int iWord)
199 {
200 
201  if (iWord == BoardIdWord) {
202  word64 = word64 | (static_cast<cms_uint64_t> (m_boardId) << BoardIdShift);
203  }
204 
205 }
206 
207 
208 // set the BxInEvent value from a 64-bits word
210 {
211  int baseValue = 16; // using hexadecimal values;
212  int hexBxInEvent = (word64 & BxInEventMask) >> BxInEventShift;
213  m_bxInEvent = (hexBxInEvent + baseValue/2)%baseValue - baseValue/2;
214 
215 }
216 
217 // set the BxInEvent value in a 64-bits word, having the index iWord
218 // in the GTFE raw record
219 void L1GtFdlWord::setBxInEventWord64(cms_uint64_t& word64, const int iWord)
220 {
221 
222  if (iWord == BxInEventWord) {
223  int baseValue = 16; // using hexadecimal values;
224  int hexBxInEvent = (m_bxInEvent + baseValue)%baseValue;
225  word64 = word64 | (static_cast<cms_uint64_t> (hexBxInEvent)
226  << BxInEventShift);
227  }
228 
229 }
230 
231 
232 // set the BxNr value from a 64-bits word
234 {
235  m_bxNr = (word64 & BxNrMask) >> BxNrShift;
236 
237 }
238 
239 // set the BxNr value in a 64-bits word, having the index iWord
240 // in the GTFE raw record
241 void L1GtFdlWord::setBxNrWord64(cms_uint64_t& word64, const int iWord)
242 {
243 
244  if (iWord == BxNrWord) {
245  word64 = word64 | (static_cast<cms_uint64_t> (m_bxNr) << BxNrShift);
246  }
247 
248 }
249 
250 
251 // set the EventNr value from a 64-bits word
253 {
254  m_eventNr = (word64 & EventNrMask) >> EventNrShift;
255 
256 }
257 
258 // set the EventNr value in a 64-bits word, having the index iWord
259 // in the GTFE raw record
260 void L1GtFdlWord::setEventNrWord64(cms_uint64_t& word64, const int iWord)
261 {
262 
263  if (iWord == EventNrWord) {
264  word64 = word64 | (static_cast<cms_uint64_t> (m_eventNr) << EventNrShift);
265  }
266 
267 }
268 
269 
270 // print GT technical trigger word in bitset style
271 // depend on the type of TechnicalTriggerWord
272 // this version: <vector<bool>
273 void L1GtFdlWord::printGtTechnicalTriggerWord(std::ostream& myCout) const
274 {
275 
276  myCout << " Technical triggers (bitset style): \n " ;
277 
278  int sizeW64 = 64; // 64 bits words
279  int iBit = 0;
280 
281  for (std::vector<bool>::const_reverse_iterator ritBit = m_gtTechnicalTriggerWord.rbegin();
282  ritBit != m_gtTechnicalTriggerWord.rend(); ++ritBit) {
283 
284  myCout << (*ritBit ? '1' : '0');
285 
286  if ( (((iBit + 1)%16) == (sizeW64%16)) && (iBit != 63) ) {
287  myCout << " ";
288  }
289 
290  iBit++;
291  }
292 
293 
294 }
295 
296 // set the GtTechnicalTriggerWord value from a 64-bits word
298 {
299 
300  int word64Size = sizeof(word64)*8;
301  cms_uint64_t wordTT = (word64 & GtTechnicalTriggerWordMask)
303 
304  cms_uint64_t one64 = 1ULL;
305  for (int iBit = 0; iBit < word64Size; ++iBit) {
306  m_gtTechnicalTriggerWord.at(iBit) = wordTT & (one64 << iBit);
307  }
308 
309 }
310 
311 // set the GtTechnicalTriggerWord value in a 64-bits word, having the index iWord
312 // in the GTFE raw record
314 {
315 
316  if (iWord == GtTechnicalTriggerWordWord) {
317 
318  int word64Size = sizeof(word64)*8;
319  cms_uint64_t wordTT = 0x0000000000000000ULL;
320 
321  int iBit = 0;
322  cms_uint64_t iDecision = 0ULL;
323 
324  for (std::vector<bool>::const_iterator itBit = m_gtTechnicalTriggerWord.begin();
325  itBit != m_gtTechnicalTriggerWord.end(); ++itBit) {
326 
327  iDecision = static_cast<cms_uint64_t> (*itBit);//(*itBit ? 1 : 0);
328  wordTT = wordTT | (iDecision << iBit);
329 
330  iBit++;
331  if (iBit >= word64Size) {
332  break;
333  }
334 
335  }
336 
337  word64 = word64 | (wordTT << GtTechnicalTriggerWordShift);
338 
339  }
340 
341 }
342 
343 
344 // print GT decision word in bitset style
345 // depend on the type of DecisionWord
346 // this version: <vector<bool>
347 void L1GtFdlWord::printGtDecisionWord(std::ostream& myCout) const
348 {
349 
350  // decision word (in 64bits words)
351  int sizeW64 = 64; // 64 bits words
352 
353  int iBit = 0;
354  int jBit = m_gtDecisionWord.size();
355  int nrDecWord = m_gtDecisionWord.size()/sizeW64;
356 
357  std::ostringstream stream64;
358 
359  std::vector<std::string> decWord;
360  decWord.reserve(nrDecWord);
361 
362  for (std::vector<bool>::const_reverse_iterator ritBit = m_gtDecisionWord.rbegin();
363  ritBit != m_gtDecisionWord.rend(); ++ritBit) {
364 
365  stream64 << (*ritBit ? '1' : '0');
366 
367  if ( (((iBit + 1)%16) == (sizeW64%16)) ) {
368  stream64 << " ";
369  }
370 
371  if ( ((iBit + 1)%sizeW64) == 0) {
372  std::string iW = stream64.str();
373  stream64.str("");
374 
375  decWord.push_back(iW);
376  }
377 
378 
379  iBit++;
380  jBit--;
381  }
382 
383  int iWord = 0;
384 
385  for (std::vector<std::string>::reverse_iterator ritWord = decWord.rbegin();
386  ritWord != decWord.rend(); ++ritWord) {
387 
388  myCout << std::endl;
389  myCout << " DecisionWord (bitset style): bits "
390  << iWord*sizeW64 + sizeW64 - 1 << " : " << iWord*sizeW64 << "\n ";
391  myCout << *ritWord;
392 
393  iWord++;
394 
395  }
396 }
397 
398 // set the GtDecisionWord value from a 64-bits word
399 // WordA: bits 0 - 63
401 {
402 
403  int word64Size = sizeof(word64)*8; // well, it should be 64, if not... :-)
405 
406  cms_uint64_t one64 = 1ULL;
407 
408  for (int iBit = 0; iBit < word64Size; ++iBit) {
409  m_gtDecisionWord.at(iBit) = wordA & (one64 << iBit);
410  }
411 
412 }
413 
414 // set the GtDecisionWord value from a 64-bits word
415 // WordB: bits 64 - 127
417 {
418 
419  int word64Size = sizeof(word64)*8;
421 
422  cms_uint64_t one64 = 1ULL;
423 
424  for (int iBit = 0; iBit < word64Size; ++iBit) {
425  m_gtDecisionWord.at(iBit + word64Size) = wordB & (one64 << iBit);
426 
427  }
428 
429 }
430 
431 
432 // set the GtDecisionWord value in a 64-bits word, having the index iWord
433 // in the GTFE raw record
434 // WordA: bits 0 - 63
435 
436 // a bit forced: assumes wordSize64 = 64, but also take word shift
438 {
439 
440  if (iWord == GtDecisionWordAWord) {
441 
442  int word64Size = sizeof(word64)*8;
443  cms_uint64_t wordA = 0x0000000000000000ULL;
444 
445  int iBit = 0;
446  cms_uint64_t iDecision = 0ULL;
447 
448  for (std::vector<bool>::const_iterator itBit = m_gtDecisionWord.begin();
449  itBit != m_gtDecisionWord.end(); ++itBit) {
450 
451  iDecision = static_cast<cms_uint64_t> (*itBit);//(*itBit ? 1 : 0);
452  wordA = wordA | (iDecision << iBit);
453 
454  iBit++;
455  if (iBit >= word64Size) {
456  break;
457  }
458 
459  }
460 
461  word64 = word64 | (wordA << GtDecisionWordAShift);
462 
463  }
464 
465 }
466 
467 
468 // set the GtDecisionWord value in a 64-bits word, having the index iWord
469 // in the GTFE raw record
470 // WordB: bits 64 - 127
471 
472 // a bit forced: assumes wordSize64 = 64, but also take word shift
474 {
475 
476  if (iWord == GtDecisionWordBWord) {
477 
478  int word64Size = sizeof(word64)*8;
479  cms_uint64_t wordB = 0x0000000000000000ULL;
480 
481  int iBit = 0;
482  cms_uint64_t iDecision = 0ULL;
483 
484  for (std::vector<bool>::const_iterator itBit = m_gtDecisionWord.begin();
485  itBit != m_gtDecisionWord.end(); ++itBit) {
486 
487  if (iBit >= word64Size) {
488  // skip first word64Size bits, they go in wordA
489  iDecision = static_cast<cms_uint64_t> (*itBit);//(*itBit ? 1 : 0);
490  wordB = wordB | ( iDecision << (iBit - word64Size) );
491  }
492 
493  iBit++;
494 
495  }
496 
497  word64 = word64 | (wordB << GtDecisionWordBShift);
498  }
499 
500 }
501 
502 // print GT decision word extended in bitset style
503 // depend on the type of DecisionWord
504 // this version: <vector<bool>
505 void L1GtFdlWord::printGtDecisionWordExtended(std::ostream& myCout) const
506 {
507 
508  myCout << " DecisionWordExtended (bitset style): \n " ;
509 
510  int sizeW64 = 64; // 64 bits words
511  int iBit = 0;
512 
513  for (std::vector<bool>::const_reverse_iterator ritBit = m_gtDecisionWordExtended.rbegin();
514  ritBit != m_gtDecisionWordExtended.rend(); ++ritBit) {
515 
516  myCout << (*ritBit ? '1' : '0');
517 
518  if ( (((iBit + 1)%16) == (sizeW64%16)) && (iBit != 63) ) {
519  myCout << " ";
520  }
521 
522  iBit++;
523 
524  }
525 
526 }
527 
528 // set the GtDecisionWordExtended value from a 64-bits word
530 {
531 
532  int word64Size = sizeof(word64)*8;
533  cms_uint64_t wordE = (word64 & GtDecisionWordExtendedMask)
535 
536  cms_uint64_t one64 = 1ULL;
537 
538  for (int iBit = 0; iBit < word64Size; ++iBit) {
539  m_gtDecisionWordExtended.at(iBit) = wordE & (one64 << iBit);
540  }
541 
542 
543 }
544 
545 // set the GtDecisionWordExtended value in a 64-bits word, having the index iWord
546 // in the GTFE raw record
548 {
549 
550  if (iWord == GtDecisionWordExtendedWord) {
551 
552  int word64Size = sizeof(word64)*8;
553  cms_uint64_t wordE = 0x0000000000000000ULL;
554 
555  int iBit = 0;
556  cms_uint64_t iDecision = 0ULL;
557 
558  for (std::vector<bool>::const_iterator itBit = m_gtDecisionWordExtended.begin();
559  itBit != m_gtDecisionWordExtended.end(); ++itBit) {
560 
561  iDecision = static_cast<cms_uint64_t> (*itBit);//(*itBit ? 1 : 0);
562  wordE = wordE | (iDecision << iBit);
563 
564  iBit++;
565  if (iBit >= word64Size) {
566  break;
567  }
568 
569  }
570 
571  word64 = word64 | (wordE << GtDecisionWordExtendedShift);
572 
573  }
574 
575 }
576 
577 
578 // set the "physics declared" bit value from a 64-bits word
580 {
582 }
583 
584 // set the "physics declared" bit value in a 64-bits word, having the index iWord
585 // in the GTFE raw record
587 {
588 
589  if (iWord == PhysicsDeclaredWord) {
590  word64 = word64 | (static_cast<cms_uint64_t> (m_physicsDeclared)
592  }
593 
594 }
595 
596 
597 // set the GtPrescaleFactorIndexTech from a 64-bits word
601 }
602 
603 // set the GtPrescaleFactorIndexTech bits in a 64-bits word, having the index iWord
604 // in the GTFE raw record
606  const int iWord) {
607 
608  if (iWord == GtPrescaleFactorIndexTechWord) {
609  word64 = word64
610  | (static_cast<cms_uint64_t> (m_gtPrescaleFactorIndexTech)
612  }
613 
614 }
615 
616 
617 // set the GtPrescaleFactorIndexAlgo from a 64-bits word
621 }
622 
623 // set the GtPrescaleFactorIndexAlgo bits in a 64-bits word, having the index iWord
624 // in the GTFE raw record
626  const int iWord) {
627 
628  if (iWord == GtPrescaleFactorIndexAlgoWord) {
629  word64 = word64
630  | (static_cast<cms_uint64_t> (m_gtPrescaleFactorIndexAlgo)
632  }
633 
634 }
635 
636 // set the NoAlgo value from a 64-bits word
638 {
639  m_noAlgo = (word64 & NoAlgoMask) >> NoAlgoShift;
640 }
641 
642 // set the NoAlgo value in a 64-bits word, having the index iWord
643 // in the GTFE raw record
644 void L1GtFdlWord::setNoAlgoWord64(cms_uint64_t& word64, const int iWord)
645 {
646 
647  if (iWord == NoAlgoWord) {
648  word64 = word64 | (static_cast<cms_uint64_t> (m_noAlgo)
649  << NoAlgoShift);
650  }
651 
652 }
653 
654 
655 
656 
657 // set the FinalOR value from a 64-bits word
659 {
660  m_finalOR = (word64 & FinalORMask) >> FinalORShift;
661 
662 }
663 
664 // set the FinalOR value in a 64-bits word, having the index iWord
665 // in the GTFE raw record
666 void L1GtFdlWord::setFinalORWord64(cms_uint64_t& word64, const int iWord)
667 {
668 
669  if (iWord == FinalORWord) {
670  word64 = word64 | (static_cast<cms_uint64_t> (m_finalOR)
671  << FinalORShift);
672  }
673 
674 }
675 
676 
677 // set the orbit number bits from a 64-bits word
679  m_orbitNr = (word64 & OrbitNrMask) >> OrbitNrShift;
680 }
681 
682 // set the orbit number bits in a 64-bits word, having the index iWord
683 // in the GTFE raw record
684 void L1GtFdlWord::setOrbitNrWord64(cms_uint64_t& word64, const int iWord) {
685 
686  if (iWord == OrbitNrWord) {
687  word64 = word64 | (static_cast<cms_uint64_t> (m_orbitNr)
688  << OrbitNrShift);
689  }
690 
691 }
692 
693 
694 
695 // set the luminosity segment number bits from a 64-bits word
698 }
699 
700 // set the luminosity segment number bits in a 64-bits word, having the index iWord
701 // in the GTFE raw record
703  const int iWord) {
704 
705  if (iWord == LumiSegmentNrWord) {
706  word64 = word64 | (static_cast<cms_uint64_t> (m_lumiSegmentNr)
707  << LumiSegmentNrShift);
708  }
709 
710 }
711 
712 
713 // set the LocalBxNr value from a 64-bits word
715 {
716  m_localBxNr = (word64 & LocalBxNrMask) >> LocalBxNrShift;
717 }
718 
719 // set the LocalBxNr value in a 64-bits word, having the index iWord
720 // in the GTFE raw record
721 void L1GtFdlWord::setLocalBxNrWord64(cms_uint64_t& word64, const int iWord)
722 {
723 
724  if (iWord == LocalBxNrWord) {
725  word64 = word64 | (static_cast<cms_uint64_t> (m_localBxNr)
726  << LocalBxNrShift);
727  }
728 
729 }
730 
731 
732 
733 // reset the content of a L1GtFdlWord
735 {
736 
737  m_boardId = 0;
738  m_bxInEvent = 0;
739  m_bxNr = 0;
740  m_eventNr = 0;
741 
742  // technical triggers std::vector<bool>
745 
746  // decision word std::vector<bool>
747  m_gtDecisionWord.assign(
749 
750  // extended decision word std::vector<bool>
753 
754  m_physicsDeclared = 0;
757 
758  m_noAlgo = 0;
759  m_finalOR = 0;
760 
761  m_orbitNr = 0;
762  m_lumiSegmentNr = 0;
763  m_localBxNr = 0;
764 
765 }
766 
767 // pretty print the content of a L1GtFdlWord
768 void L1GtFdlWord::print(std::ostream& myCout) const
769 {
770 
771  myCout << "\n L1GtFdlWord::print \n" << std::endl;
772 
773  int iWord = 0;
774 
775  myCout << "\n Word " << iWord << std::endl;
776 
777  myCout << " Board Id: "
778  << std::hex << " hex: " << " " << std::setw(4) << std::setfill('0') << m_boardId
779  << std::setfill(' ')
780  << std::dec << " dec: " << m_boardId
781  << std::endl;
782  //
783 
784  int baseValue = 16; // using hexadecimal values;
785  int hexBxInEvent = (m_bxInEvent + baseValue)%baseValue;
786 
787  myCout << " BxInEvent: "
788  << std::hex << " hex: " << " " << std::setw(1) << hexBxInEvent
789  << std::dec << " dec: " << m_bxInEvent
790  << std::endl;
791 
792  myCout << " BxNr: "
793  << std::hex << " hex: " << " " << std::setw(3) << std::setfill('0') << m_bxNr
794  << std::setfill(' ')
795  << std::dec << " dec: " << m_bxNr
796  << std::endl;
797 
798 
799  myCout << " EventNr: "
800  << std::hex << " hex: " << " " << std::setw(6) << std::setfill('0') << m_eventNr
801  << std::setfill(' ')
802  << std::dec << " dec: " << m_eventNr
803  << std::endl;
804 
805  // technical triggers
806 
807  iWord++;
808  myCout << "\n Word " << iWord << std::endl;
809 
811  myCout << std::endl;
812 
813  // physics triggers (2 words!)
814 
815  iWord++;
816  myCout << "\n Word " << iWord;
817  iWord++;
818  myCout << " and word " << iWord;
819 
820  printGtDecisionWord(myCout);
821  myCout << std::endl;
822 
823  // decision word extended (64 bits)
824 
825  iWord++;
826  myCout << "\n Word " << iWord << std::endl;
827 
829  myCout << std::endl;
830 
831  //
832  iWord++;
833  myCout << "\n Word " << iWord << std::endl;
834 
835  myCout << " PhysicsDeclared: "
836  << std::hex << " hex: " << " " << std::setw(4) << std::setfill('0')
838  << std::setfill(' ')
839  << std::dec << " dec: " << m_physicsDeclared
840  << std::endl;
841 
842  myCout << " GtPrescaleFactorIndexTech: "
843  << std::hex << " hex: " << " " << std::setw(4) << std::setfill('0')
845  << std::setfill(' ')
846  << std::dec << " dec: " << m_gtPrescaleFactorIndexTech
847  << std::endl;
848 
849  myCout << " GtPrescaleFactorIndexAlgo: "
850  << std::hex << " hex: " << " " << std::setw(4) << std::setfill('0')
852  << std::setfill(' ')
853  << std::dec << " dec: " << m_gtPrescaleFactorIndexAlgo
854  << std::endl;
855 
856  myCout << " NoAlgo: "
857  << std::hex << " hex: " << " " << std::setw(1) << std::setfill('0') << m_noAlgo
858  << std::setfill(' ')
859  << std::dec << " dec: " << m_noAlgo
860  << std::endl;
861 
862  myCout << " FinalOR: "
863  << std::hex << " hex: " << " " << std::setw(2) << std::setfill('0') << m_finalOR
864  << std::setfill(' ')
865  << std::dec << " dec: " << m_finalOR
866  << std::endl;
867 
868  iWord++;
869  myCout << "\n Word " << iWord << std::endl;
870 
871  myCout << " OrbitNr: "
872  << std::hex << " hex: " << "" << std::setw(8) << std::setfill('0') << m_orbitNr
873  << std::setfill(' ')
874  << std::dec << " dec: " << m_orbitNr
875  << std::endl;
876 
877  myCout << " LumiSegmentNr: "
878  << std::hex << " hex: " << " " << std::setw(4) << std::setfill('0') << m_lumiSegmentNr
879  << std::setfill(' ')
880  << std::dec << " dec: " << m_lumiSegmentNr
881  << std::endl;
882 
883  myCout << " LocalBxNr: "
884  << std::hex << " hex: " << " " << std::setw(3) << std::setfill('0') << m_localBxNr
885  << std::setfill(' ')
886  << std::dec << " dec: " << m_localBxNr
887  << std::endl;
888 
889 }
890 
891 // unpack FDL
892 // fdlPtr pointer to the beginning of the FDL block in the raw data
893 void L1GtFdlWord::unpack(const unsigned char* fdlPtr)
894 {
895  LogDebug("L1GtFdlWord")
896  << "\nUnpacking FDL block.\n"
897  << std::endl;
898 
899  const cms_uint64_t* payload =
900  reinterpret_cast<cms_uint64_t*>(const_cast<unsigned char*>(fdlPtr));
901 
902  setBoardId(payload[BoardIdWord]);
903  setBxInEvent(payload[BxInEventWord]);
904  setBxNr(payload[BxNrWord]);
905  setEventNr(payload[EventNrWord]);
906 
908 
910 
912 
914 
918  setNoAlgo(payload[NoAlgoWord]);
919  setFinalOR(payload[FinalORWord]);
920 
921  setOrbitNr(payload[OrbitNrWord]);
923  setLocalBxNr(payload[LocalBxNrWord]);
924 
925  if ( edm::isDebugEnabled() ) {
926 
927  for (int iWord = 0; iWord < BlockSize; ++iWord) {
928  LogTrace("L1GtFdlWord")
929  << std::setw(4) << iWord << " "
930  << std::hex << std::setfill('0')
931  << std::setw(16) << payload[iWord]
932  << std::dec << std::setfill(' ')
933  << std::endl;
934  }
935 
936  }
937 
938 }
939 
940 
941 // static class members
942 
943 // block description in the raw GT record
944 
945 // block size in 64bits words (BlockSize * 64 bits)
946 const int L1GtFdlWord::BlockSize = 7;
947 
948 // word 0
949 
950 // index of the word in the FDL block containig the variable
951 const int L1GtFdlWord::BoardIdWord = 0;
952 const int L1GtFdlWord::BxInEventWord = 0;
953 const int L1GtFdlWord::BxNrWord = 0;
954 const int L1GtFdlWord::EventNrWord = 0;
955 
956 // mask to get the 64-bit-value from the corresponding word in the FDL block
957 const cms_uint64_t L1GtFdlWord::BoardIdMask = 0xFFFF000000000000ULL;
958 const cms_uint64_t L1GtFdlWord::BxInEventMask = 0x0000F00000000000ULL;
959 const cms_uint64_t L1GtFdlWord::BxNrMask = 0x00000FFF00000000ULL;
960 const cms_uint64_t L1GtFdlWord::EventNrMask = 0x0000000000FFFFFFULL;
961 
962 // shift to the right to get the value from the "64-bit-value"
963 const int L1GtFdlWord::BoardIdShift = 48;
964 const int L1GtFdlWord::BxInEventShift = 44;
965 const int L1GtFdlWord::BxNrShift = 32;
966 const int L1GtFdlWord::EventNrShift = 0;
967 
968 // word 1
969 
971 const cms_uint64_t L1GtFdlWord::GtTechnicalTriggerWordMask = 0xFFFFFFFFFFFFFFFFULL;
973 
974 // word 2 - WordA: bits 0-63
975 
977 const cms_uint64_t L1GtFdlWord::GtDecisionWordAMask = 0xFFFFFFFFFFFFFFFFULL;
979 
980 // word 3 - WordB: bits 64-128
981 
983 const cms_uint64_t L1GtFdlWord::GtDecisionWordBMask = 0xFFFFFFFFFFFFFFFFULL;
985 
986 
987 // word 4
989 const cms_uint64_t L1GtFdlWord::GtDecisionWordExtendedMask = 0xFFFFFFFFFFFFFFFFULL;
991 
992 // word 5
996 const int L1GtFdlWord::NoAlgoWord = 5;
997 const int L1GtFdlWord::FinalORWord = 5;
998 
999 const cms_uint64_t L1GtFdlWord::PhysicsDeclaredMask = 0x8000000000000000ULL;
1000 const cms_uint64_t L1GtFdlWord::GtPrescaleFactorIndexTechMask = 0x00FF000000000000ULL;
1001 const cms_uint64_t L1GtFdlWord::GtPrescaleFactorIndexAlgoMask = 0x000000FF00000000ULL;
1002 const cms_uint64_t L1GtFdlWord::NoAlgoMask = 0x0000000000000100ULL;
1003 const cms_uint64_t L1GtFdlWord::FinalORMask = 0x00000000000000FFULL;
1004 
1005 const int L1GtFdlWord::PhysicsDeclaredShift = 63;
1008 const int L1GtFdlWord::NoAlgoShift = 8;
1009 const int L1GtFdlWord::FinalORShift = 0;
1010 
1011 // word 6
1012 const int L1GtFdlWord::OrbitNrWord = 6;
1013 const int L1GtFdlWord::LumiSegmentNrWord = 6;
1014 const int L1GtFdlWord::LocalBxNrWord = 6;
1015 
1016 const cms_uint64_t L1GtFdlWord::OrbitNrMask = 0xFFFFFFFF00000000ULL;
1017 const cms_uint64_t L1GtFdlWord::LumiSegmentNrMask = 0x00000000FFFF0000ULL;
1018 const cms_uint64_t L1GtFdlWord::LocalBxNrMask = 0x0000000000000FFFULL;
1019 
1020 const int L1GtFdlWord::OrbitNrShift = 32;
1021 const int L1GtFdlWord::LumiSegmentNrShift = 16;
1022 const int L1GtFdlWord::LocalBxNrShift = 0;
1023 
#define LogDebug(id)
void setGtDecisionWordB(const cms_uint64_t &word64)
Definition: L1GtFdlWord.cc:416
static const cms_uint64_t EventNrMask
Definition: L1GtFdlWord.h:432
bool isDebugEnabled()
cms_uint32_t m_eventNr
event number since last L1 reset generated in FDL
Definition: L1GtFdlWord.h:509
static const cms_uint64_t LocalBxNrMask
Definition: L1GtFdlWord.h:490
void setNoAlgoWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:644
cms_uint16_t m_bxNr
bunch cross number of the actual bx
Definition: L1GtFdlWord.h:506
cms_uint16_t m_localBxNr
Definition: L1GtFdlWord.h:548
cms_uint16_t m_finalOR
Definition: L1GtFdlWord.h:536
void setGtDecisionWordBWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:473
void setBoardId(const cms_uint16_t &boardIdValue)
set BoardId from a BoardId value
Definition: L1GtFdlWord.h:77
static const int EventNrShift
Definition: L1GtFdlWord.h:438
static const cms_uint64_t BoardIdMask
Definition: L1GtFdlWord.h:429
static const int GtPrescaleFactorIndexTechShift
Definition: L1GtFdlWord.h:478
void setFinalOR(const cms_uint16_t &finalORValue)
Definition: L1GtFdlWord.h:313
static const cms_uint64_t GtDecisionWordAMask
Definition: L1GtFdlWord.h:449
static const unsigned int NumberTechnicalTriggers
void setPhysicsDeclared(const cms_uint16_t &physicsDeclaredValue)
Definition: L1GtFdlWord.h:234
static const cms_uint64_t GtPrescaleFactorIndexAlgoMask
Definition: L1GtFdlWord.h:473
static const int BxInEventShift
Definition: L1GtFdlWord.h:436
static const int GtDecisionWordBShift
Definition: L1GtFdlWord.h:456
void setEventNr(const cms_uint32_t &eventNrValue)
Definition: L1GtFdlWord.h:137
void unpack(const unsigned char *fdlPtr)
Definition: L1GtFdlWord.cc:893
void setBoardIdWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:198
static const int FinalORWord
Definition: L1GtFdlWord.h:469
static const cms_uint64_t NoAlgoMask
Definition: L1GtFdlWord.h:474
static const int BxNrShift
Definition: L1GtFdlWord.h:437
void setLumiSegmentNrWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:702
cms_uint16_t m_noAlgo
true if no algorithm (from a defined group - default all) triggered
Definition: L1GtFdlWord.h:532
void setOrbitNrWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:684
void setGtTechnicalTriggerWordWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:313
static const int PhysicsDeclaredShift
Definition: L1GtFdlWord.h:477
static const int LocalBxNrShift
Definition: L1GtFdlWord.h:494
void setLocalBxNr(const cms_uint16_t &localBxNrValue)
Definition: L1GtFdlWord.h:379
void setGtDecisionWordA(const cms_uint64_t &word64)
Definition: L1GtFdlWord.cc:400
void printGtDecisionWord(std::ostream &myCout) const
Definition: L1GtFdlWord.cc:347
static const int OrbitNrShift
Definition: L1GtFdlWord.h:492
static const int GtDecisionWordBWord
Definition: L1GtFdlWord.h:454
static const int GtDecisionWordAShift
Definition: L1GtFdlWord.h:450
std::vector< bool > DecisionWordExtended
void setGtPrescaleFactorIndexTechWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:605
cms_uint16_t m_gtPrescaleFactorIndexAlgo
Definition: L1GtFdlWord.h:529
static const unsigned int NumberPhysTriggersExtended
static const int GtPrescaleFactorIndexAlgoWord
Definition: L1GtFdlWord.h:467
static const int LumiSegmentNrShift
Definition: L1GtFdlWord.h:493
void setGtTechnicalTriggerWord(const TechnicalTriggerWord &gtTechnicalTriggerWordValue)
Definition: L1GtFdlWord.h:156
static const int BoardIdShift
Definition: L1GtFdlWord.h:435
static const int NoAlgoShift
Definition: L1GtFdlWord.h:480
void setLumiSegmentNr(const cms_uint16_t &lumiSegmentNrValue)
Definition: L1GtFdlWord.h:359
std::vector< bool > DecisionWord
typedefs
void setBxInEventWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:219
static const int BlockSize
Definition: L1GtFdlWord.h:418
virtual ~L1GtFdlWord()
destructor
Definition: L1GtFdlWord.cc:104
tuple result
Definition: query.py:137
void setPhysicsDeclaredWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:586
void printGtDecisionWordExtended(std::ostream &myCout) const
Definition: L1GtFdlWord.cc:505
void reset()
reset the content of a L1GtFdlWord
Definition: L1GtFdlWord.cc:734
cms_uint16_t m_lumiSegmentNr
luminosity segment number
Definition: L1GtFdlWord.h:544
static const int LumiSegmentNrWord
Definition: L1GtFdlWord.h:485
cms_uint16_t m_gtPrescaleFactorIndexTech
Definition: L1GtFdlWord.h:528
void setEventNrWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:260
std::vector< bool > TechnicalTriggerWord
technical trigger bits (64 bits)
unsigned short cms_uint16_t
Definition: typedefs.h:13
static const int EventNrWord
Definition: L1GtFdlWord.h:426
static const unsigned int NumberPhysTriggers
void setBxNrWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:241
DecisionWord m_gtDecisionWord
algorithm bits
Definition: L1GtFdlWord.h:517
void setGtPrescaleFactorIndexAlgo(const cms_uint16_t &gtPrescaleFactorIndexAlgoValue)
Definition: L1GtFdlWord.h:274
static const int BoardIdWord
Definition: L1GtFdlWord.h:423
void setGtPrescaleFactorIndexTech(const cms_uint16_t &gtPrescaleFactorIndexTechValue)
Definition: L1GtFdlWord.h:255
static const cms_uint64_t GtTechnicalTriggerWordMask
Definition: L1GtFdlWord.h:443
static const int BxInEventWord
Definition: L1GtFdlWord.h:424
unsigned int cms_uint32_t
Definition: typedefs.h:15
#define LogTrace(id)
void print(std::ostream &myCout) const
pretty print the content of a L1GtFdlWord
Definition: L1GtFdlWord.cc:768
static const cms_uint64_t BxNrMask
Definition: L1GtFdlWord.h:431
void setNoAlgo(const cms_uint16_t &noAlgoValue)
Definition: L1GtFdlWord.h:293
static const int GtTechnicalTriggerWordShift
Definition: L1GtFdlWord.h:444
static const cms_uint64_t GtDecisionWordExtendedMask
Definition: L1GtFdlWord.h:461
cms_uint16_t m_boardId
board identifier
Definition: L1GtFdlWord.h:500
static const int GtDecisionWordAWord
Definition: L1GtFdlWord.h:448
bool operator!=(const L1GtFdlWord &) const
unequal operator
Definition: L1GtFdlWord.cc:179
static const cms_uint64_t LumiSegmentNrMask
Definition: L1GtFdlWord.h:489
static const cms_uint64_t PhysicsDeclaredMask
Definition: L1GtFdlWord.h:471
static const int FinalORShift
Definition: L1GtFdlWord.h:481
static const int BxNrWord
Definition: L1GtFdlWord.h:425
int m_bxInEvent
bunch cross in the GT event record
Definition: L1GtFdlWord.h:503
static const int PhysicsDeclaredWord
Definition: L1GtFdlWord.h:465
void setGtDecisionWordExtendedWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:547
static const int OrbitNrWord
Definition: L1GtFdlWord.h:484
static const cms_uint64_t GtPrescaleFactorIndexTechMask
Definition: L1GtFdlWord.h:472
static const cms_uint64_t OrbitNrMask
Definition: L1GtFdlWord.h:488
void setLocalBxNrWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:721
void setGtDecisionWordAWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:437
static const int GtTechnicalTriggerWordWord
Definition: L1GtFdlWord.h:442
static const cms_uint64_t FinalORMask
Definition: L1GtFdlWord.h:475
static const int LocalBxNrWord
Definition: L1GtFdlWord.h:486
static const cms_uint64_t GtDecisionWordBMask
Definition: L1GtFdlWord.h:455
void setOrbitNr(const cms_uint32_t &orbitNrValue)
Definition: L1GtFdlWord.h:339
void printGtTechnicalTriggerWord(std::ostream &myCout) const
Definition: L1GtFdlWord.cc:273
static const int GtDecisionWordExtendedWord
Definition: L1GtFdlWord.h:460
void setBxInEvent(const int bxInEventValue)
Definition: L1GtFdlWord.h:97
DecisionWordExtended m_gtDecisionWordExtended
extended algorithm bits, in addition to 128
Definition: L1GtFdlWord.h:520
static const cms_uint64_t BxInEventMask
Definition: L1GtFdlWord.h:430
void setFinalORWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:666
unsigned long long cms_uint64_t
Definition: typedefs.h:17
void setBxNr(const cms_uint16_t &bxNrValue)
Definition: L1GtFdlWord.h:117
static const int GtPrescaleFactorIndexTechWord
Definition: L1GtFdlWord.h:466
void setGtPrescaleFactorIndexAlgoWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:625
bool operator==(const L1GtFdlWord &) const
equal operator
Definition: L1GtFdlWord.cc:111
cms_uint16_t m_physicsDeclared
set to true when physics declared
Definition: L1GtFdlWord.h:524
static const int NoAlgoWord
Definition: L1GtFdlWord.h:468
void setGtDecisionWordExtended(const DecisionWordExtended &gtDecisionWordExtendedValue)
Definition: L1GtFdlWord.h:210
TechnicalTriggerWord m_gtTechnicalTriggerWord
technical trigger bits
Definition: L1GtFdlWord.h:514
cms_uint32_t m_orbitNr
orbit number
Definition: L1GtFdlWord.h:541
static const int GtPrescaleFactorIndexAlgoShift
Definition: L1GtFdlWord.h:479
static const int GtDecisionWordExtendedShift
Definition: L1GtFdlWord.h:462
L1GtFdlWord()
constructors
Definition: L1GtFdlWord.cc:34