CMS 3D CMS Logo

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

#include <L1GlobalTriggerRawToDigi.h>

Inheritance diagram for L1GlobalTriggerRawToDigi:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

 L1GlobalTriggerRawToDigi (const edm::ParameterSet &)
 constructor(s) More...
 
virtual ~L1GlobalTriggerRawToDigi ()
 destructor More...
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Member Functions

virtual void beginJob ()
 
void dumpFedRawData (const unsigned char *, int, std::ostream &)
 dump FED raw data More...
 
virtual void endJob ()
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
void produceEmptyProducts (edm::Event &)
 produce empty products in case of problems More...
 
void unpackGMT (const unsigned char *, std::auto_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

boost::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::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

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

$Date$ $Revision$

Definition at line 50 of file L1GlobalTriggerRawToDigi.h.

Constructor & Destructor Documentation

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

constructor(s)

Definition at line 65 of file L1GlobaTriggerRawToDigi.cc.

References 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  "DaqGtFedId", FEDNumbering::MAXTriggerGTPFEDID)),
75 
76  // mask for active boards
77  m_activeBoardsMaskGt(pSet.getParameter<unsigned int> ("ActiveBoardsMask")),
78 
79  // number of bunch crossing to be unpacked
80  m_unpackBxInEvent(pSet.getParameter<int> ("UnpackBxInEvent")),
81 
82  // create GTFE, FDL, PSB cards once per producer
83  // content will be reset whenever needed
84 
86 
88 
89  m_totalBxInEvent(0), m_verbosity(pSet.getUntrackedParameter<int> ("Verbosity", 0)),
90 
92 
93 {
94 
95  produces<L1GlobalTriggerReadoutRecord> ();
96  produces<L1MuGMTReadoutCollection> ();
97 
98  produces<std::vector<L1MuRegionalCand> > ("DT");
99  produces<std::vector<L1MuRegionalCand> > ("CSC");
100  produces<std::vector<L1MuRegionalCand> > ("RPCb");
101  produces<std::vector<L1MuRegionalCand> > ("RPCf");
102  produces<std::vector<L1MuGMTCand> > ();
103 
104  // create GTFE, FDL, PSB cards once per producer
105  // content will be reset whenever needed
106  m_gtfeWord = new L1GtfeWord();
107  m_gtFdlWord = new L1GtFdlWord();
108  m_gtPsbWord = new L1GtPsbWord();
109 
110  if (m_verbosity && m_isDebugEnabled) {
111 
112  LogDebug("L1GlobalTriggerRawToDigi")
113  << "\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')
118  << std::dec << std::setfill(' ')
119  << "\nNumber of bunch crossing to be unpacked: "
120  << m_unpackBxInEvent << "\n"
121  << std::endl;
122  }
123 
124  if ( ( m_unpackBxInEvent > 0 ) && ( ( m_unpackBxInEvent % 2 ) == 0 )) {
126 
127  if (m_verbosity) {
128  edm::LogInfo("L1GlobalTriggerRawToDigi")
129  << "\nWARNING: Number of bunch crossing to be unpacked rounded to: "
130  << m_unpackBxInEvent << "\n The number must be an odd number!\n"
131  << std::endl;
132  }
133  }
134 
135 }
#define LogDebug(id)
T getParameter(std::string const &) const
bool isDebugEnabled()
T getUntrackedParameter(std::string const &, T const &) const
int m_recordLength0
total Bx&#39;s in the event, obtained from GTFE block
boost::uint16_t m_activeBoardsMaskGt
mask for active boards
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 &amp; alternative)
L1GlobalTriggerRawToDigi::~L1GlobalTriggerRawToDigi ( )
virtual

destructor

Definition at line 138 of file L1GlobaTriggerRawToDigi.cc.

References m_gtFdlWord, m_gtfeWord, and m_gtPsbWord.

138  {
139 
140  delete m_gtfeWord;
141  delete m_gtFdlWord;
142  delete m_gtPsbWord;
143 
144 }

Member Function Documentation

void L1GlobalTriggerRawToDigi::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 148 of file L1GlobaTriggerRawToDigi.cc.

148  {
149  // empty
150 }
void L1GlobalTriggerRawToDigi::dumpFedRawData ( const unsigned char *  gtPtr,
int  gtSize,
std::ostream &  myCout 
)
private

