CMS 3D CMS Logo

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