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::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 L1GlobalTriggerRawToDigi (const edm::ParameterSet &)
 constructor(s) More...
 
virtual ~L1GlobalTriggerRawToDigi ()
 destructor More...
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

void dumpFedRawData (const unsigned char *, int, std::ostream &)
 dump FED raw data More...
 
virtual 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::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

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, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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 49 of file L1GlobalTriggerRawToDigi.h.

Constructor & Destructor Documentation

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

constructor(s)

Definition at line 62 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.

62  :
63 
64  // input tag for DAQ GT record
65  m_daqGtInputTag(pSet.getParameter<edm::InputTag> ("DaqGtInputTag")),
66 
67  // FED Id for GT DAQ record
68  // default value defined in DataFormats/FEDRawData/src/FEDNumbering.cc
69  // default value: assume the DAQ record is the last GT record
71  "DaqGtFedId", FEDNumbering::MAXTriggerGTPFEDID)),
72 
73  // mask for active boards
74  m_activeBoardsMaskGt(pSet.getParameter<unsigned int> ("ActiveBoardsMask")),
75 
76  // number of bunch crossing to be unpacked
77  m_unpackBxInEvent(pSet.getParameter<int> ("UnpackBxInEvent")),
78 
79  // create GTFE, FDL, PSB cards once per producer
80  // content will be reset whenever needed
81 
83 
85 
86  m_totalBxInEvent(0), m_verbosity(pSet.getUntrackedParameter<int> ("Verbosity", 0)),
87 
89 
90 {
91 
92  produces<L1GlobalTriggerReadoutRecord> ();
93  produces<L1MuGMTReadoutCollection> ();
94 
95  produces<std::vector<L1MuRegionalCand> > ("DT");
96  produces<std::vector<L1MuRegionalCand> > ("CSC");
97  produces<std::vector<L1MuRegionalCand> > ("RPCb");
98  produces<std::vector<L1MuRegionalCand> > ("RPCf");
99  produces<std::vector<L1MuGMTCand> > ();
100  consumes<FEDRawDataCollection>(m_daqGtInputTag);
101 
102  // create GTFE, FDL, PSB cards once per producer
103  // content will be reset whenever needed
104  m_gtfeWord = new L1GtfeWord();
105  m_gtFdlWord = new L1GtFdlWord();
106  m_gtPsbWord = new L1GtPsbWord();
107 
108  if (m_verbosity && m_isDebugEnabled) {
109 
110  LogDebug("L1GlobalTriggerRawToDigi")
111  << "\nInput tag for DAQ GT record: " << m_daqGtInputTag
112  << "\nFED Id for DAQ GT record: " << m_daqGtFedId
113  << "\nMask for active boards (hex format): " << std::hex
114  << std::setw(sizeof(m_activeBoardsMaskGt) * 2) << std::setfill('0')
116  << std::dec << std::setfill(' ')
117  << "\nNumber of bunch crossing to be unpacked: "
118  << 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: "
128  << m_unpackBxInEvent << "\n The number must be an odd number!\n"
129  << std::endl;
130  }
131  }
132 
133 }
#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 &amp; alternative)
L1GlobalTriggerRawToDigi::~L1GlobalTriggerRawToDigi ( )
virtual

destructor

Definition at line 136 of file L1GlobaTriggerRawToDigi.cc.

References m_gtFdlWord, m_gtfeWord, and m_gtPsbWord.

136  {
137 
138  delete m_gtfeWord;
139  delete m_gtFdlWord;
140  delete m_gtPsbWord;
141 
142 }

Member Function Documentation

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

dump FED raw data

Definition at line 1031 of file L1GlobaTriggerRawToDigi.cc.

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

Referenced by produce().

1032  {
1033 
1034  LogDebug("L1GlobalTriggerRawToDigi") << "\nDump FED raw data.\n" << std::endl;
1035 
1038 
1039  int gtWords = gtSize / uLength;
1040  LogTrace("L1GlobalTriggerRawToDigi") << "\nFED GT words (" << wLength << " bits):" << gtWords
1041  << "\n" << std::endl;
1042 
1043  const cms_uint64_t* payload =
1044  reinterpret_cast<cms_uint64_t*> (const_cast<unsigned char*> (gtPtr));
1045 
1046  for (unsigned int i = 0; i < gtSize / sizeof(cms_uint64_t); i++) {
1047  myCout << std::setw(4) << i << " " << std::hex << std::setfill('0') << std::setw(16)
1048  << payload[i] << std::dec << std::setfill(' ') << std::endl;
1049  }
1050 
1051 }
#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 cms_uint64_t
Definition: typedefs.h:17
void L1GlobalTriggerRawToDigi::produce ( edm::Event iEvent,
const edm::EventSetup evSetup 
)
overrideprivatevirtual

