CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
L1GlobalTriggerRawToDigi Class Reference

#include <L1GlobalTriggerRawToDigi.h>

Inheritance diagram for L1GlobalTriggerRawToDigi:
edm::stream::EDProducer<>

Public Member Functions

 L1GlobalTriggerRawToDigi (const edm::ParameterSet &)
 constructor(s) More...
 
 ~L1GlobalTriggerRawToDigi () override
 destructor More...
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

void dumpFedRawData (const unsigned char *, int, std::ostream &)
 dump FED raw data More...
 
void produce (edm::Event &, const edm::EventSetup &) override
 
void produceEmptyProducts (edm::Event &)
 produce empty products in case of problems More...
 
void unpackGMT (const unsigned char *, std::unique_ptr< L1MuGMTReadoutCollection > &, edm::Event &)
 unpack the GMT record More...
 
void unpackHeader (const unsigned char *, FEDHeader &)
 block unpackers More...
 
void unpackPSB (const edm::EventSetup &, const unsigned char *, L1GtPsbWord &)
 
void unpackTrailer (const unsigned char *, FEDTrailer &)
 unpack trailer word More...
 

Private Attributes

cms_uint16_t m_activeBoardsMaskGt
 mask for active boards More...
 
int m_daqGtFedId
 
edm::InputTag m_daqGtInputTag
 input tags for GT DAQ record More...
 
L1GtFdlWordm_gtFdlWord
 
L1GtfeWordm_gtfeWord
 
L1GtPsbWordm_gtPsbWord
 
bool m_isDebugEnabled
 
int m_lowSkipBxInEvent
 
int m_recordLength0
 total Bx's in the event, obtained from GTFE block More...
 
int m_recordLength1
 corresponding to alternative 1 in altNrBxBoard() More...
 
int m_totalBxInEvent
 number of Bx for a board, obtained from GTFE block (record length & alternative) More...
 
const L1MuTriggerPtScalem_TriggerPtScale
 
const L1MuTriggerScalesm_TriggerScales
 muon trigger scales to convert unpacked data into physical quantities More...
 
int m_unpackBxInEvent
 
int m_uppSkipBxInEvent
 
int m_verbosity
 verbosity level More...
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Description: unpack raw data into digitized data.

Implementation: <TODO: enter implementation details>

Author
: Vasile Mihai Ghete - HEPHY Vienna - GT
: Ivan Mikulec - HEPHY Vienna - GMT

Definition at line 48 of file L1GlobalTriggerRawToDigi.h.

Constructor & Destructor Documentation

L1GlobalTriggerRawToDigi::L1GlobalTriggerRawToDigi ( const edm::ParameterSet pSet)
explicit

constructor(s)

Definition at line 64 of file L1GlobaTriggerRawToDigi.cc.

References TauDecayModes::dec, LogDebug, m_activeBoardsMaskGt, m_daqGtFedId, m_daqGtInputTag, m_gtFdlWord, m_gtfeWord, m_gtPsbWord, m_isDebugEnabled, m_unpackBxInEvent, and m_verbosity.

65  :
66 
67  // input tag for DAQ GT record
68  m_daqGtInputTag(pSet.getParameter<edm::InputTag>("DaqGtInputTag")),
69 
70  // FED Id for GT DAQ record
71  // default value defined in DataFormats/FEDRawData/src/FEDNumbering.cc
72  // default value: assume the DAQ record is the last GT record
74 
75  // mask for active boards
76  m_activeBoardsMaskGt(pSet.getParameter<unsigned int>("ActiveBoardsMask")),
77 
78  // number of bunch crossing to be unpacked
79  m_unpackBxInEvent(pSet.getParameter<int>("UnpackBxInEvent")),
80 
81  // create GTFE, FDL, PSB cards once per producer
82  // content will be reset whenever needed
83 
86 
87  m_recordLength0(0),
88  m_recordLength1(0),
89 
91  m_verbosity(pSet.getUntrackedParameter<int>("Verbosity", 0)),
92 
94 
95 {
96  produces<L1GlobalTriggerReadoutRecord>();
97  produces<L1MuGMTReadoutCollection>();
98 
99  produces<std::vector<L1MuRegionalCand> >("DT");
100  produces<std::vector<L1MuRegionalCand> >("CSC");
101  produces<std::vector<L1MuRegionalCand> >("RPCb");
102  produces<std::vector<L1MuRegionalCand> >("RPCf");
103  produces<std::vector<L1MuGMTCand> >();
104  consumes<FEDRawDataCollection>(m_daqGtInputTag);
105 
106  // create GTFE, FDL, PSB cards once per producer
107  // content will be reset whenever needed
108  m_gtfeWord = new L1GtfeWord();
109  m_gtFdlWord = new L1GtFdlWord();
110  m_gtPsbWord = new L1GtPsbWord();
111 
112  if (m_verbosity && m_isDebugEnabled) {
113  LogDebug("L1GlobalTriggerRawToDigi") << "\nInput tag for DAQ GT record: " << m_daqGtInputTag
114  << "\nFED Id for DAQ GT record: " << m_daqGtFedId
115  << "\nMask for active boards (hex format): " << std::hex
116  << std::setw(sizeof(m_activeBoardsMaskGt) * 2) << std::setfill('0')
117  << m_activeBoardsMaskGt << std::dec << std::setfill(' ')
118  << "\nNumber of bunch crossing to be unpacked: " << m_unpackBxInEvent << "\n"
119  << std::endl;
120  }
121 
122  if ((m_unpackBxInEvent > 0) && ((m_unpackBxInEvent % 2) == 0)) {
124 
125  if (m_verbosity) {
126  edm::LogInfo("L1GlobalTriggerRawToDigi")
127  << "\nWARNING: Number of bunch crossing to be unpacked rounded to: " << m_unpackBxInEvent
128  << "\n The number must be an odd number!\n"
129  << std::endl;
130  }
131  }
132 }
#define LogDebug(id)
T getParameter(std::string const &) const
bool isDebugEnabled()
T getUntrackedParameter(std::string const &, T const &) const
cms_uint16_t m_activeBoardsMaskGt
mask for active boards
int m_recordLength0
total Bx&#39;s in the event, obtained from GTFE block
int m_recordLength1
corresponding to alternative 1 in altNrBxBoard()
edm::InputTag m_daqGtInputTag
input tags for GT DAQ record
int m_totalBxInEvent
number of Bx for a board, obtained from GTFE block (record length & alternative)
L1GlobalTriggerRawToDigi::~L1GlobalTriggerRawToDigi ( )
override

destructor

Definition at line 135 of file L1GlobaTriggerRawToDigi.cc.

References m_gtFdlWord, m_gtfeWord, and m_gtPsbWord.

135  {
136  delete m_gtfeWord;
137  delete m_gtFdlWord;
138  delete m_gtPsbWord;
139 }

Member Function Documentation

void L1GlobalTriggerRawToDigi::dumpFedRawData ( const unsigned char *  gtPtr,
int  gtSize,
std::ostream &  myCout 
)
private

dump FED raw data

Definition at line 977 of file L1GlobaTriggerRawToDigi.cc.

References TauDecayModes::dec, mps_fire::i, LogDebug, LogTrace, jets_cff::payload, L1GlobalTriggerReadoutSetup::UnitLength, and L1GlobalTriggerReadoutSetup::WordLength.

Referenced by produce().