dump FED raw data

Definition at line 1037 of file L1GlobaTriggerRawToDigi.cc.

References i, LogDebug, LogTrace, L1GlobalTriggerReadoutSetup::UnitLength, and L1GlobalTriggerReadoutSetup::WordLength.

Referenced by produce().

1038  {
1039 
1040  LogDebug("L1GlobalTriggerRawToDigi") << "\nDump FED raw data.\n" << std::endl;
1041 
1044 
1045  int gtWords = gtSize / uLength;
1046  LogTrace("L1GlobalTriggerRawToDigi") << "\nFED GT words (" << wLength << " bits):" << gtWords
1047  << "\n" << std::endl;
1048 
1049  const boost::uint64_t* payload =
1050  reinterpret_cast<boost::uint64_t*> (const_cast<unsigned char*> (gtPtr));
1051 
1052  for (unsigned int i = 0; i < gtSize / sizeof(boost::uint64_t); i++) {
1053  myCout << std::setw(4) << i << " " << std::hex << std::setfill('0') << std::setw(16)
1054  << payload[i] << std::dec << std::setfill(' ') << std::endl;
1055  }
1056 
1057 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
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 uint64_t
Definition: Time.h:15
void L1GlobalTriggerRawToDigi::endJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 1060 of file L1GlobaTriggerRawToDigi.cc.

1060  {
1061 
1062  // empty now
1063 }
void L1GlobalTriggerRawToDigi::produce ( edm::Event iEvent,
const edm::EventSetup evSetup 
)
privatevirtual

Implements edm::EDProducer.

Definition at line 153 of file L1GlobaTriggerRawToDigi.cc.

References L1GtfeWord::activeBoards(), L1GtfeWord::altNrBxBoard(), FEDRawData::data(), dumpFedRawData(), FDL, edm::EventSetup::get(), edm::Event::getByLabel(), L1GtPsbWord::getSize(), L1GtfeWord::getSize(), L1GtFdlWord::getSize(), GMT, 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, max(), L1GtPsbWord::print(), L1GtfeWord::print(), L1GtFdlWord::print(), produceEmptyProducts(), edm::Handle< T >::product(), edm::ESHandle< class >::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 python.JSONExport.JsonExport::export(), and python.HTMLExport.HTMLExport::export().

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

References edm::Event::put().

Referenced by produce().

1008  {
1009 
1010  std::auto_ptr<L1GlobalTriggerReadoutRecord> gtReadoutRecord(
1012 
1013  std::auto_ptr<L1MuGMTReadoutCollection> gmtrc(new L1MuGMTReadoutCollection());
1014 
1015  std::auto_ptr<std::vector<L1MuRegionalCand> > DTCands(new std::vector<L1MuRegionalCand>);
1016  std::auto_ptr<std::vector<L1MuRegionalCand> > CSCCands(new std::vector<L1MuRegionalCand>);
1017  std::auto_ptr<std::vector<L1MuRegionalCand> > RPCbCands(new std::vector<L1MuRegionalCand>);
1018  std::auto_ptr<std::vector<L1MuRegionalCand> > RPCfCands(new std::vector<L1MuRegionalCand>);
1019  std::auto_ptr<std::vector<L1MuGMTCand> > GMTCands(new std::vector<L1MuGMTCand>);
1020 
1021  // put empty records into event
1022 
1023  iEvent.put(gmtrc);
1024  iEvent.put(gtReadoutRecord);
1025 
1026  iEvent.put(DTCands, "DT");
1027  iEvent.put(CSCCands, "CSC");
1028  iEvent.put(RPCbCands, "RPCb");
1029  iEvent.put(RPCfCands, "RPCf");
1030  iEvent.put(GMTCands);
1031 
1032 }
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
void L1GlobalTriggerRawToDigi::unpackGMT ( const unsigned char *  chp,
std::auto_ptr< L1MuGMTReadoutCollection > &  gmtrc,
edm::Event iEvent 
)
private

unpack the GMT record

Definition at line 845 of file L1GlobaTriggerRawToDigi.cc.

References 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, L1TEmulatorMonitor_cff::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().

846  {
847 
848  //LogDebug("L1GlobalTriggerRawToDigi")
849  //<< "\nUnpacking GMT collection.\n"
850  //<< std::endl;
851 
852  // 17*64/2 TODO FIXME ask Ivan for a getSize() function for GMT record
853  const unsigned int gmtRecordSize32 = 34;
854 
855  std::auto_ptr<std::vector<L1MuRegionalCand> > DTCands(new std::vector<L1MuRegionalCand>);
856  std::auto_ptr<std::vector<L1MuRegionalCand> > CSCCands(new std::vector<L1MuRegionalCand>);
857  std::auto_ptr<std::vector<L1MuRegionalCand> > RPCbCands(new std::vector<L1MuRegionalCand>);
858  std::auto_ptr<std::vector<L1MuRegionalCand> > RPCfCands(new std::vector<L1MuRegionalCand>);
859  std::auto_ptr<std::vector<L1MuGMTCand> > GMTCands(new std::vector<L1MuGMTCand>);
860 
861  const unsigned* p = (const unsigned*) chp;
862 
863  // min Bx's in the event, computed after m_totalBxInEvent is obtained from GTFE block
864  // assume symmetrical number of BX around L1Accept
865  int iBxInEvent = ( m_totalBxInEvent + 1 ) / 2 - m_totalBxInEvent;
866 
867  for (int iGmtRec = 0; iGmtRec < m_totalBxInEvent; ++iGmtRec) {
868 
869  // unpack only bxInEvent requested, otherwise skip it
870  if ( ( iGmtRec >= m_lowSkipBxInEvent ) && ( iGmtRec < m_uppSkipBxInEvent )) {
871 
872  // Dump the block
873  const boost::uint64_t* bp =
874  reinterpret_cast<boost::uint64_t*> (const_cast<unsigned*> (p));
875  for (int iWord = 0; iWord < 17; iWord++) {
876  LogTrace("L1GlobalTriggerRawToDigi") << std::setw(4) << iWord << " " << std::hex
877  << std::setfill('0') << std::setw(16) << *bp++ << std::dec << std::setfill(
878  ' ') << std::endl;
879  }
880 
881  L1MuGMTReadoutRecord gmtrr(iBxInEvent);
882 
883  gmtrr.setEvNr( ( *p ) & 0xffffff);
884  gmtrr.setBCERR( ( ( *p ) >> 24 ) & 0xff);
885  p++;
886 
887  gmtrr.setBxNr( ( *p ) & 0xfff);
888  if ( ( ( *p ) >> 15 ) & 1) {
889  gmtrr.setBxInEvent( ( ( ( *p ) >> 12 ) & 7 ) - 8);
890  } else {
891  gmtrr.setBxInEvent( ( ( ( *p ) >> 12 ) & 7 ));
892  }
893  // to do: check here the block length and the board id
894  p++;
895 
896  for (int im = 0; im < 16; im++) {
897  // flip the pt and quality bits -- this should better be done by GMT input chips
898  unsigned waux = *p++;
899  waux = ( waux & 0xffff00ff ) | ( ( ~waux ) & 0x0000ff00 );
900  L1MuRegionalCand cand(waux, iBxInEvent);
901  // fix the type assignment (csc=2, rpcb=1) -- should be done by GMT input chips
902  if (im >= 4 && im < 8) cand.setType(1);
903  if (im >= 8 && im < 12) cand.setType(2);
904  cand.setPhiValue(m_TriggerScales->getPhiScale()->getLowEdge(cand.phi_packed()));
905  cand.setEtaValue(m_TriggerScales->getRegionalEtaScale(cand.type_idx())->getCenter(
906  cand.eta_packed()));
907  cand.setPtValue(m_TriggerPtScale->getPtScale()->getLowEdge(cand.pt_packed()));
908  gmtrr.setInputCand(im, cand);
909  if (!cand.empty()) {
910  if (im < 4) DTCands->push_back(cand);
911  if (im >= 4 && im < 8) RPCbCands->push_back(cand);
912  if (im >= 8 && im < 12) CSCCands->push_back(cand);
913  if (im >= 12) RPCfCands->push_back(cand);
914  }
915  }
916 
917  unsigned char* prank = (unsigned char*) ( p + 12 );
918 
919  for (int im = 0; im < 12; im++) {
920  unsigned waux = *p++;
921  unsigned raux = im < 8 ? *prank++ : 0; // only fwd and brl cands have valid rank
922  L1MuGMTExtendedCand cand(waux, raux, iBxInEvent);
923  cand.setPhiValue(m_TriggerScales->getPhiScale()->getLowEdge(cand.phiIndex()));
924  cand.setEtaValue(m_TriggerScales->getGMTEtaScale()->getCenter(cand.etaIndex()));
925  cand.setPtValue(m_TriggerPtScale->getPtScale()->getLowEdge(cand.ptIndex()));
926  if (im < 4)
927  gmtrr.setGMTBrlCand(im, cand);
928  else if (im < 8)
929  gmtrr.setGMTFwdCand(im - 4, cand);
930  else {
931  gmtrr.setGMTCand(im - 8, cand);
932  if (!cand.empty()) GMTCands->push_back(cand);
933  }
934  }
935 
936  // skip the two sort rank words and two chip BX words
937  p += 4;
938 
939  gmtrc->addRecord(gmtrr);
940 
941  } else {
942  // increase the pointer with the GMT record size
943  p += gmtRecordSize32;
944  }
945 
946  // increase the BxInEvent number
947  iBxInEvent++;
948 
949  }
950 
951  iEvent.put(DTCands, "DT");
952  iEvent.put(CSCCands, "CSC");
953  iEvent.put(RPCbCands, "RPCb");
954  iEvent.put(RPCfCands, "RPCf");
955  iEvent.put(GMTCands);
956 
957 }
const L1MuTriggerScales * m_TriggerScales
muon trigger scales to convert unpacked data into physical quantities
const L1MuScale * getPtScale() const
get the Pt scale
virtual float getLowEdge(unsigned packed) const =0
get the low edge of bin represented by packed
virtual float getCenter(unsigned packed) const =0
get the center of bin represented by packed
const L1MuTriggerPtScale * m_TriggerPtScale
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
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 &amp; alternative)
unsigned long long uint64_t
Definition: Time.h:15
const L1MuScale * getRegionalEtaScale(int isys) const
get the regioanl muon trigger eta scale, isys = 0(DT), 1(bRPC), 2(CSC), 3(fwdRPC) ...
const L1MuScale * getGMTEtaScale() const
get the GMT eta scale
void L1GlobalTriggerRawToDigi::unpackHeader ( const unsigned char *  gtPtr,
FEDHeader cmsHeader 
)
private

block unpackers

unpack header

Definition at line 754 of file L1GlobaTriggerRawToDigi.cc.

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

Referenced by produce().

754  {
755 
756  // TODO if needed in another format
757 
758  // print the header info
759  if (m_verbosity && m_isDebugEnabled) {
760 
761  const boost::uint64_t* payload =
762  reinterpret_cast<boost::uint64_t*> (const_cast<unsigned char*> (gtPtr));
763 
764  std::ostringstream myCoutStream;
765 
766  // one word only
767  int iWord = 0;
768 
769  myCoutStream << std::setw(4) << iWord << " " << std::hex << std::setfill('0')
770  << std::setw(16) << payload[iWord] << std::dec << std::setfill(' ') << "\n"
771  << std::endl;
772 
773  myCoutStream << " Event_type: " << std::hex << " hex: " << " " << std::setw(1)
774  << std::setfill('0') << cmsHeader.triggerType() << std::setfill(' ') << std::dec
775  << " dec: " << cmsHeader.triggerType() << std::endl;
776 
777  myCoutStream << " LVL1_Id: " << std::hex << " hex: " << "" << std::setw(6)
778  << std::setfill('0') << cmsHeader.lvl1ID() << std::setfill(' ') << std::dec
779  << " dec: " << cmsHeader.lvl1ID() << std::endl;
780 
781  myCoutStream << " BX_Id: " << std::hex << " hex: " << " " << std::setw(3)
782  << std::setfill('0') << cmsHeader.bxID() << std::setfill(' ') << std::dec
783  << " dec: " << cmsHeader.bxID() << std::endl;
784 
785  myCoutStream << " Source_Id: " << std::hex << " hex: " << " " << std::setw(3)
786  << std::setfill('0') << cmsHeader.sourceID() << std::setfill(' ') << std::dec
787  << " dec: " << cmsHeader.sourceID() << std::endl;
788 
789  myCoutStream << " FOV: " << std::hex << " hex: " << " " << std::setw(1)
790  << std::setfill('0') << cmsHeader.version() << std::setfill(' ') << std::dec
791  << " dec: " << cmsHeader.version() << std::endl;
792 
793  myCoutStream << " H: " << std::hex << " hex: " << " " << std::setw(1)
794  << std::setfill('0') << cmsHeader.moreHeaders() << std::setfill(' ') << std::dec
795  << " dec: " << cmsHeader.moreHeaders() << std::endl;
796 
797  LogDebug("L1GlobalTriggerRawToDigi") << "\n CMS Header \n" << myCoutStream.str() << "\n"
798  << std::endl;
799 
800  }
801 
802 }
#define LogDebug(id)
int version()
Version identifier of the FED data format.
Definition: FEDHeader.cc:34
int sourceID()
Identifier of the FED.
Definition: FEDHeader.cc:30
bool moreHeaders()
Definition: FEDHeader.cc:38
unsigned long long uint64_t
Definition: Time.h:15
int bxID()
The bunch crossing number.
Definition: FEDHeader.cc:26
int lvl1ID()
Level-1 event number generated by the TTC system.
Definition: FEDHeader.cc:22
int triggerType()
Event Trigger type identifier.
Definition: FEDHeader.cc:18
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 806 of file L1GlobaTriggerRawToDigi.cc.

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

Referenced by produce().

807  {
808 
809  //LogDebug("L1GlobalTriggerRawToDigi")
810  //<< "\nUnpacking PSB block.\n"
811  //<< std::endl;
812 
814 
815  int psbSize = psbWord.getSize();
816  int psbWords = psbSize / uLength;
817 
818  const boost::uint64_t* payload =
819  reinterpret_cast<boost::uint64_t*> (const_cast<unsigned char*> (psbPtr));
820 
821  for (int iWord = 0; iWord < psbWords; ++iWord) {
822 
823  // fill PSB
824  // the second argument must match the word index defined in L1GtPsbWord class
825 
826  psbWord.setBoardId(payload[iWord], iWord);
827  psbWord.setBxInEvent(payload[iWord], iWord);
828  psbWord.setBxNr(payload[iWord], iWord);
829  psbWord.setEventNr(payload[iWord], iWord);
830 
831  psbWord.setAData(payload[iWord], iWord);
832  psbWord.setBData(payload[iWord], iWord);
833 
834  psbWord.setLocalBxNr(payload[iWord], iWord);
835 
836  LogTrace("L1GlobalTriggerRawToDigi") << std::setw(4) << iWord << " " << std::hex
837  << std::setfill('0') << std::setw(16) << payload[iWord] << std::dec
838  << std::setfill(' ') << std::endl;
839 
840  }
841 
842 }
void setBxNr(boost::uint16_t bxNrValue)
Definition: L1GtPsbWord.h:115
void setLocalBxNr(boost::uint16_t localBxNrValue)
Definition: L1GtPsbWord.h:185
static const int UnitLength
one unit in the word is UnitLength bits
void setBxInEvent(int bxInEventValue)
Definition: L1GtPsbWord.h:94
#define LogTrace(id)
void setBData(boost::uint16_t bDataVal, int iB)
Definition: L1GtPsbWord.cc:339
void setAData(boost::uint16_t aDataVal, int iA)
Definition: L1GtPsbWord.cc:244
unsigned long long uint64_t
Definition: Time.h:15
void setEventNr(boost::uint32_t eventNrValue)
Definition: L1GtPsbWord.h:136
const unsigned int getSize() const
get the size of the PSB block in GT DAQ record (in multiple of 8 bits)
Definition: L1GtPsbWord.h:200
void setBoardId(boost::uint16_t boardIdValue)
Definition: L1GtPsbWord.h:73
void L1GlobalTriggerRawToDigi::unpackTrailer ( const unsigned char *  trlPtr,
FEDTrailer cmsTrailer 
)
private

unpack trailer word

Definition at line 961 of file L1GlobaTriggerRawToDigi.cc.

References FEDTrailer::crc(), FEDTrailer::evtStatus(), FEDTrailer::lenght(), LogDebug, m_isDebugEnabled, m_verbosity, FEDTrailer::moreTrailers(), and FEDTrailer::ttsBits().

Referenced by produce().

961  {
962 
963  // TODO if needed in another format
964 
965  // print the trailer info
966  if (m_verbosity && m_isDebugEnabled) {
967 
968  const boost::uint64_t* payload =
969  reinterpret_cast<boost::uint64_t*> (const_cast<unsigned char*> (trlPtr));
970 
971  std::ostringstream myCoutStream;
972 
973  // one word only
974  int iWord = 0;
975 
976  myCoutStream << std::setw(4) << iWord << " " << std::hex << std::setfill('0')
977  << std::setw(16) << payload[iWord] << std::dec << std::setfill(' ') << "\n"
978  << std::endl;
979 
980  myCoutStream << " Event_length: " << std::hex << " hex: " << "" << std::setw(6)
981  << std::setfill('0') << cmsTrailer.lenght() << std::setfill(' ') << std::dec
982  << " dec: " << cmsTrailer.lenght() << std::endl;
983 
984  myCoutStream << " CRC: " << std::hex << " hex: " << " " << std::setw(4)
985  << std::setfill('0') << cmsTrailer.crc() << std::setfill(' ') << std::dec
986  << " dec: " << cmsTrailer.crc() << std::endl;
987 
988  myCoutStream << " Event_status: " << std::hex << " hex: " << " " << std::setw(2)
989  << std::setfill('0') << cmsTrailer.evtStatus() << std::setfill(' ') << std::dec
990  << " dec: " << cmsTrailer.evtStatus() << std::endl;
991 
992  myCoutStream << " TTS_bits: " << std::hex << " hex: " << " " << std::setw(1)
993  << std::setfill('0') << cmsTrailer.ttsBits() << std::setfill(' ') << std::dec
994  << " dec: " << cmsTrailer.ttsBits() << std::endl;
995 
996  myCoutStream << " More trailers: " << std::hex << " hex: " << " " << std::setw(1)
997  << std::setfill('0') << cmsTrailer.moreTrailers() << std::setfill(' ') << std::dec
998  << " dec: " << cmsTrailer.moreTrailers() << std::endl;
999 
1000  LogDebug("L1GlobalTriggerRawToDigi") << "\n CMS Trailer \n" << myCoutStream.str() << "\n"
1001  << std::endl;
1002 
1003  }
1004 
1005 }
#define LogDebug(id)
int evtStatus()
Event fragment status information.
Definition: FEDTrailer.cc:29
bool moreTrailers()
Definition: FEDTrailer.cc:39
int ttsBits()
Current value of the Trigger Throttling System bitsAQ).
Definition: FEDTrailer.cc:34
unsigned long long uint64_t
Definition: Time.h:15
int lenght()
The length of the event fragment counted in 64-bit words including header and trailer.
Definition: FEDTrailer.cc:19
int crc()
Cyclic Redundancy Code of the event fragment including header and trailer.
Definition: FEDTrailer.cc:24

