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