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