CMS 3D CMS Logo

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