Member Data Documentation

boost::uint16_t L1GlobalTriggerRawToDigi::m_activeBoardsMaskGt
private

mask for active boards

Definition at line 109 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 106 of file L1GlobalTriggerRawToDigi.h.

Referenced by L1GlobalTriggerRawToDigi(), and produce().

edm::InputTag L1GlobalTriggerRawToDigi::m_daqGtInputTag
private

input tags for GT DAQ record

Definition at line 102 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 116 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 125 of file L1GlobalTriggerRawToDigi.h.

Referenced by produce().

int L1GlobalTriggerRawToDigi::m_recordLength1
private

corresponding to alternative 1 in altNrBxBoard()

Definition at line 128 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 131 of file L1GlobalTriggerRawToDigi.h.

Referenced by produce(), and unpackGMT().

const L1MuTriggerPtScale* L1GlobalTriggerRawToDigi::m_TriggerPtScale
private

Definition at line 136 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 135 of file L1GlobalTriggerRawToDigi.h.

Referenced by produce(), and unpackGMT().

int L1GlobalTriggerRawToDigi::m_unpackBxInEvent
private

Definition at line 112 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 120 of file L1GlobalTriggerRawToDigi.h.

Referenced by produce(), and unpackGMT().

int L1GlobalTriggerRawToDigi::m_verbosity
private

verbosity level

Definition at line 141 of file L1GlobalTriggerRawToDigi.h.

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