Implements edm::stream::EDProducerBase.

Definition at line 147 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, 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, bookConverter::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 JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

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

References edm::Event::put().

Referenced by produce().

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

unpack the GMT record

Definition at line 839 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, 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().

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

block unpackers

unpack header

Definition at line 748 of file L1GlobaTriggerRawToDigi.cc.

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

Referenced by produce().

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

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

Referenced by produce().

801  {
802 
803  //LogDebug("L1GlobalTriggerRawToDigi")
804  //<< "\nUnpacking PSB block.\n"
805  //<< std::endl;
806 
808 
809  int psbSize = psbWord.getSize();
810  int psbWords = psbSize / uLength;
811 
812  const cms_uint64_t* payload =
813  reinterpret_cast<cms_uint64_t*> (const_cast<unsigned char*> (psbPtr));
814 
815  for (int iWord = 0; iWord < psbWords; ++iWord) {
816 
817  // fill PSB
818  // the second argument must match the word index defined in L1GtPsbWord class
819 
820  psbWord.setBoardId(payload[iWord], iWord);
821  psbWord.setBxInEvent(payload[iWord], iWord);
822  psbWord.setBxNr(payload[iWord], iWord);
823  psbWord.setEventNr(payload[iWord], iWord);
824 
825  psbWord.setAData(payload[iWord], iWord);
826  psbWord.setBData(payload[iWord], iWord);
827 
828  psbWord.setLocalBxNr(payload[iWord], iWord);
829 
830  LogTrace("L1GlobalTriggerRawToDigi") << std::setw(4) << iWord << " " << std::hex
831  << std::setfill('0') << std::setw(16) << payload[iWord] << std::dec
832  << std::setfill(' ') << std::endl;
833 
834  }
835 
836 }
static const int UnitLength
one unit in the word is UnitLength bits
void setBData(cms_uint16_t bDataVal, int iB)
Definition: L1GtPsbWord.cc:337
void setEventNr(cms_uint32_t eventNrValue)
Definition: L1GtPsbWord.h:134
void setBxNr(cms_uint16_t bxNrValue)
Definition: L1GtPsbWord.h:113
void setBoardId(cms_uint16_t boardIdValue)
Definition: L1GtPsbWord.h:71
void setBxInEvent(int bxInEventValue)
Definition: L1GtPsbWord.h:92
#define LogTrace(id)
void setLocalBxNr(cms_uint16_t localBxNrValue)
Definition: L1GtPsbWord.h:183
unsigned long long cms_uint64_t
Definition: typedefs.h:17
void setAData(cms_uint16_t aDataVal, int iA)
Definition: L1GtPsbWord.cc:242
const unsigned int getSize() const
get the size of the PSB block in GT DAQ record (in multiple of 8 bits)
Definition: L1GtPsbWord.h:198
void L1GlobalTriggerRawToDigi::unpackTrailer ( const unsigned char *  trlPtr,
FEDTrailer cmsTrailer 
)
private

unpack trailer word

Definition at line 955 of file L1GlobaTriggerRawToDigi.cc.

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

Referenced by produce().

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

Referenced by L1GlobalTriggerRawToDigi(), and produce().

edm::InputTag L1GlobalTriggerRawToDigi::m_daqGtInputTag
private

input tags for GT DAQ record

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

Referenced by produce().

int L1GlobalTriggerRawToDigi::m_recordLength1
private

corresponding to alternative 1 in altNrBxBoard()

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

Referenced by produce(), and unpackGMT().

const L1MuTriggerPtScale* L1GlobalTriggerRawToDigi::m_TriggerPtScale
private

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

Referenced by produce(), and unpackGMT().

int L1GlobalTriggerRawToDigi::m_unpackBxInEvent
private

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

Referenced by produce(), and unpackGMT().

int L1GlobalTriggerRawToDigi::m_verbosity
private

verbosity level

Definition at line 136 of file L1GlobalTriggerRawToDigi.h.

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