CMS 3D CMS Logo

L1GTEvmDigiToRaw.cc
Go to the documentation of this file.
1 
15 // this class header
17 
18 // system include files
19 #include <vector>
20 #include <iostream>
21 #include <iomanip>
22 
23 
24 // user include files
27 
31 
34 
39 
40 
43 
46 
49 
52 
53 
54 // constructor(s)
56  m_evmGtFedId(pSet.getUntrackedParameter<int>("EvmGtFedId",
57  FEDNumbering::MINTriggerGTPFEDID)),
58  m_evmGtInputToken(consumes<L1GlobalTriggerEvmReadoutRecord>(pSet.getParameter<edm::InputTag>("EvmGtInputTag"))),
59  m_evmGtInputTag(pSet.getParameter<edm::InputTag>("EvmGtInputTag")),
60  m_activeBoardsMaskGt(pSet.getParameter<unsigned int>("ActiveBoardsMask")),
61  m_totalBxInEvent(0),
62  m_minBxInEvent(0), m_maxBxInEvent(),
63  m_verbosity(pSet.getUntrackedParameter<int> ("Verbosity", 0)),
64  m_isDebugEnabled(edm::isDebugEnabled())
65 
66 
67 
68 {
69 
70  LogDebug("L1GTEvmDigiToRaw") << "\nMask for active boards (hex format): "
71  << std::hex << std::setw(sizeof(m_activeBoardsMaskGt)*2)
72  << std::setfill('0') << m_activeBoardsMaskGt << std::dec
73  << std::setfill(' ') << "\nInput tag for EVM GT record: "
74  << m_evmGtInputTag << "\nFED Id for EVM GT record: "
75  << m_evmGtFedId << " \n" << std::endl;
76 
77  //
78  produces<FEDRawDataCollection>();
79 
80 }
81 
82 // member functions
83 
84 // method called to produce the data
86 {
87 
88  // define new FEDRawDataCollection
89  // it contains ALL FEDs in an event
90  std::unique_ptr<FEDRawDataCollection> allFedRawData(new FEDRawDataCollection);
91 
92  FEDRawData& gtRawData = allFedRawData->FEDData(m_evmGtFedId);
93 
94  // get records from EventSetup
95 
96  // board maps
98  evSetup.get< L1GtBoardMapsRcd >().get( l1GtBM );
99 
100  const std::vector<L1GtBoard> boardMaps = l1GtBM->gtBoardMaps();
101  int boardMapsSize = boardMaps.size();
102 
103  typedef std::vector<L1GtBoard>::const_iterator CItBoardMaps;
104 
105  // create an ordered vector for the GT EVM record
106  // header (pos 0 in record) and trailer (last position in record)
107  // not included, as they are not in board list
108  std::vector<L1GtBoard> gtRecordMap;
109  gtRecordMap.reserve(boardMapsSize);
110 
111  for (int iPos = 0; iPos < boardMapsSize; ++iPos) {
112  for (CItBoardMaps itBoard = boardMaps.begin(); itBoard
113  != boardMaps.end(); ++itBoard) {
114 
115  if (itBoard->gtPositionEvmRecord() == iPos) {
116  gtRecordMap.push_back(*itBoard);
117  break;
118  }
119 
120  }
121  }
122 
123 
124 
125  // get L1GlobalTriggerEvmReadoutRecord
127  iEvent.getByToken(m_evmGtInputToken, gtReadoutRecord);
128 
129  if (!gtReadoutRecord.isValid()) {
130  edm::LogWarning("L1GTEvmDigiToRaw")
131  << "\nWarning: L1GlobalTriggerEvmReadoutRecord with input tag " << m_evmGtInputTag
132  << "\nrequested in configuration, but not found in the event."
133  << "\nQuit packing this event" << std::endl;
134 
135  // put the raw data in the event
136  iEvent.put(std::move(allFedRawData));
137 
138  return;
139  }
140 
141  if (m_verbosity && m_isDebugEnabled) {
142  std::ostringstream myCoutStream;
143  gtReadoutRecord->print(myCoutStream);
144  LogTrace("L1GTEvmDigiToRaw")
145  << "\n The following L1 GT EVM readout record will be packed.\n"
146  << " Some boards could be disabled before packing,"
147  << " see detailed board packing.\n"
148  << myCoutStream.str() << "\n"
149  << std::endl;
150  }
151 
152  // get GTFE block
153  L1GtfeExtWord gtfeBlock = gtReadoutRecord->gtfeWord();
154 
155  // get the number of Bx in the event for alternative 0 and alternative 1
156  cms_uint16_t recordLength0 = gtfeBlock.recordLength();
157  cms_uint16_t recordLength1 = gtfeBlock.recordLength1();
158 
159  // length of BST record (in bytes)
160  m_bstLengthBytes= static_cast<int> (gtfeBlock.bstLengthBytes());
161 
162  // get list of active blocks from the GTFE block
163  // and mask some blocks, if required
164  // blocks not active are not written to the record
165 
166  cms_uint16_t activeBoardsGtInitial = gtfeBlock.activeBoards();
167  cms_uint16_t altNrBxBoardInitial = gtfeBlock.altNrBxBoard();
168 
169  // mask some boards, if needed
170 
171  cms_uint16_t activeBoardsGt = activeBoardsGtInitial & m_activeBoardsMaskGt;
172 
173  if (m_verbosity && m_isDebugEnabled) {
174  LogDebug("L1GTEvmDigiToRaw")
175  << "\nActive boards before masking(hex format): " << std::hex
176  << std::setw(sizeof ( activeBoardsGtInitial ) * 2) << std::setfill('0')
177  << activeBoardsGtInitial << std::dec << std::setfill(' ')
178  << "\nActive boards after masking(hex format): " << std::hex
179  << std::setw(sizeof ( activeBoardsGt ) * 2) << std::setfill('0')
180  << activeBoardsGt << std::dec
181  << std::setfill(' ') << " \n"
182  << std::endl;
183  }
184 
185  // get the size of the record
186 
187  unsigned int gtDataSize = 0;
188 
189  unsigned int headerSize = 8;
190  gtDataSize += headerSize;
191 
192  for (CItBoardMaps
193  itBoard = boardMaps.begin();
194  itBoard != boardMaps.end(); ++itBoard) {
195 
196  if (itBoard->gtBoardType() == GTFE) {
197  gtDataSize += gtfeBlock.getSize();
198  continue;
199  }
200 
201 
202  int iActiveBit = itBoard->gtBitEvmActiveBoards();
203  bool activeBoardToPack = false;
204 
205  int altNrBxBoardVal = -1;
206 
207  if (iActiveBit >= 0) {
208  activeBoardToPack = activeBoardsGt & (1 << iActiveBit);
209 
210  altNrBxBoardVal = (altNrBxBoardInitial & ( 1 << iActiveBit )) >> iActiveBit;
211 
212  if (altNrBxBoardVal == 1) {
213  m_totalBxInEvent = recordLength1;
214  } else if (altNrBxBoardVal == 0) {
215  m_totalBxInEvent = recordLength0;
216  } else {
217  if (m_verbosity) {
218  edm::LogWarning("L1GTEvmDigiToRaw")
219  << "\n\nWARNING: Wrong value altNrBxBoardVal = " << altNrBxBoardVal
220  << " for board " << std::hex << ( itBoard->gtBoardId() ) << std::dec
221  << "\n iActiveBit = " << iActiveBit
222  << "\n altNrBxBoardInitial = 0x" << std::hex << altNrBxBoardInitial << std::dec
223  << "\n activeBoardsGt = 0x" << std::hex << activeBoardsGt << std::dec
224  << "\n activeBoardToPack = " << activeBoardToPack
225  << "\n Set altNrBxBoardVal tentatively to "
226  << recordLength0 << "\n Job may crash or produce wrong results!\n\n"
227  << std::endl;
228  }
229 
230  m_totalBxInEvent = recordLength0;
231  }
232  } else {
233  // board not in the ActiveBoards for the record
234  continue;
235  }
236 
237  if (activeBoardToPack) {
238 
239  switch (itBoard->gtBoardType()) {
240  case GTFE: {
241  // size already added;
242  }
243 
244  break;
245  case FDL: {
246  L1GtFdlWord fdlBlock;
247  gtDataSize += m_totalBxInEvent*fdlBlock.getSize();
248  }
249 
250  break;
251  case TCS: {
252  L1TcsWord tcsBlock;
253  gtDataSize += tcsBlock.getSize();
254  }
255 
256  break;
257  case TIM: {
258  // not considered
259  }
260 
261  break;
262  default: {
263  // do nothing, all blocks are given in GtBoardType enum
264  }
265 
266  break;
267  }
268  }
269 
270  }
271 
272 
273  unsigned int trailerSize = 8;
274  gtDataSize += trailerSize;
275 
276  // resize, GT raw data record has variable length,
277  // depending on active boards (read in GTFE)
278  gtRawData.resize(gtDataSize);
279 
280  // ptrGt: pointer to the beginning of GT record in the raw data
281 
282  unsigned char* ptrGt = gtRawData.data();
283  unsigned char* ptrGtBegin = gtRawData.data();
284 
285  if (m_verbosity && m_isDebugEnabled) {
286  LogDebug("L1GTEvmDigiToRaw") << "\n Size of raw data: " << gtRawData.size() << "\n"
287  << std::endl;
288  }
289 
290  // ------- pack boards -------
291 
292  // pack header
293  packHeader(ptrGt, iEvent);
294  ptrGt += headerSize; // advance with header size
295 
296  // loop over other blocks in the raw record, if they are active
297 
298  for (CItBoardMaps
299  itBoard = gtRecordMap.begin();
300  itBoard != gtRecordMap.end(); ++itBoard) {
301 
302  if (itBoard->gtBoardType() == GTFE) {
303 
304  packGTFE(evSetup, ptrGt, gtfeBlock, activeBoardsGt);
305 
306  if (m_verbosity && m_isDebugEnabled) {
307 
308  std::ostringstream myCoutStream;
309  gtfeBlock.print(myCoutStream);
310  LogTrace("L1GTEvmDigiToRaw")
311  << myCoutStream.str() << "\n"
312  << std::endl;
313  }
314 
315  ptrGt += gtfeBlock.getSize(); // advance with GTFE block size
316 
317  continue;
318  }
319 
320 
321  // pack modules other than GTFE if they are active
322 
323  int iActiveBit = itBoard->gtBitEvmActiveBoards();
324  bool activeBoardToPack = false;
325 
326  int altNrBxBoardVal = -1;
327 
328  if (iActiveBit >= 0) {
329  activeBoardToPack = activeBoardsGt & (1 << iActiveBit);
330 
331  altNrBxBoardVal = (altNrBxBoardInitial & ( 1 << iActiveBit )) >> iActiveBit;
332 
333  if (altNrBxBoardVal == 1) {
334  m_totalBxInEvent = recordLength1;
335  } else if (altNrBxBoardVal == 0) {
336  m_totalBxInEvent = recordLength0;
337  } else {
338  if (m_verbosity) {
339  edm::LogWarning("L1GTEvmDigiToRaw")
340  << "\n\nWARNING: Wrong value altNrBxBoardVal = " << altNrBxBoardVal
341  << " for board " << std::hex << ( itBoard->gtBoardId() ) << std::dec
342  << "\n iActiveBit = " << iActiveBit
343  << "\n altNrBxBoardInitial = 0x" << std::hex << altNrBxBoardInitial << std::dec
344  << "\n activeBoardsGt = 0x" << std::hex << activeBoardsGt << std::dec
345  << "\n activeBoardToPack = " << activeBoardToPack
346  << "\n Set altNrBxBoardVal tentatively to "
347  << recordLength0 << "\n Job may crash or produce wrong results!\n\n"
348  << std::endl;
349  }
350 
351  m_totalBxInEvent = recordLength0;
352  }
353 
355  m_maxBxInEvent = (m_totalBxInEvent + 1)/2 - 1;
356 
357  } else {
358  // board not in the ActiveBoards for the record
359  continue;
360  }
361 
362  if (activeBoardToPack) {
363 
364  if (m_verbosity && m_isDebugEnabled) {
365  LogDebug("L1GTEvmDigiToRaw")
366  << "\nBoard " << std::hex << "0x" << ( itBoard->gtBoardId() ) << std::dec
367  << "\n Number of bunch crosses in the record: " << m_totalBxInEvent
368  << " = " << "[" << m_minBxInEvent << ", " << m_maxBxInEvent
369  << "] BX\n"
370  << std::endl;
371  }
372 
373  // active board, pack it
374  switch (itBoard->gtBoardType()) {
375 
376  case TCS: {
377 
378  L1TcsWord tcsBlock = gtReadoutRecord->tcsWord();
379  packTCS(evSetup, ptrGt, tcsBlock);
380 
381  if (m_verbosity && m_isDebugEnabled) {
382 
383  std::ostringstream myCoutStream;
384  tcsBlock.print(myCoutStream);
385  LogTrace("L1GTEvmDigiToRaw")
386  << myCoutStream.str() << "\n"
387  << std::endl;
388  }
389 
390  ptrGt += tcsBlock.getSize(); // advance with TCS block size
391 
392  }
393  break;
394  case FDL: {
395 
396  for (int iBxInEvent = m_minBxInEvent; iBxInEvent <= m_maxBxInEvent;
397  ++iBxInEvent) {
398 
399  L1GtFdlWord fdlBlock = gtReadoutRecord->gtFdlWord(iBxInEvent);
400  packFDL(evSetup, ptrGt, fdlBlock);
401 
402  if (m_verbosity && m_isDebugEnabled) {
403 
404  std::ostringstream myCoutStream;
405  fdlBlock.print(myCoutStream);
406  LogTrace("L1GTEvmDigiToRaw")
407  << myCoutStream.str() << "\n"
408  << std::endl;
409  }
410 
411  ptrGt += fdlBlock.getSize(); // advance with FDL block size
412  }
413 
414  }
415  break;
416  default: {
417 
418  // do nothing, all blocks are given in GtBoardType enum
419  break;
420  }
421  }
422 
423  }
424  }
425 
426  // pack trailer
427  packTrailer(ptrGt, ptrGtBegin, gtDataSize);
428 
429  // put the raw data in the event
430 
431  iEvent.put(std::move(allFedRawData));
432 
433 
434 }
435 
436 
437 // pack header
438 void L1GTEvmDigiToRaw::packHeader(unsigned char* ptrGt, edm::Event& iEvent)
439 {
440  // TODO FIXME where from to get all numbers?
441 
442  // Event Trigger type identifier
443  int triggerTypeVal = 0;
444 
445  // Level-1 event number generated by the TTC system
446  int lvl1IdVal = iEvent.id().event();
447 
448  // The bunch crossing number
449  int bxCross = iEvent.bunchCrossing();
450  cms_uint16_t bxCrossHw = 0;
451  if ((bxCross & 0xFFF) == bxCross) {
452  bxCrossHw = static_cast<cms_uint16_t> (bxCross);
453  }
454  else {
455  bxCrossHw = 0; // Bx number too large, set to 0!
456  if (m_verbosity && m_isDebugEnabled) {
457  LogDebug("L1GTEvmDigiToRaw")
458  << "\nBunch cross number [hex] = "
459  << std::hex << bxCross
460  << "\n larger than 12 bits. Set to 0! \n"
461  << std::dec
462  << std::endl;
463  }
464  }
465  int bxIdVal = bxCrossHw;
466 
467  // Identifier of the FED
468  int sourceIdVal = m_evmGtFedId;
469 
470  // Version identifier of the FED data format
471  int versionVal = 0;
472 
473  // 0 -> the current header word is the last one.
474  // 1-> other header words can follow
475  // (always 1 for ECAL)
476  bool moreHeadersVal = false;
477 
478 
479  FEDHeader gtFEDHeader(ptrGt);
480 
481  gtFEDHeader.set(ptrGt,
482  triggerTypeVal, lvl1IdVal, bxIdVal, sourceIdVal, versionVal,
483  moreHeadersVal);
484 
485 
486 }
487 
488 // pack the GTFE block
490  const edm::EventSetup& evSetup,
491  unsigned char* ptrGt,
492  L1GtfeExtWord& gtfeBlock,
493  cms_uint16_t activeBoardsGtValue)
494 {
495 
496  if (m_verbosity && m_isDebugEnabled) {
497  LogDebug("L1GTEvmDigiToRaw") << "\nPacking GTFE \n" << std::endl;
498  }
499 
501 
502  // initialize the required number of word64
503  int nrWord64 = gtfeBlock.getSize()/uLength;
504  std::vector<cms_uint64_t> tmpWord64;
505  tmpWord64.resize(nrWord64);
506 
507  for (int iWord = 0; iWord < nrWord64; ++iWord) {
508  tmpWord64[iWord] = 0x0000000000000000ULL;
509  }
510 
511  // fill the values in the words
512  for (int iWord = 0; iWord < nrWord64; ++iWord) {
513 
514  gtfeBlock.setBoardIdWord64(tmpWord64[iWord], iWord);
515  gtfeBlock.setRecordLength1Word64(tmpWord64[iWord], iWord);
516  gtfeBlock.setRecordLengthWord64(tmpWord64[iWord], iWord);
517  gtfeBlock.setBxNrWord64(tmpWord64[iWord], iWord);
518  gtfeBlock.setSetupVersionWord64(tmpWord64[iWord], iWord);
519  gtfeBlock.setActiveBoardsWord64(tmpWord64[iWord], iWord, activeBoardsGtValue);
520  gtfeBlock.setAltNrBxBoardWord64(tmpWord64[iWord], iWord);
521  gtfeBlock.setTotalTriggerNrWord64(tmpWord64[iWord], iWord);
522 
523  for (int iBst = 0; iBst < m_bstLengthBytes; ++iBst) {
524  gtfeBlock.setBstWord64(tmpWord64[iWord], iBst, iWord);
525  }
526 
527  }
528 
529  // put the words in the FED record
530 
531  cms_uint64_t* pw =
532  reinterpret_cast<cms_uint64_t*>(const_cast<unsigned char*>(ptrGt));
533 
534  for (int iWord = 0; iWord < nrWord64; ++iWord) {
535 
536  *pw++ = tmpWord64[iWord];
537 
538  if (m_verbosity && m_isDebugEnabled) {
539  LogTrace("L1GTEvmDigiToRaw")
540  << std::setw(4) << iWord << " "
541  << std::hex << std::setfill('0')
542  << std::setw(16) << tmpWord64[iWord]
543  << std::dec << std::setfill(' ')
544  << std::endl;
545  }
546  }
547 
548 
549 }
550 
551 // pack the TCS block
553  const edm::EventSetup& evSetup,
554  unsigned char* ptrGt,
555  L1TcsWord& tcsBlock)
556 {
557 
558  if (m_verbosity && m_isDebugEnabled) {
559  LogDebug("L1GTEvmDigiToRaw") << "\nPacking TCS \n" << std::endl;
560  }
561 
563 
564  // initialize the required number of word64
565  int nrWord64 = tcsBlock.getSize()/uLength;
566  std::vector<cms_uint64_t> tmpWord64;
567  tmpWord64.resize(nrWord64);
568 
569  for (int iWord = 0; iWord < nrWord64; ++iWord) {
570  tmpWord64[iWord] = 0x0000000000000000ULL;
571  }
572 
573  // fill the values in the words
574  for (int iWord = 0; iWord < nrWord64; ++iWord) {
575 
576  tcsBlock.setBoardIdWord64(tmpWord64[iWord], iWord);
577  tcsBlock.setBxNrWord64(tmpWord64[iWord], iWord);
578  tcsBlock.setDaqNrWord64(tmpWord64[iWord], iWord);
579  tcsBlock.setTriggerTypeWord64(tmpWord64[iWord], iWord);
580  tcsBlock.setStatusWord64(tmpWord64[iWord], iWord);
581  tcsBlock.setLuminositySegmentNrWord64(tmpWord64[iWord], iWord);
582 
583  tcsBlock.setPartRunNrWord64(tmpWord64[iWord], iWord);
584  tcsBlock.setAssignedPartitionsWord64(tmpWord64[iWord], iWord);
585 
586  tcsBlock.setPartTrigNrWord64(tmpWord64[iWord], iWord);
587  tcsBlock.setEventNrWord64(tmpWord64[iWord], iWord);
588 
589  tcsBlock.setOrbitNrWord64(tmpWord64[iWord], iWord);
590 
591  }
592 
593  // put the words in the FED record
594 
595  cms_uint64_t* pw =
596  reinterpret_cast<cms_uint64_t*>(const_cast<unsigned char*>(ptrGt));
597 
598  for (int iWord = 0; iWord < nrWord64; ++iWord) {
599 
600  *pw++ = tmpWord64[iWord];
601 
602  if (m_verbosity && m_isDebugEnabled) {
603  LogTrace("L1GTEvmDigiToRaw")
604  << std::setw(4) << iWord << " "
605  << std::hex << std::setfill('0')
606  << std::setw(16) << tmpWord64[iWord]
607  << std::dec << std::setfill(' ')
608  << std::endl;
609  }
610  }
611 
612 
613 }
614 
615 // pack the FDL block
617  const edm::EventSetup& evSetup,
618  unsigned char* ptrGt,
619  L1GtFdlWord& fdlBlock)
620 {
621 
622  if (m_verbosity && m_isDebugEnabled) {
623  LogDebug("L1GTEvmDigiToRaw") << "\nPacking FDL \n" << std::endl;
624  }
625 
627 
628  // initialize the required number of word64
629  int nrWord64 = fdlBlock.getSize()/uLength;
630  std::vector<cms_uint64_t> tmpWord64;
631  tmpWord64.resize(nrWord64);
632 
633  for (int iWord = 0; iWord < nrWord64; ++iWord) {
634  tmpWord64[iWord] = 0x0000000000000000ULL;
635  }
636 
637  // fill the values in the words
638  for (int iWord = 0; iWord < nrWord64; ++iWord) {
639 
640  fdlBlock.setBoardIdWord64(tmpWord64[iWord], iWord);
641  fdlBlock.setBxInEventWord64(tmpWord64[iWord], iWord);
642  fdlBlock.setBxNrWord64(tmpWord64[iWord], iWord);
643  fdlBlock.setEventNrWord64(tmpWord64[iWord], iWord);
644 
645  fdlBlock.setGtTechnicalTriggerWordWord64(tmpWord64[iWord], iWord);
646 
647  fdlBlock.setGtDecisionWordAWord64(tmpWord64[iWord], iWord);
648  fdlBlock.setGtDecisionWordBWord64(tmpWord64[iWord], iWord);
649 
650  fdlBlock.setGtDecisionWordExtendedWord64(tmpWord64[iWord], iWord);
651 
652  fdlBlock.setPhysicsDeclaredWord64(tmpWord64[iWord], iWord);
653  fdlBlock.setGtPrescaleFactorIndexTechWord64(tmpWord64[iWord], iWord);
654  fdlBlock.setGtPrescaleFactorIndexAlgoWord64(tmpWord64[iWord], iWord);
655  fdlBlock.setNoAlgoWord64(tmpWord64[iWord], iWord);
656  fdlBlock.setFinalORWord64(tmpWord64[iWord], iWord);
657 
658  fdlBlock.setOrbitNrWord64(tmpWord64[iWord], iWord);
659  fdlBlock.setLumiSegmentNrWord64(tmpWord64[iWord], iWord);
660  fdlBlock.setLocalBxNrWord64(tmpWord64[iWord], iWord);
661 
662  }
663 
664  // put the words in the FED record
665 
666  cms_uint64_t* pw =
667  reinterpret_cast<cms_uint64_t*>(const_cast<unsigned char*>(ptrGt));
668 
669  for (int iWord = 0; iWord < nrWord64; ++iWord) {
670 
671  *pw++ = tmpWord64[iWord];
672 
673  if (m_verbosity && m_isDebugEnabled) {
674  LogTrace("L1GTEvmDigiToRaw")
675  << std::setw(4) << iWord << " "
676  << std::hex << std::setfill('0')
677  << std::setw(16) << tmpWord64[iWord]
678  << std::dec << std::setfill(' ')
679  << std::endl;
680  }
681  }
682 
683 }
684 
685 
686 // pack trailer
687 void L1GTEvmDigiToRaw::packTrailer(unsigned char* ptrGt,
688  unsigned char* ptrGtBegin, int dataSize)
689 {
690 
691  // TODO FIXME where from to get all numbers?
692 
693  // The length of the event fragment counted in 64-bit words including header and trailer
694  int lengthVal = dataSize/8;
695 
696  // Cyclic Redundancy Code of the event fragment including header and trailer
697  int crcVal = evf::compute_crc(ptrGtBegin, dataSize);
698 
699  // Event fragment status information
700  int evtStatusVal = 0;
701 
702  // Current value of the Trigger Throttling System bits.
703  int ttsBitsVal = 0;
704 
705  // 0 -> the current trailer word is the last one.
706  // 1-> other trailer words can follow
707  // (always 0 for ECAL)
708  bool moreTrailersVal = false;
709 
710  FEDTrailer gtFEDTrailer(ptrGt);
711  gtFEDTrailer.set(ptrGt,
712  lengthVal, crcVal, evtStatusVal, ttsBitsVal,
713  moreTrailersVal);
714 
715 }
716 
717 
718 
719 // static class members
#define LogDebug(id)
EventNumber_t event() const
Definition: EventID.h:41
bool isDebugEnabled()
void packHeader(unsigned char *, edm::Event &)
block packers -------——
const bool m_isDebugEnabled
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
void setRecordLength1Word64(cms_uint64_t &word64, int iWord)
Definition: L1GtfeWord.cc:138
void setBoardIdWord64(cms_uint64_t &word64, int iWord)
Definition: L1TcsWord.cc:156
void setNoAlgoWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:642
void setBxNrWord64(cms_uint64_t &word64, int iWord)
Definition: L1TcsWord.cc:176
int m_totalBxInEvent
total Bx&#39;s in the event, obtained from GTFE block
void setGtDecisionWordBWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:471
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
static const int UnitLength
one unit in the word is UnitLength bits
cms_uint16_t m_activeBoardsMaskGt
mask for active boards
void print(std::ostream &myCout) const override
pretty print the content of a L1GtfeExtWord
const edm::InputTag m_evmGtInputTag
const L1GtfeExtWord gtfeWord() const
get / set GTFE word (record) in the GT readout record
const L1TcsWord tcsWord() const
get / set TCS word (record) in the GT readout record
int m_bstLengthBytes
length of BST record (in bytes)
int bunchCrossing() const
Definition: EventBase.h:64
void setBoardIdWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:196
void setLumiSegmentNrWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:700
const int m_verbosity
verbosity level
void setActiveBoardsWord64(cms_uint64_t &word64, int iWord)
Definition: L1GtfeWord.cc:231
void print(std::ostream &myCout) const
pretty print the content of a L1GlobalTriggerEvmReadoutRecord
const unsigned int bstLengthBytes() const
get the size of the BST block
Definition: L1GtfeExtWord.h:74
void setSetupVersionWord64(cms_uint64_t &word64, int iWord)
Definition: L1GtfeWord.cc:194
void setAssignedPartitionsWord64(cms_uint64_t &word64, int iWord)
Definition: L1TcsWord.cc:305
const unsigned int getSize() const
get the size of the FDL block in GT DAQ record (in multiple of 8 bits)
Definition: L1GtFdlWord.h:392
void setOrbitNrWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:682
const cms_uint16_t altNrBxBoard() const
get/set alternative for number of BX per board
Definition: L1GtfeWord.h:187
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
void setOrbitNrWord64(cms_uint64_t &word64, int iWord)
Definition: L1TcsWord.cc:372
void setGtTechnicalTriggerWordWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:311
void setBstWord64(cms_uint64_t &word64, int iB, const int iWord)
const unsigned int getSize() const
get the size of the GTFE block in GT EVM record (in multiple of 8 bits)
void setTriggerTypeWord64(cms_uint64_t &word64, int iWord)
Definition: L1TcsWord.cc:217
void packTrailer(unsigned char *, unsigned char *, int)
pack trailer word
const cms_uint16_t recordLength() const
get/set record length for alternative 0
Definition: L1GtfeWord.h:104
int iEvent
Definition: GenABIO.cc:224
void setGtPrescaleFactorIndexTechWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:603
void print(std::ostream &myCout) const
pretty print the content of a L1TcsWord
Definition: L1TcsWord.cc:403
static void set(unsigned char *trailer, uint32_t lenght, uint16_t crc, uint8_t evt_stat, uint8_t tts, bool moreTrailers=false)
Set all fields in the trailer.
Definition: FEDTrailer.cc:60
void resize(size_t newsize)
Definition: FEDRawData.cc:32
void setBxInEventWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:217
unsigned short compute_crc(unsigned char *buffer, unsigned int bufSize)
Definition: CRC16.h:46
void setPhysicsDeclaredWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:584
void setEventNrWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:258
unsigned short cms_uint16_t
Definition: typedefs.h:13
void packGTFE(const edm::EventSetup &, unsigned char *, L1GtfeExtWord &, cms_uint16_t activeBoardsGtValue)
void setBxNrWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:239
void setBoardIdWord64(cms_uint64_t &word64, int iWord)
Definition: L1GtfeWord.cc:120
void setLuminositySegmentNrWord64(cms_uint64_t &word64, int iWord)
Definition: L1TcsWord.cc:260
bool isValid() const
Definition: HandleBase.h:74
const cms_uint16_t activeBoards() const
get/set boards contributing to EVM respectively DAQ record
Definition: L1GtfeWord.h:163
#define LogTrace(id)
void print(std::ostream &myCout) const
pretty print the content of a L1GtFdlWord
Definition: L1GtFdlWord.cc:766
void setAltNrBxBoardWord64(cms_uint64_t &word64, int iWord)
Definition: L1GtfeWord.cc:263
void packTCS(const edm::EventSetup &evSetup, unsigned char *ptrGt, L1TcsWord &tcsBlock)
pack the TCS block
void setGtDecisionWordExtendedWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:545
void setLocalBxNrWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:719
void setGtDecisionWordAWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:435
const unsigned int getSize() const
get the size of the TCS block in GT EVM record (in multiple of 8 bits)
Definition: L1TcsWord.h:285
edm::EventID id() const
Definition: EventBase.h:59
void setEventNrWord64(cms_uint64_t &word64, int iWord)
Definition: L1TcsWord.cc:350
HLT enums.
void setPartRunNrWord64(cms_uint64_t &word64, int iWord)
Definition: L1TcsWord.cc:282
const std::vector< L1GtBoard > & gtBoardMaps() const
get / set / print the L1 GT board map
Definition: L1GtBoardMaps.h:47
void setBxNrWord64(cms_uint64_t &word64, int iWord)
Definition: L1GtfeWord.cc:176
T get() const
Definition: EventSetup.h:71
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
void produce(edm::Event &, const edm::EventSetup &) override
loop over events
void setPartTrigNrWord64(cms_uint64_t &word64, int iWord)
Definition: L1TcsWord.cc:328
void packFDL(const edm::EventSetup &, unsigned char *, L1GtFdlWord &)
pack FDL blocks for various bunch crosses
static void set(unsigned char *header, uint8_t triggerType, uint32_t lvl1ID, uint16_t bxID, uint16_t sourceID, uint8_t version=0, bool moreHeaders=false)
Set all fields in the header.
Definition: FEDHeader.cc:47
void setFinalORWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:664
L1GTEvmDigiToRaw(const edm::ParameterSet &)
constructor(s)
unsigned long long cms_uint64_t
Definition: typedefs.h:17
void setDaqNrWord64(cms_uint64_t &word64, int iWord)
Definition: L1TcsWord.cc:197
void setTotalTriggerNrWord64(cms_uint64_t &word64, int iWord)
Definition: L1GtfeWord.cc:293
void setGtPrescaleFactorIndexAlgoWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:623
const cms_uint16_t recordLength1() const
get/set record length for alternative 1
Definition: L1GtfeWord.h:85
const L1GtFdlWord gtFdlWord(int bxInEvent) const
get / set FDL word (record) in the GT readout record
void setRecordLengthWord64(cms_uint64_t &word64, int iWord)
Definition: L1GtfeWord.cc:157
def move(src, dest)
Definition: eostools.py:511
const edm::EDGetTokenT< L1GlobalTriggerEvmReadoutRecord > m_evmGtInputToken
input tag for GT EVM record
void setStatusWord64(cms_uint64_t &word64, int iWord)
Definition: L1TcsWord.cc:238