977  {
978  LogDebug("L1GlobalTriggerRawToDigi") << "\nDump FED raw data.\n" << std::endl;
979 
982 
983  int gtWords = gtSize / uLength;
984  LogTrace("L1GlobalTriggerRawToDigi") << "\nFED GT words (" << wLength << " bits):" << gtWords << "\n" << std::endl;
985 
986  const cms_uint64_t* payload = reinterpret_cast<cms_uint64_t*>(const_cast<unsigned char*>(gtPtr));
987 
988  for (unsigned int i = 0; i < gtSize / sizeof(cms_uint64_t); i++) {
989  myCout << std::setw(4) << i << " " << std::hex << std::setfill('0') << std::setw(16) << payload[i] << std::dec
990  << std::setfill(' ') << std::endl;
991  }
992 }
#define LogDebug(id)
static const int UnitLength
one unit in the word is UnitLength bits
static const int WordLength
GT DAQ record organized in words of WordLength bits.
#define LogTrace(id)
unsigned long long cms_uint64_t
Definition: typedefs.h:17
void L1GlobalTriggerRawToDigi::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 141 of file L1GlobaTriggerRawToDigi.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), edm::ParameterSetDescription::addUntracked(), HLT_2018_cff::InputTag, and FEDNumbering::MAXTriggerGTPFEDID.

141  {
143  static const char* const kComm1 =
144  "# input tag for GT readout collection: \n"
145  "# source = hardware record, \n"
146  "# l1GtPack = GT packer (DigiToRaw)";
147  desc.add<edm::InputTag>("DaqGtInputTag", edm::InputTag("l1GtPack"))->setComment(kComm1);
148  static const char* const kComm2 =
149  "# FED Id for GT DAQ record \n"
150  "# default value defined in DataFormats/FEDRawData/src/FEDNumbering.cc";
151  desc.addUntracked<int>("DaqGtFedId", FEDNumbering::MAXTriggerGTPFEDID)->setComment(kComm2);
152  static const char* const kComm3 =
153  "# mask for active boards (actually 16 bits) \n"
154  "# if bit is zero, the corresponding board will not be unpacked \n"
155  "# default: no board masked";
156  desc.add<unsigned int>("ActiveBoardsMask", 0xFFFF)->setComment(kComm3);
157  static const char* const kComm4 =
158  "# number of 'bunch crossing in the event' (bxInEvent) to be unpacked \n"
159  "# symmetric around L1Accept (bxInEvent = 0): \n"
160  "# 1 (bxInEvent = 0); 3 (F 0 1) (standard record); 5 (E F 0 1 2) (debug record) \n"
161  "# even numbers (except 0) 'rounded' to the nearest lower odd number \n"
162  "# negative value: unpack all available bxInEvent \n"
163  "# if more bxInEvent than available are required, unpack what exists and write a warning";
164  desc.add<int>("UnpackBxInEvent", -1)->setComment(kComm4);
165  desc.addUntracked<int>("Verbosity", 0);
166  descriptions.add("l1GlobalTriggerRawToDigi", desc);
167 }
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void L1GlobalTriggerRawToDigi::produce ( edm::Event iEvent,
const edm::EventSetup evSetup 
)
overrideprivate

Definition at line 172 of file L1GlobaTriggerRawToDigi.cc.

References L1GtfeWord::activeBoards(), L1GtfeWord::altNrBxBoard(), FEDRawData::data(), TauDecayModes::dec, dumpFedRawData(), FDL, edm::EventSetup::get(), edm::Event::getByLabel(), L1GtPsbWord::getSize(), L1GtfeWord::getSize(), L1GtFdlWord::getSize(), GMT, L1GtBoardMaps::gtBoardMaps(), GTFE, edm::HandleBase::isValid(), LogDebug, LogTrace, L1GtFdlWord::lumiSegmentNr(), m_activeBoardsMaskGt, m_daqGtFedId, m_daqGtInputTag, m_gtFdlWord, m_gtfeWord, m_gtPsbWord, m_isDebugEnabled, m_lowSkipBxInEvent, m_recordLength0, m_recordLength1, m_totalBxInEvent, m_TriggerPtScale, m_TriggerScales, m_unpackBxInEvent, m_uppSkipBxInEvent, m_verbosity, SiStripPI::max, eostools::move(), L1GtPsbWord::print(), L1GtfeWord::print(), L1GtFdlWord::print(), produceEmptyProducts(), edm::Handle< T >::product(), edm::ESHandle< T >::product(), PSB, edm::Event::put(), L1GtfeWord::recordLength(), L1GtfeWord::recordLength1(), L1GtPsbWord::reset(), L1GtfeWord::reset(), L1GtFdlWord::reset(), L1GtfeWord::setActiveBoards(), L1GtFdlWord::setLumiSegmentNr(), L1GtfeWord::setRecordLength(), L1GtfeWord::setRecordLength1(), FEDRawData::size(), TCS, TIM, L1GtfeWord::unpack(), L1GtFdlWord::unpack(), unpackGMT(), unpackHeader(), unpackPSB(), and unpackTrailer().

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

172  {
173  // get records from EventSetup
174 
175  // muon trigger scales
177  evSetup.get<L1MuTriggerScalesRcd>().get(trigscales_h);
178  m_TriggerScales = trigscales_h.product();
179 
180  edm::ESHandle<L1MuTriggerPtScale> trigptscale_h;
181  evSetup.get<L1MuTriggerPtScaleRcd>().get(trigptscale_h);
182  m_TriggerPtScale = trigptscale_h.product();
183 
184  // board maps
186  evSetup.get<L1GtBoardMapsRcd>().get(l1GtBM);
187 
188  const std::vector<L1GtBoard> boardMaps = l1GtBM->gtBoardMaps();
189  int boardMapsSize = boardMaps.size();
190 
191  typedef std::vector<L1GtBoard>::const_iterator CItBoardMaps;
192 
193  // create an ordered vector for the GT DAQ record
194  // header (pos 0 in record) and trailer (last position in record)
195  // not included, as they are not in board list
196  std::vector<L1GtBoard> gtRecordMap;
197  gtRecordMap.reserve(boardMapsSize);
198 
199  for (int iPos = 0; iPos < boardMapsSize; ++iPos) {
200  for (CItBoardMaps itBoard = boardMaps.begin(); itBoard != boardMaps.end(); ++itBoard) {
201  if (itBoard->gtPositionDaqRecord() == iPos) {
202  gtRecordMap.push_back(*itBoard);
203  break;
204  }
205  }
206  }
207 
208  // raw collection
209 
211  iEvent.getByLabel(m_daqGtInputTag, fedHandle);
212 
213  if (!fedHandle.isValid()) {
214  if (m_verbosity) {
215  edm::LogWarning("L1GlobalTriggerRawToDigi")
216  << "\nWarning: FEDRawDataCollection with input tag " << m_daqGtInputTag
217  << "\nrequested in configuration, but not found in the event."
218  << "\nQuit unpacking this event" << std::endl;
219  }
220 
221  produceEmptyProducts(iEvent);
222 
223  return;
224  }
225 
226  // retrieve data for Global Trigger FED (GT + GMT)
227  const FEDRawData& raw = (fedHandle.product())->FEDData(m_daqGtFedId);
228 
229  int gtSize = raw.size();
230 
231  // get a const pointer to the beginning of the data buffer
232  const unsigned char* ptrGt = raw.data();
233 
234  // get a const pointer to the end of the data buffer
235  const unsigned char* endPtrGt = ptrGt + gtSize;
236 
237  //
238  if (m_verbosity && m_isDebugEnabled) {
239  LogTrace("L1GlobalTriggerRawToDigi") << "\n Size of raw data: " << gtSize << "\n" << std::endl;
240 
241  std::ostringstream myCoutStream;
242  dumpFedRawData(ptrGt, gtSize, myCoutStream);
243 
244  LogTrace("L1GlobalTriggerRawToDigi") << "\n Dump FEDRawData\n" << myCoutStream.str() << "\n" << std::endl;
245  }
246 
247  // unpack header (we have one header only)
248  int headerSize = 8;
249 
250  if ((ptrGt + headerSize) > endPtrGt) {
251  // a common error - no need to print an error anymore
252  produceEmptyProducts(iEvent);
253 
254  return;
255  }
256 
257  FEDHeader cmsHeader(ptrGt);
258  FEDTrailer cmsTrailer(ptrGt + gtSize - headerSize);
259 
260  unpackHeader(ptrGt, cmsHeader);
261  ptrGt += headerSize; // advance with header size
262 
263  // unpack first GTFE to find the length of the record and the active boards
264  // here GTFE assumed immediately after the header
265 
266  // if pointer after GTFE payload is greater than pointer at
267  // the end of GT payload, produce empty products and quit unpacking
268  if ((ptrGt + m_gtfeWord->getSize()) > endPtrGt) {
269  edm::LogError("L1GlobalTriggerRawToDigi") << "\nError: Pointer after GTFE greater than end pointer."
270  << "\n Put empty products in the event!"
271  << "\n Quit unpacking this event." << std::endl;
272 
273  produceEmptyProducts(iEvent);
274 
275  return;
276  }
277 
278  bool gtfeUnpacked = false;
279 
280  for (CItBoardMaps itBoard = boardMaps.begin(); itBoard != boardMaps.end(); ++itBoard) {
281  if (itBoard->gtBoardType() == GTFE) {
282  // unpack GTFE
283  if (itBoard->gtPositionDaqRecord() == 1) {
284  m_gtfeWord->unpack(ptrGt);
285  ptrGt += m_gtfeWord->getSize(); // advance with GTFE block size
286  gtfeUnpacked = true;
287 
288  if (m_verbosity && m_isDebugEnabled) {
289  std::ostringstream myCoutStream;
290  m_gtfeWord->print(myCoutStream);
291  LogTrace("L1GlobalTriggerRawToDigi") << myCoutStream.str() << "\n" << std::endl;
292  }
293 
294  // break the loop - GTFE was found
295  break;
296 
297  } else {
298  if (m_verbosity) {
299  edm::LogWarning("L1GlobalTriggerRawToDigi")
300  << "\nWarning: GTFE block found in raw data does not follow header."
301  << "\nAssumed start position of the block is wrong!"
302  << "\nQuit unpacking this event" << std::endl;
303  }
304 
305  produceEmptyProducts(iEvent);
306 
307  return;
308  }
309  }
310  }
311 
312  // quit if no GTFE found
313  if (!gtfeUnpacked) {
314  if (m_verbosity) {
315  edm::LogWarning("L1GlobalTriggerRawToDigi")
316  << "\nWarning: no GTFE block found in raw data."
317  << "\nCan not find the record length (BxInEvent) and the active boards!"
318  << "\nQuit unpacking this event" << std::endl;
319  }
320 
321  produceEmptyProducts(iEvent);
322 
323  return;
324  }
325 
326  // life normal here, GTFE found
327 
328  // get list of active blocks
329  // blocks not active are not written to the record
330  cms_uint16_t activeBoardsGtInitial = m_gtfeWord->activeBoards();
331  cms_uint16_t altNrBxBoardInitial = m_gtfeWord->altNrBxBoard();
332 
333  // mask some boards, if needed
334  cms_uint16_t activeBoardsGt = activeBoardsGtInitial & m_activeBoardsMaskGt;
335  m_gtfeWord->setActiveBoards(activeBoardsGt);
336 
337  if (m_verbosity) {
338  LogDebug("L1GlobalTriggerRawToDigi") << "\nActive boards before masking: 0x" << std::hex
339  << std::setw(sizeof(activeBoardsGtInitial) * 2) << std::setfill('0')
340  << activeBoardsGtInitial << std::dec << std::setfill(' ')
341  << "\nActive boards after masking: 0x" << std::hex
342  << std::setw(sizeof(activeBoardsGt) * 2) << std::setfill('0') << activeBoardsGt
343  << std::dec << std::setfill(' ') << " \n"
344  << std::endl;
345  }
346 
347  // loop over other blocks in the raw record, count them if they are active
348 
349  int numberGtfeBoards = 0;
350  int numberFdlBoards = 0;
351  int numberPsbBoards = 0;
352  int numberGmtBoards = 0;
353  int numberTcsBoards = 0;
354  int numberTimBoards = 0;
355 
356  for (CItBoardMaps itBoard = boardMaps.begin(); itBoard != boardMaps.end(); ++itBoard) {
357  int iActiveBit = itBoard->gtBitDaqActiveBoards();
358  bool activeBoardToUnpack = false;
359 
360  if (iActiveBit >= 0) {
361  activeBoardToUnpack = activeBoardsGt & (1 << iActiveBit);
362  } else {
363  // board not in the ActiveBoards for the record
364  continue;
365  }
366 
367  if (activeBoardToUnpack) {
368  switch (itBoard->gtBoardType()) {
369  case GTFE: {
370  numberGtfeBoards++;
371  }
372 
373  break;
374  case FDL: {
375  numberFdlBoards++;
376  }
377 
378  break;
379  case PSB: {
380  numberPsbBoards++;
381  }
382 
383  break;
384  case GMT: {
385  numberGmtBoards++;
386  }
387 
388  break;
389  case TCS: {
390  numberTcsBoards++;
391  }
392 
393  break;
394  case TIM: {
395  numberTimBoards++;
396  }
397 
398  break;
399  default: {
400  // do nothing, all blocks are given in GtBoardType enum
401  if (m_verbosity) {
402  LogDebug("L1GlobalTriggerRawToDigi")
403  << "\nBoard of type " << itBoard->gtBoardType() << " not expected in record.\n"
404  << std::endl;
405  }
406  }
407 
408  break;
409  }
410  }
411  }
412 
413  // produce the L1GlobalTriggerReadoutRecord now, after we found the maximum number of
414  // BxInEvent the record has and how many boards are active (it is just reserving space
415  // for vectors)
416  //LogDebug("L1GlobalTriggerRawToDigi")
417  //<< "\nL1GlobalTriggerRawToDigi: producing L1GlobalTriggerReadoutRecord\n"
418  //<< "\nL1GlobalTriggerRawToDigi: producing L1MuGMTReadoutCollection;\n"
419  //<< std::endl;
420 
421  // get number of Bx in the event from GTFE block corresponding to alternative 0 and 1 in
424 
425  int maxBxInEvent = std::max(m_recordLength0, m_recordLength1);
426 
427  std::unique_ptr<L1GlobalTriggerReadoutRecord> gtReadoutRecord(
428  new L1GlobalTriggerReadoutRecord(maxBxInEvent, numberFdlBoards, numberPsbBoards));
429 
430  // produce also the GMT readout collection and set the reference in GT record
431  std::unique_ptr<L1MuGMTReadoutCollection> gmtrc(new L1MuGMTReadoutCollection(maxBxInEvent));
432 
433  //edm::RefProd<L1MuGMTReadoutCollection> refProdMuGMT = iEvent.getRefBeforePut<
434  // L1MuGMTReadoutCollection> ();
435 
436  //if (m_verbosity) {
437  // LogDebug("L1GlobalTriggerRawToDigi")
438  // << "\nL1GlobalTriggerRawToDigi: set L1MuGMTReadoutCollection RefProd"
439  // << " in L1GlobalTriggerReadoutRecord.\n" << std::endl;
440  //}
441  //gtReadoutRecord->setMuCollectionRefProd(refProdMuGMT);
442 
443  // ... then unpack modules other than GTFE, if requested
444 
445  for (CItBoardMaps itBoard = gtRecordMap.begin(); itBoard != gtRecordMap.end(); ++itBoard) {
446  int iActiveBit = itBoard->gtBitDaqActiveBoards();
447 
448  bool activeBoardToUnpack = false;
449  bool activeBoardInitial = false;
450 
451  int altNrBxBoardVal = -1;
452 
453  if (iActiveBit >= 0) {
454  activeBoardInitial = activeBoardsGtInitial & (1 << iActiveBit);
455  activeBoardToUnpack = activeBoardsGt & (1 << iActiveBit);
456 
457  altNrBxBoardVal = (altNrBxBoardInitial & (1 << iActiveBit)) >> iActiveBit;
458 
459  if (altNrBxBoardVal == 1) {
461  } else if (altNrBxBoardVal == 0) {
463  } else {
464  if (m_verbosity) {
465  edm::LogWarning("L1GlobalTriggerRawToDigi")
466  << "\n\nWARNING: Wrong value altNrBxBoardVal = " << altNrBxBoardVal << " for board " << std::hex
467  << (itBoard->gtBoardId()) << std::dec << "\n iActiveBit = " << iActiveBit
468  << "\n altNrBxBoardInitial = 0x" << std::hex << altNrBxBoardInitial << std::dec
469  << "\n activeBoardsGt = 0x" << std::hex << activeBoardsGt << std::dec
470  << "\n activeBoardInitial = " << activeBoardInitial
471  << "\n activeBoardToUnpack = " << activeBoardToUnpack << "\n Set altNrBxBoardVal tentatively to "
472  << m_recordLength0 << "\n Job may crash or produce wrong results!\n\n"
473  << std::endl;
474  }
475 
477  }
478 
479  // number of BX required to be unpacked
480 
482  if (m_verbosity) {
483  LogDebug("L1GlobalTriggerRawToDigi")
484  << "\nWARNING: Number of available bunch crosses for board" << (itBoard->gtBoardId())
485  << " in the record ( " << m_totalBxInEvent
486  << " ) \n is smaller than the number of bunch crosses requested to be unpacked (" << m_unpackBxInEvent
487  << " )!!! \n Unpacking only " << m_totalBxInEvent << " bunch crosses.\n"
488  << std::endl;
489  }
490 
491  m_lowSkipBxInEvent = 0;
493 
494  } else if (m_unpackBxInEvent < 0) {
495  m_lowSkipBxInEvent = 0;
497 
498  if (m_verbosity) {
499  LogDebug("L1GlobalTriggerRawToDigi") << "\nUnpacking all " << m_totalBxInEvent << " bunch crosses available."
500  << "\n"
501  << std::endl;
502  }
503 
504  } else if (m_unpackBxInEvent == 0) {
507 
508  if (m_verbosity) {
509  LogDebug("L1GlobalTriggerRawToDigi")
510  << "\nNo bxInEvent required to be unpacked from " << m_totalBxInEvent << " bunch crosses available."
511  << "\n"
512  << std::endl;
513  }
514 
515  // change RecordLength
516  // cast int to cms_uint16_t (there are normally 3 or 5 BxInEvent)
517  m_gtfeWord->setRecordLength(static_cast<cms_uint16_t>(m_unpackBxInEvent));
518  m_gtfeWord->setRecordLength1(static_cast<cms_uint16_t>(m_unpackBxInEvent));
519 
520  } else {
523 
524  if (m_verbosity) {
525  LogDebug("L1GlobalTriggerRawToDigi") << "\nUnpacking " << m_unpackBxInEvent << " bunch crosses from "
526  << m_totalBxInEvent << " bunch crosses available."
527  << "\n"
528  << std::endl;
529  }
530 
531  // change RecordLength
532  // cast int to cms_uint16_t (there are normally 3 or 5 BxInEvent)
533  m_gtfeWord->setRecordLength(static_cast<cms_uint16_t>(m_unpackBxInEvent));
534  m_gtfeWord->setRecordLength1(static_cast<cms_uint16_t>(m_unpackBxInEvent));
535  }
536 
537  } else {
538  // board not in the ActiveBoards for the record
539  continue;
540  }
541 
542  if (!activeBoardInitial) {
543  if (m_verbosity) {
544  LogDebug("L1GlobalTriggerRawToDigi") << "\nBoard of type " << itBoard->gtBoardName() << " with index "
545  << itBoard->gtBoardIndex() << " not active initially in raw data.\n"
546  << std::endl;
547  }
548  continue;
549  }
550 
551  // active board initially, could unpack it
552  switch (itBoard->gtBoardType()) {
553  case FDL: {
554  for (int iFdl = 0; iFdl < m_totalBxInEvent; ++iFdl) {
555  // if pointer after FDL payload is greater than pointer at
556  // the end of GT payload, produce empty products and quit unpacking
557  if ((ptrGt + m_gtFdlWord->getSize()) > endPtrGt) {
558  edm::LogError("L1GlobalTriggerRawToDigi")
559  << "\nError: Pointer after FDL " << iFdl << " greater than end pointer."
560  << "\n Put empty products in the event!"
561  << "\n Quit unpacking this event." << std::endl;
562 
563  produceEmptyProducts(iEvent);
564 
565  return;
566  }
567 
568  // unpack only if requested, otherwise skip it
569  if (activeBoardToUnpack) {
570  // unpack only bxInEvent requested, otherwise skip it
571  if ((iFdl >= m_lowSkipBxInEvent) && (iFdl < m_uppSkipBxInEvent)) {
572  m_gtFdlWord->unpack(ptrGt);
573 
574  // add 1 to the GT luminosity number to use the same convention as
575  // offline, where LS number starts with 1;
576  // in GT hardware, LS starts with 0
577  cms_uint16_t lsNr = m_gtFdlWord->lumiSegmentNr() + 1;
579 
580  // add FDL block to GT readout record
581  gtReadoutRecord->setGtFdlWord(*m_gtFdlWord);
582 
583  if (m_verbosity && m_isDebugEnabled) {
584  std::ostringstream myCoutStream;
585  m_gtFdlWord->print(myCoutStream);
586  LogTrace("L1GlobalTriggerRawToDigi") << myCoutStream.str() << "\n" << std::endl;
587  }
588 
589  // ... and reset it
590  m_gtFdlWord->reset();
591  }
592  }
593 
594  ptrGt += m_gtFdlWord->getSize(); // advance with FDL block size
595  }
596  }
597 
598  break;
599  case PSB: {
600  for (int iPsb = 0; iPsb < m_totalBxInEvent; ++iPsb) {
601  // if pointer after PSB payload is greater than pointer at
602  // the end of GT payload, produce empty products and quit unpacking
603  if ((ptrGt + m_gtPsbWord->getSize()) > endPtrGt) {
604  edm::LogError("L1GlobalTriggerRawToDigi")
605  << "\nError: Pointer after PSB " << iPsb << " greater than end pointer."
606  << "\n Put empty products in the event!"
607  << "\n Quit unpacking this event." << std::endl;
608 
609  produceEmptyProducts(iEvent);
610 
611  return;
612  }
613 
614  // unpack only if requested, otherwise skip it
615  if (activeBoardToUnpack) {
616  // unpack only bxInEvent requested, otherwise skip it
617  if ((iPsb >= m_lowSkipBxInEvent) && (iPsb < m_uppSkipBxInEvent)) {
618  unpackPSB(evSetup, ptrGt, *m_gtPsbWord);
619 
620  // add PSB block to GT readout record
621  gtReadoutRecord->setGtPsbWord(*m_gtPsbWord);
622 
623  if (m_verbosity && m_isDebugEnabled) {
624  std::ostringstream myCoutStream;
625  m_gtPsbWord->print(myCoutStream);
626  LogTrace("L1GlobalTriggerRawToDigi") << myCoutStream.str() << "\n" << std::endl;
627  }
628 
629  // ... and reset it
630  m_gtPsbWord->reset();
631  }
632  }
633 
634  ptrGt += m_gtPsbWord->getSize(); // advance with PSB block size
635  }
636  } break;
637  case GMT: {
638  // 17*64/8 TODO FIXME ask Ivan for a getSize() function for GMT record
639  unsigned int gmtRecordSize = 136;
640  unsigned int gmtCollSize = m_totalBxInEvent * gmtRecordSize;
641 
642  // if pointer after GMT payload is greater than pointer at
643  // the end of GT payload, produce empty products and quit unpacking
644  if ((ptrGt + gmtCollSize) > endPtrGt) {
645  edm::LogError("L1GlobalTriggerRawToDigi") << "\nError: Pointer after GMT "
646  << " greater than end pointer."
647  << "\n Put empty products in the event!"
648  << "\n Quit unpacking this event." << std::endl;
649 
650  produceEmptyProducts(iEvent);
651 
652  return;
653  }
654 
655  // unpack only if requested, otherwise skip it
656  if (activeBoardToUnpack) {
657  unpackGMT(ptrGt, gmtrc, iEvent);
658  }
659 
660  ptrGt += gmtCollSize; // advance with GMT block size
661  } break;
662  default: {
663  // do nothing, all blocks are given in GtBoardType enum
664  if (m_verbosity) {
665  LogDebug("L1GlobalTriggerRawToDigi")
666  << "\nBoard of type " << itBoard->gtBoardType() << " not expected in record.\n"
667  << std::endl;
668  }
669  } break;
670  }
671  }
672 
673  // add GTFE block to GT readout record, after updating active boards and record length
674 
675  gtReadoutRecord->setGtfeWord(*m_gtfeWord);
676 
677  // ... and reset it
678  m_gtfeWord->reset();
679 
680  // unpack trailer
681 
682  int trailerSize = 8;
683 
684  // if pointer after trailer is greater than pointer at
685  // the end of GT payload, produce empty products and quit unpacking
686  if ((ptrGt + trailerSize) > endPtrGt) {
687  edm::LogError("L1GlobalTriggerRawToDigi") << "\nError: Pointer after trailer "
688  << " greater than end pointer."
689  << "\n Put empty products in the event!"
690  << "\n Quit unpacking this event." << std::endl;
691 
692  produceEmptyProducts(iEvent);
693 
694  return;
695  }
696 
697  unpackTrailer(ptrGt, cmsTrailer);
698 
699  //
700  if (m_verbosity && m_isDebugEnabled) {
701  std::ostringstream myCoutStream;
702  gtReadoutRecord->print(myCoutStream);
703  LogTrace("L1GlobalTriggerRawToDigi") << "\n The following L1 GT DAQ readout record was unpacked.\n"
704  << myCoutStream.str() << "\n"
705  << std::endl;
706  }
707 
708  // put records into event
709 
710  iEvent.put(std::move(gmtrc));
711  iEvent.put(std::move(gtReadoutRecord));
712 }
#define LogDebug(id)
const L1MuTriggerScales * m_TriggerScales
muon trigger scales to convert unpacked data into physical quantities
void reset()
reset the content of a L1GtPsbWord
Definition: L1GtPsbWord.cc:330
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
const unsigned int getSize() const
get the size of the GTFE block in GT DAQ record (in multiple of 8 bits)
Definition: L1GtfeWord.h:160
virtual void print(std::ostream &myCout) const
pretty print the content of a L1GtfeWord
Definition: L1GtfeWord.cc:253
void unpackHeader(const unsigned char *, FEDHeader &)
block unpackers
cms_uint16_t m_activeBoardsMaskGt
mask for active boards
int m_recordLength0
total Bx&#39;s in the event, obtained from GTFE block
void unpack(const unsigned char *fdlPtr)
Definition: L1GtFdlWord.cc:689
void unpackPSB(const edm::EventSetup &, const unsigned char *, L1GtPsbWord &)
void setRecordLength(cms_uint16_t recordLengthValue)
Definition: L1GtfeWord.h:84
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
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
const cms_uint16_t recordLength() const
get/set record length for alternative 0
Definition: L1GtfeWord.h:82
virtual void reset()
reset the content of a L1GtfeWord
Definition: L1GtfeWord.cc:240
const L1MuTriggerPtScale * m_TriggerPtScale
int m_recordLength1
corresponding to alternative 1 in altNrBxBoard()
void setLumiSegmentNr(const cms_uint16_t &lumiSegmentNrValue)
Definition: L1GtFdlWord.h:249
edm::InputTag m_daqGtInputTag
input tags for GT DAQ record
void reset()
reset the content of a L1GtFdlWord
Definition: L1GtFdlWord.cc:567
unsigned short cms_uint16_t
Definition: typedefs.h:13
void setRecordLength1(cms_uint16_t recordLengthValue)
Definition: L1GtfeWord.h:73
bool isValid() const
Definition: HandleBase.h:70
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:488
const cms_uint16_t activeBoards() const
get/set boards contributing to EVM respectively DAQ record
Definition: L1GtfeWord.h:119
#define LogTrace(id)
void print(std::ostream &myCout) const
pretty print the content of a L1GtFdlWord
Definition: L1GtFdlWord.cc:595
void print(std::ostream &myCout) const
pretty print
Definition: L1GtPsbWord.cc:348
const cms_uint16_t lumiSegmentNr() const
get/set luminosity segment number of the actual bx
Definition: L1GtFdlWord.h:247
int m_totalBxInEvent
number of Bx for a board, obtained from GTFE block (record length & alternative)
T const * product() const
Definition: Handle.h:69
void setActiveBoards(cms_uint16_t activeBoardsValue)
Definition: L1GtfeWord.h:121
void unpackTrailer(const unsigned char *, FEDTrailer &)
unpack trailer word
const std::vector< L1GtBoard > & gtBoardMaps() const
get / set / print the L1 GT board map
Definition: L1GtBoardMaps.h:43
T get() const
Definition: EventSetup.h:73
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24
void unpackGMT(const unsigned char *, std::unique_ptr< L1MuGMTReadoutCollection > &, edm::Event &)
unpack the GMT record
void produceEmptyProducts(edm::Event &)
produce empty products in case of problems
const cms_uint16_t recordLength1() const
get/set record length for alternative 1
Definition: L1GtfeWord.h:71
T const * product() const
Definition: ESHandle.h:86
virtual void unpack(const unsigned char *gtfePtr)
Definition: L1GtfeWord.cc:290
def move(src, dest)
Definition: eostools.py:511
const unsigned int getSize() const
get the size of the PSB block in GT DAQ record (in multiple of 8 bits)
Definition: L1GtPsbWord.h:147
void dumpFedRawData(const unsigned char *, int, std::ostream &)
dump FED raw data
void L1GlobalTriggerRawToDigi::produceEmptyProducts ( edm::Event iEvent)
private

produce empty products in case of problems

Definition at line 953 of file L1GlobaTriggerRawToDigi.cc.

References eostools::move(), and edm::Event::put().

Referenced by produce().

953  {
954  std::unique_ptr<L1GlobalTriggerReadoutRecord> gtReadoutRecord(new L1GlobalTriggerReadoutRecord());
955 
956  std::unique_ptr<L1MuGMTReadoutCollection> gmtrc(new L1MuGMTReadoutCollection());
957 
958  std::unique_ptr<std::vector<L1MuRegionalCand> > DTCands(new std::vector<L1MuRegionalCand>);
959  std::unique_ptr<std::vector<L1MuRegionalCand> > CSCCands(new std::vector<L1MuRegionalCand>);
960  std::unique_ptr<std::vector<L1MuRegionalCand> > RPCbCands(new std::vector<L1MuRegionalCand>);
961  std::unique_ptr<std::vector<L1MuRegionalCand> > RPCfCands(new std::vector<L1MuRegionalCand>);
962  std::unique_ptr<std::vector<L1MuGMTCand> > GMTCands(new std::vector<L1MuGMTCand>);
963 
964  // put empty records into event
965 
966  iEvent.put(std::move(gmtrc));
967  iEvent.put(std::move(gtReadoutRecord));
968 
969  iEvent.put(std::move(DTCands), "DT");
970  iEvent.put(std::move(CSCCands), "CSC");
971  iEvent.put(std::move(RPCbCands), "RPCb");
972  iEvent.put(std::move(RPCfCands), "RPCf");
973  iEvent.put(std::move(GMTCands));
974 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
def move(src, dest)
Definition: eostools.py:511
void L1GlobalTriggerRawToDigi::unpackGMT ( const unsigned char *  chp,
std::unique_ptr< L1MuGMTReadoutCollection > &  gmtrc,
edm::Event iEvent 
)
private

unpack the GMT record

Definition at line 796 of file L1GlobaTriggerRawToDigi.cc.

References TauDecayModes::dec, L1MuRegionalCand::empty(), L1MuGMTCand::empty(), L1MuRegionalCand::eta_packed(), L1MuGMTCand::etaIndex(), L1MuScale::getCenter(), L1MuTriggerScales::getGMTEtaScale(), L1MuScale::getLowEdge(), L1MuTriggerScales::getPhiScale(), L1MuTriggerPtScale::getPtScale(), L1MuTriggerScales::getRegionalEtaScale(), LogTrace, m_lowSkipBxInEvent, m_totalBxInEvent, m_TriggerPtScale, m_TriggerScales, m_uppSkipBxInEvent, eostools::move(), AlCaHLTBitMon_ParallelJobs::p, L1MuRegionalCand::phi_packed(), L1MuGMTCand::phiIndex(), L1MuRegionalCand::pt_packed(), L1MuGMTCand::ptIndex(), edm::Event::put(), L1MuGMTReadoutRecord::setBCERR(), L1MuGMTReadoutRecord::setBxInEvent(), L1MuGMTReadoutRecord::setBxNr(), L1MuRegionalCand::setEtaValue(), L1MuGMTCand::setEtaValue(), L1MuGMTReadoutRecord::setEvNr(), L1MuGMTReadoutRecord::setGMTBrlCand(), L1MuGMTReadoutRecord::setGMTCand(), L1MuGMTReadoutRecord::setGMTFwdCand(), L1MuGMTReadoutRecord::setInputCand(), L1MuRegionalCand::setPhiValue(), L1MuGMTCand::setPhiValue(), L1MuRegionalCand::setPtValue(), L1MuGMTCand::setPtValue(), L1MuRegionalCand::setType(), and L1MuRegionalCand::type_idx().

Referenced by produce().

798  {
799  //LogDebug("L1GlobalTriggerRawToDigi")
800  //<< "\nUnpacking GMT collection.\n"
801  //<< std::endl;
802 
803  // 17*64/2 TODO FIXME ask Ivan for a getSize() function for GMT record
804  const unsigned int gmtRecordSize32 = 34;
805 
806  std::unique_ptr<std::vector<L1MuRegionalCand> > DTCands(new std::vector<L1MuRegionalCand>);
807  std::unique_ptr<std::vector<L1MuRegionalCand> > CSCCands(new std::vector<L1MuRegionalCand>);
808  std::unique_ptr<std::vector<L1MuRegionalCand> > RPCbCands(new std::vector<L1MuRegionalCand>);
809  std::unique_ptr<std::vector<L1MuRegionalCand> > RPCfCands(new std::vector<L1MuRegionalCand>);
810  std::unique_ptr<std::vector<L1MuGMTCand> > GMTCands(new std::vector<L1MuGMTCand>);
811 
812  const unsigned* p = (const unsigned*)chp;
813 
814  // min Bx's in the event, computed after m_totalBxInEvent is obtained from GTFE block
815  // assume symmetrical number of BX around L1Accept
816  int iBxInEvent = (m_totalBxInEvent + 1) / 2 - m_totalBxInEvent;
817 
818  for (int iGmtRec = 0; iGmtRec < m_totalBxInEvent; ++iGmtRec) {
819  // unpack only bxInEvent requested, otherwise skip it
820  if ((iGmtRec >= m_lowSkipBxInEvent) && (iGmtRec < m_uppSkipBxInEvent)) {
821  // Dump the block
822  const cms_uint64_t* bp = reinterpret_cast<cms_uint64_t*>(const_cast<unsigned*>(p));
823  for (int iWord = 0; iWord < 17; iWord++) {
824  LogTrace("L1GlobalTriggerRawToDigi") << std::setw(4) << iWord << " " << std::hex << std::setfill('0')
825  << std::setw(16) << *bp++ << std::dec << std::setfill(' ') << std::endl;
826  }
827 
828  L1MuGMTReadoutRecord gmtrr(iBxInEvent);
829 
830  gmtrr.setEvNr((*p) & 0xffffff);
831  gmtrr.setBCERR(((*p) >> 24) & 0xff);
832  p++;
833 
834  gmtrr.setBxNr((*p) & 0xfff);
835  if (((*p) >> 15) & 1) {
836  gmtrr.setBxInEvent((((*p) >> 12) & 7) - 8);
837  } else {
838  gmtrr.setBxInEvent((((*p) >> 12) & 7));
839  }
840  // to do: check here the block length and the board id
841  p++;
842 
843  for (int im = 0; im < 16; im++) {
844  // flip the pt and quality bits -- this should better be done by GMT input chips
845  unsigned waux = *p++;
846  waux = (waux & 0xffff00ff) | ((~waux) & 0x0000ff00);
847  L1MuRegionalCand cand(waux, iBxInEvent);
848  // fix the type assignment (csc=2, rpcb=1) -- should be done by GMT input chips
849  if (im >= 4 && im < 8)
850  cand.setType(1);
851  if (im >= 8 && im < 12)
852  cand.setType(2);
853  cand.setPhiValue(m_TriggerScales->getPhiScale()->getLowEdge(cand.phi_packed()));
854  cand.setEtaValue(m_TriggerScales->getRegionalEtaScale(cand.type_idx())->getCenter(cand.eta_packed()));
855  cand.setPtValue(m_TriggerPtScale->getPtScale()->getLowEdge(cand.pt_packed()));
856  gmtrr.setInputCand(im, cand);
857  if (!cand.empty()) {
858  if (im < 4)
859  DTCands->push_back(cand);
860  if (im >= 4 && im < 8)
861  RPCbCands->push_back(cand);
862  if (im >= 8 && im < 12)
863  CSCCands->push_back(cand);
864  if (im >= 12)
865  RPCfCands->push_back(cand);
866  }
867  }
868 
869  unsigned char* prank = (unsigned char*)(p + 12);
870 
871  for (int im = 0; im < 12; im++) {
872  unsigned waux = *p++;
873  unsigned raux = im < 8 ? *prank++ : 0; // only fwd and brl cands have valid rank
874  L1MuGMTExtendedCand cand(waux, raux, iBxInEvent);
875  cand.setPhiValue(m_TriggerScales->getPhiScale()->getLowEdge(cand.phiIndex()));
876  cand.setEtaValue(m_TriggerScales->getGMTEtaScale()->getCenter(cand.etaIndex()));
877  cand.setPtValue(m_TriggerPtScale->getPtScale()->getLowEdge(cand.ptIndex()));
878  if (im < 4)
879  gmtrr.setGMTBrlCand(im, cand);
880  else if (im < 8)
881  gmtrr.setGMTFwdCand(im - 4, cand);
882  else {
883  gmtrr.setGMTCand(im - 8, cand);
884  if (!cand.empty())
885  GMTCands->push_back(cand);
886  }
887  }
888 
889  // skip the two sort rank words and two chip BX words
890  p += 4;
891 
892  gmtrc->addRecord(gmtrr);
893 
894  } else {
895  // increase the pointer with the GMT record size
896  p += gmtRecordSize32;
897  }
898 
899  // increase the BxInEvent number
900  iBxInEvent++;
901  }
902 
903  iEvent.put(std::move(DTCands), "DT");
904  iEvent.put(std::move(CSCCands), "CSC");
905  iEvent.put(std::move(RPCbCands), "RPCb");
906  iEvent.put(std::move(RPCfCands), "RPCf");
907  iEvent.put(std::move(GMTCands));
908 }
const L1MuTriggerScales * m_TriggerScales
muon trigger scales to convert unpacked data into physical quantities
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
const L1MuScale * getPtScale() const
get the Pt scale
virtual float getCenter(unsigned packed) const =0
get the center of bin represented by packed
const L1MuTriggerPtScale * m_TriggerPtScale
const L1MuScale * getPhiScale() const
get the phi scale
#define LogTrace(id)
int m_totalBxInEvent
number of Bx for a board, obtained from GTFE block (record length & alternative)
const L1MuScale * getRegionalEtaScale(int isys) const
get the regioanl muon trigger eta scale, isys = 0(DT), 1(bRPC), 2(CSC), 3(fwdRPC) ...
virtual float getLowEdge(unsigned packed) const =0
get the low edge of bin represented by packed
const L1MuScale * getGMTEtaScale() const
get the GMT eta scale
unsigned long long cms_uint64_t
Definition: typedefs.h:17
def move(src, dest)
Definition: eostools.py:511
void L1GlobalTriggerRawToDigi::unpackHeader ( const unsigned char *  gtPtr,
FEDHeader cmsHeader 
)
private

block unpackers

unpack header

Definition at line 715 of file L1GlobaTriggerRawToDigi.cc.

References FEDHeader::bxID(), TauDecayModes::dec, LogDebug, FEDHeader::lvl1ID(), m_isDebugEnabled, m_verbosity, FEDHeader::moreHeaders(), jets_cff::payload, FEDHeader::sourceID(), FEDHeader::triggerType(), and FEDHeader::version().

Referenced by produce().

715  {
716  // TODO if needed in another format
717 
718  // print the header info
719  if (m_verbosity && m_isDebugEnabled) {
720  const cms_uint64_t* payload = reinterpret_cast<cms_uint64_t*>(const_cast<unsigned char*>(gtPtr));
721 
722  std::ostringstream myCoutStream;
723 
724  // one word only
725  int iWord = 0;
726 
727  myCoutStream << std::setw(4) << iWord << " " << std::hex << std::setfill('0') << std::setw(16) << payload[iWord]
728  << std::dec << std::setfill(' ') << "\n"
729  << std::endl;
730 
731  myCoutStream << " Event_type: " << std::hex << " hex: "
732  << " " << std::setw(1) << std::setfill('0') << cmsHeader.triggerType() << std::setfill(' ')
733  << std::dec << " dec: " << cmsHeader.triggerType() << std::endl;
734 
735  myCoutStream << " LVL1_Id: " << std::hex << " hex: "
736  << "" << std::setw(6) << std::setfill('0') << cmsHeader.lvl1ID() << std::setfill(' ') << std::dec
737  << " dec: " << cmsHeader.lvl1ID() << std::endl;
738 
739  myCoutStream << " BX_Id: " << std::hex << " hex: "
740  << " " << std::setw(3) << std::setfill('0') << cmsHeader.bxID() << std::setfill(' ') << std::dec
741  << " dec: " << cmsHeader.bxID() << std::endl;
742 
743  myCoutStream << " Source_Id: " << std::hex << " hex: "
744  << " " << std::setw(3) << std::setfill('0') << cmsHeader.sourceID() << std::setfill(' ') << std::dec
745  << " dec: " << cmsHeader.sourceID() << std::endl;
746 
747  myCoutStream << " FOV: " << std::hex << " hex: "
748  << " " << std::setw(1) << std::setfill('0') << cmsHeader.version() << std::setfill(' ') << std::dec
749  << " dec: " << cmsHeader.version() << std::endl;
750 
751  myCoutStream << " H: " << std::hex << " hex: "
752  << " " << std::setw(1) << std::setfill('0') << cmsHeader.moreHeaders() << std::setfill(' ')
753  << std::dec << " dec: " << cmsHeader.moreHeaders() << std::endl;
754 
755  LogDebug("L1GlobalTriggerRawToDigi") << "\n CMS Header \n" << myCoutStream.str() << "\n" << std::endl;
756  }
757 }
#define LogDebug(id)
uint8_t triggerType() const
Event Trigger type identifier.
Definition: FEDHeader.cc:13
bool moreHeaders() const
Definition: FEDHeader.cc:23
uint16_t sourceID() const
Identifier of the FED.
Definition: FEDHeader.cc:19
uint8_t version() const
Version identifier of the FED data format.
Definition: FEDHeader.cc:21
uint16_t bxID() const
The bunch crossing number.
Definition: FEDHeader.cc:17
uint32_t lvl1ID() const
Level-1 event number generated by the TTC system.
Definition: FEDHeader.cc:15
unsigned long long cms_uint64_t
Definition: typedefs.h:17
void L1GlobalTriggerRawToDigi::unpackPSB ( const edm::EventSetup evSetup,
const unsigned char *  psbPtr,
L1GtPsbWord psbWord 
)
private

unpack PSB blocks unpacking is done in PSB class format methods are given later to translate from the PSB format to the physical input of the PSB

Definition at line 761 of file L1GlobaTriggerRawToDigi.cc.

References TauDecayModes::dec, L1GtPsbWord::getSize(), LogTrace, jets_cff::payload, L1GtPsbWord::setAData(), L1GtPsbWord::setBData(), L1GtPsbWord::setBoardId(), L1GtPsbWord::setBxInEvent(), L1GtPsbWord::setBxNr(), L1GtPsbWord::setEventNr(), L1GtPsbWord::setLocalBxNr(), and L1GlobalTriggerReadoutSetup::UnitLength.

Referenced by produce().

763  {
764  //LogDebug("L1GlobalTriggerRawToDigi")
765  //<< "\nUnpacking PSB block.\n"
766  //<< std::endl;
767 
769 
770  int psbSize = psbWord.getSize();
771  int psbWords = psbSize / uLength;
772 
773  const cms_uint64_t* payload = reinterpret_cast<cms_uint64_t*>(const_cast<unsigned char*>(psbPtr));
774 
775  for (int iWord = 0; iWord < psbWords; ++iWord) {
776  // fill PSB
777  // the second argument must match the word index defined in L1GtPsbWord class
778 
779  psbWord.setBoardId(payload[iWord], iWord);
780  psbWord.setBxInEvent(payload[iWord], iWord);
781  psbWord.setBxNr(payload[iWord], iWord);
782  psbWord.setEventNr(payload[iWord], iWord);
783 
784  psbWord.setAData(payload[iWord], iWord);
785  psbWord.setBData(payload[iWord], iWord);
786 
787  psbWord.setLocalBxNr(payload[iWord], iWord);
788 
789  LogTrace("L1GlobalTriggerRawToDigi") << std::setw(4) << iWord << " " << std::hex << std::setfill('0')
790  << std::setw(16) << payload[iWord] << std::dec << std::setfill(' ')
791  << std::endl;
792  }
793 }
static const int UnitLength
one unit in the word is UnitLength bits
void setBData(cms_uint16_t bDataVal, int iB)
Definition: L1GtPsbWord.cc:263
void setEventNr(cms_uint32_t eventNrValue)
Definition: L1GtPsbWord.h:99
void setBxNr(cms_uint16_t bxNrValue)
Definition: L1GtPsbWord.h:86
void setBoardId(cms_uint16_t boardIdValue)
Definition: L1GtPsbWord.h:60
void setBxInEvent(int bxInEventValue)
Definition: L1GtPsbWord.h:73
#define LogTrace(id)
void setLocalBxNr(cms_uint16_t localBxNrValue)
Definition: L1GtPsbWord.h:136
unsigned long long cms_uint64_t
Definition: typedefs.h:17
void setAData(cms_uint16_t aDataVal, int iA)
Definition: L1GtPsbWord.cc:191
const unsigned int getSize() const
get the size of the PSB block in GT DAQ record (in multiple of 8 bits)
Definition: L1GtPsbWord.h:147
void L1GlobalTriggerRawToDigi::unpackTrailer ( const unsigned char *  trlPtr,
FEDTrailer cmsTrailer 
)
private

unpack trailer word

Definition at line 912 of file L1GlobaTriggerRawToDigi.cc.

References FEDTrailer::crc(), TauDecayModes::dec, FEDTrailer::evtStatus(), FEDTrailer::fragmentLength(), LogDebug, m_isDebugEnabled, m_verbosity, FEDTrailer::moreTrailers(), jets_cff::payload, and FEDTrailer::ttsBits().

Referenced by produce().

912  {
913  // TODO if needed in another format
914 
915  // print the trailer info
916  if (m_verbosity && m_isDebugEnabled) {
917  const cms_uint64_t* payload = reinterpret_cast<cms_uint64_t*>(const_cast<unsigned char*>(trlPtr));
918 
919  std::ostringstream myCoutStream;
920 
921  // one word only
922  int iWord = 0;
923 
924  myCoutStream << std::setw(4) << iWord << " " << std::hex << std::setfill('0') << std::setw(16) << payload[iWord]
925  << std::dec << std::setfill(' ') << "\n"
926  << std::endl;
927 
928  myCoutStream << " Event_length: " << std::hex << " hex: "
929  << "" << std::setw(6) << std::setfill('0') << cmsTrailer.fragmentLength() << std::setfill(' ')
930  << std::dec << " dec: " << cmsTrailer.fragmentLength() << std::endl;
931 
932  myCoutStream << " CRC: " << std::hex << " hex: "
933  << " " << std::setw(4) << std::setfill('0') << cmsTrailer.crc() << std::setfill(' ') << std::dec
934  << " dec: " << cmsTrailer.crc() << std::endl;
935 
936  myCoutStream << " Event_status: " << std::hex << " hex: "
937  << " " << std::setw(2) << std::setfill('0') << cmsTrailer.evtStatus() << std::setfill(' ')
938  << std::dec << " dec: " << cmsTrailer.evtStatus() << std::endl;
939 
940  myCoutStream << " TTS_bits: " << std::hex << " hex: "
941  << " " << std::setw(1) << std::setfill('0') << cmsTrailer.ttsBits() << std::setfill(' ')
942  << std::dec << " dec: " << cmsTrailer.ttsBits() << std::endl;
943 
944  myCoutStream << " More trailers: " << std::hex << " hex: "
945  << " " << std::setw(1) << std::setfill('0') << cmsTrailer.moreTrailers() << std::setfill(' ')
946  << std::dec << " dec: " << cmsTrailer.moreTrailers() << std::endl;
947 
948  LogDebug("L1GlobalTriggerRawToDigi") << "\n CMS Trailer \n" << myCoutStream.str() << "\n" << std::endl;
949  }
950 }
#define LogDebug(id)
uint16_t crc() const
Cyclic Redundancy Code of the event fragment including header and trailer.
Definition: FEDTrailer.cc:15
bool moreTrailers() const
Definition: FEDTrailer.cc:21
uint32_t fragmentLength() const
The length of the event fragment counted in 64-bit words including header and trailer.
Definition: FEDTrailer.cc:13
uint8_t ttsBits() const
Current value of the Trigger Throttling System bits.
Definition: FEDTrailer.cc:19
uint8_t evtStatus() const
Event fragment status information.
Definition: FEDTrailer.cc:17
unsigned long long cms_uint64_t
Definition: typedefs.h:17

Member Data Documentation

cms_uint16_t L1GlobalTriggerRawToDigi::m_activeBoardsMaskGt
private

mask for active boards

Definition at line 97 of file L1GlobalTriggerRawToDigi.h.

Referenced by L1GlobalTriggerRawToDigi(), and produce().

int L1GlobalTriggerRawToDigi::m_daqGtFedId
private

FED Id for GT DAQ record default value defined in DataFormats/FEDRawData/src/FEDNumbering.cc

Definition at line 94 of file L1GlobalTriggerRawToDigi.h.

Referenced by L1GlobalTriggerRawToDigi(), and produce().

edm::InputTag L1GlobalTriggerRawToDigi::m_daqGtInputTag
private

input tags for GT DAQ record

Definition at line 90 of file L1GlobalTriggerRawToDigi.h.

Referenced by L1GlobalTriggerRawToDigi(), and produce().

L1GtFdlWord* L1GlobalTriggerRawToDigi::m_gtFdlWord
private
L1GtfeWord* L1GlobalTriggerRawToDigi::m_gtfeWord
private
L1GtPsbWord* L1GlobalTriggerRawToDigi::m_gtPsbWord
private
bool L1GlobalTriggerRawToDigi::m_isDebugEnabled
private
int L1GlobalTriggerRawToDigi::m_lowSkipBxInEvent
private

lowest bxInEvent to be unpacked in the event assume symmetrical number of BX around L1Accept

Definition at line 104 of file L1GlobalTriggerRawToDigi.h.

Referenced by produce(), and unpackGMT().

int L1GlobalTriggerRawToDigi::m_recordLength0
private

total Bx's in the event, obtained from GTFE block

corresponding to alternative 0 in altNrBxBoard()

Definition at line 113 of file L1GlobalTriggerRawToDigi.h.

Referenced by produce().

int L1GlobalTriggerRawToDigi::m_recordLength1
private

corresponding to alternative 1 in altNrBxBoard()

Definition at line 116 of file L1GlobalTriggerRawToDigi.h.

Referenced by produce().

int L1GlobalTriggerRawToDigi::m_totalBxInEvent
private

number of Bx for a board, obtained from GTFE block (record length & alternative)

Definition at line 119 of file L1GlobalTriggerRawToDigi.h.

Referenced by produce(), and unpackGMT().

const L1MuTriggerPtScale* L1GlobalTriggerRawToDigi::m_TriggerPtScale
private

Definition at line 123 of file L1GlobalTriggerRawToDigi.h.

Referenced by produce(), and unpackGMT().

const L1MuTriggerScales* L1GlobalTriggerRawToDigi::m_TriggerScales
private

muon trigger scales to convert unpacked data into physical quantities

Definition at line 122 of file L1GlobalTriggerRawToDigi.h.

Referenced by produce(), and unpackGMT().

int L1GlobalTriggerRawToDigi::m_unpackBxInEvent
private

Definition at line 100 of file L1GlobalTriggerRawToDigi.h.

Referenced by L1GlobalTriggerRawToDigi(), and produce().

int L1GlobalTriggerRawToDigi::m_uppSkipBxInEvent
private

upper bxInEvent to be unpacked in the event assume symmetrical number of BX around L1Accept

Definition at line 108 of file L1GlobalTriggerRawToDigi.h.

Referenced by produce(), and unpackGMT().

int L1GlobalTriggerRawToDigi::m_verbosity
private

verbosity level

Definition at line 127 of file L1GlobalTriggerRawToDigi.h.

Referenced by L1GlobalTriggerRawToDigi(), produce(), unpackHeader(), and unpackTrailer().