CMS 3D CMS Logo

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

#include <L1GlobalTriggerRawToDigi.h>

Inheritance diagram for L1GlobalTriggerRawToDigi:
edm::stream::EDProducer<> 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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 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
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

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
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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 64 of file L1GlobaTriggerRawToDigi.cc.

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

64  :
65 
66  // input tag for DAQ GT record
67  m_daqGtInputTag(pSet.getParameter<edm::InputTag> ("DaqGtInputTag")),
68 
69  // FED Id for GT DAQ record
70  // default value defined in DataFormats/FEDRawData/src/FEDNumbering.cc
71  // default value: assume the DAQ record is the last GT record
73  "DaqGtFedId", FEDNumbering::MAXTriggerGTPFEDID)),
74 
75  // mask for active boards
76  m_activeBoardsMaskGt(pSet.getParameter<unsigned int> ("ActiveBoardsMask")),
77 
78  // number of bunch crossing to be unpacked
79  m_unpackBxInEvent(pSet.getParameter<int> ("UnpackBxInEvent")),
80 
81  // create GTFE, FDL, PSB cards once per producer
82  // content will be reset whenever needed
83 
85 
87 
88  m_totalBxInEvent(0), m_verbosity(pSet.getUntrackedParameter<int> ("Verbosity", 0)),
89 
91 
92 {
93 
94  produces<L1GlobalTriggerReadoutRecord> ();
95  produces<L1MuGMTReadoutCollection> ();
96 
97  produces<std::vector<L1MuRegionalCand> > ("DT");
98  produces<std::vector<L1MuRegionalCand> > ("CSC");
99  produces<std::vector<L1MuRegionalCand> > ("RPCb");
100  produces<std::vector<L1MuRegionalCand> > ("RPCf");
101  produces<std::vector<L1MuGMTCand> > ();
102  consumes<FEDRawDataCollection>(m_daqGtInputTag);
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
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 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::dumpFedRawData ( const unsigned char *  gtPtr,
int  gtSize,
std::ostream &  myCout 
)
private

dump FED raw data

Definition at line 1062 of file L1GlobaTriggerRawToDigi.cc.

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

Referenced by produce().

1063  {
1064 
1065  LogDebug("L1GlobalTriggerRawToDigi") << "\nDump FED raw data.\n" << std::endl;
1066 
1069 
1070  int gtWords = gtSize / uLength;
1071  LogTrace("L1GlobalTriggerRawToDigi") << "\nFED GT words (" << wLength << " bits):" << gtWords
1072  << "\n" << std::endl;
1073 
1074  const cms_uint64_t* payload =
1075  reinterpret_cast<cms_uint64_t*> (const_cast<unsigned char*> (gtPtr));
1076 
1077  for (unsigned int i = 0; i < gtSize / sizeof(cms_uint64_t); i++) {
1078  myCout << std::setw(4) << i << " " << std::hex << std::setfill('0') << std::setw(16)
1079  << payload[i] << std::dec << std::setfill(' ') << std::endl;
1080  }
1081 
1082 }
#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::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 146 of file L1GlobaTriggerRawToDigi.cc.

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

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

Implements edm::stream::EDProducerBase.

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

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

References edm::Event::put().

Referenced by produce().

1033  {
1034 
1035  std::auto_ptr<L1GlobalTriggerReadoutRecord> gtReadoutRecord(
1037 
1038  std::auto_ptr<L1MuGMTReadoutCollection> gmtrc(new L1MuGMTReadoutCollection());
1039 
1040  std::auto_ptr<std::vector<L1MuRegionalCand> > DTCands(new std::vector<L1MuRegionalCand>);
1041  std::auto_ptr<std::vector<L1MuRegionalCand> > CSCCands(new std::vector<L1MuRegionalCand>);
1042  std::auto_ptr<std::vector<L1MuRegionalCand> > RPCbCands(new std::vector<L1MuRegionalCand>);
1043  std::auto_ptr<std::vector<L1MuRegionalCand> > RPCfCands(new std::vector<L1MuRegionalCand>);
1044  std::auto_ptr<std::vector<L1MuGMTCand> > GMTCands(new std::vector<L1MuGMTCand>);
1045 
1046  // put empty records into event
1047 
1048  iEvent.put(gmtrc);
1049  iEvent.put(gtReadoutRecord);
1050 
1051  iEvent.put(DTCands, "DT");
1052  iEvent.put(CSCCands, "CSC");
1053  iEvent.put(RPCbCands, "RPCb");
1054  iEvent.put(RPCfCands, "RPCf");
1055  iEvent.put(GMTCands);
1056 
1057 }
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
void L1GlobalTriggerRawToDigi::unpackGMT ( const unsigned char *  chp,
std::auto_ptr< L1MuGMTReadoutCollection > &  gmtrc,
edm::Event iEvent 
)
private

unpack the GMT record

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

871  {
872 
873  //LogDebug("L1GlobalTriggerRawToDigi")
874  //<< "\nUnpacking GMT collection.\n"
875  //<< std::endl;
876 
877  // 17*64/2 TODO FIXME ask Ivan for a getSize() function for GMT record
878  const unsigned int gmtRecordSize32 = 34;
879 
880  std::auto_ptr<std::vector<L1MuRegionalCand> > DTCands(new std::vector<L1MuRegionalCand>);
881  std::auto_ptr<std::vector<L1MuRegionalCand> > CSCCands(new std::vector<L1MuRegionalCand>);
882  std::auto_ptr<std::vector<L1MuRegionalCand> > RPCbCands(new std::vector<L1MuRegionalCand>);
883  std::auto_ptr<std::vector<L1MuRegionalCand> > RPCfCands(new std::vector<L1MuRegionalCand>);
884  std::auto_ptr<std::vector<L1MuGMTCand> > GMTCands(new std::vector<L1MuGMTCand>);
885 
886  const unsigned* p = (const unsigned*) chp;
887 
888  // min Bx's in the event, computed after m_totalBxInEvent is obtained from GTFE block
889  // assume symmetrical number of BX around L1Accept
890  int iBxInEvent = ( m_totalBxInEvent + 1 ) / 2 - m_totalBxInEvent;
891 
892  for (int iGmtRec = 0; iGmtRec < m_totalBxInEvent; ++iGmtRec) {
893 
894  // unpack only bxInEvent requested, otherwise skip it
895  if ( ( iGmtRec >= m_lowSkipBxInEvent ) && ( iGmtRec < m_uppSkipBxInEvent )) {
896 
897  // Dump the block
898  const cms_uint64_t* bp =
899  reinterpret_cast<cms_uint64_t*> (const_cast<unsigned*> (p));
900  for (int iWord = 0; iWord < 17; iWord++) {
901  LogTrace("L1GlobalTriggerRawToDigi") << std::setw(4) << iWord << " " << std::hex
902  << std::setfill('0') << std::setw(16) << *bp++ << std::dec << std::setfill(
903  ' ') << std::endl;
904  }
905 
906  L1MuGMTReadoutRecord gmtrr(iBxInEvent);
907 
908  gmtrr.setEvNr( ( *p ) & 0xffffff);
909  gmtrr.setBCERR( ( ( *p ) >> 24 ) & 0xff);
910  p++;
911 
912  gmtrr.setBxNr( ( *p ) & 0xfff);
913  if ( ( ( *p ) >> 15 ) & 1) {
914  gmtrr.setBxInEvent( ( ( ( *p ) >> 12 ) & 7 ) - 8);
915  } else {
916  gmtrr.setBxInEvent( ( ( ( *p ) >> 12 ) & 7 ));
917  }
918  // to do: check here the block length and the board id
919  p++;
920 
921  for (int im = 0; im < 16; im++) {
922  // flip the pt and quality bits -- this should better be done by GMT input chips
923  unsigned waux = *p++;
924  waux = ( waux & 0xffff00ff ) | ( ( ~waux ) & 0x0000ff00 );
925  L1MuRegionalCand cand(waux, iBxInEvent);
926  // fix the type assignment (csc=2, rpcb=1) -- should be done by GMT input chips
927  if (im >= 4 && im < 8) cand.setType(1);
928  if (im >= 8 && im < 12) cand.setType(2);
929  cand.setPhiValue(m_TriggerScales->getPhiScale()->getLowEdge(cand.phi_packed()));
930  cand.setEtaValue(m_TriggerScales->getRegionalEtaScale(cand.type_idx())->getCenter(
931  cand.eta_packed()));
932  cand.setPtValue(m_TriggerPtScale->getPtScale()->getLowEdge(cand.pt_packed()));
933  gmtrr.setInputCand(im, cand);
934  if (!cand.empty()) {
935  if (im < 4) DTCands->push_back(cand);
936  if (im >= 4 && im < 8) RPCbCands->push_back(cand);
937  if (im >= 8 && im < 12) CSCCands->push_back(cand);
938  if (im >= 12) RPCfCands->push_back(cand);
939  }
940  }
941 
942  unsigned char* prank = (unsigned char*) ( p + 12 );
943 
944  for (int im = 0; im < 12; im++) {
945  unsigned waux = *p++;
946  unsigned raux = im < 8 ? *prank++ : 0; // only fwd and brl cands have valid rank
947  L1MuGMTExtendedCand cand(waux, raux, iBxInEvent);
948  cand.setPhiValue(m_TriggerScales->getPhiScale()->getLowEdge(cand.phiIndex()));
949  cand.setEtaValue(m_TriggerScales->getGMTEtaScale()->getCenter(cand.etaIndex()));
950  cand.setPtValue(m_TriggerPtScale->getPtScale()->getLowEdge(cand.ptIndex()));
951  if (im < 4)
952  gmtrr.setGMTBrlCand(im, cand);
953  else if (im < 8)
954  gmtrr.setGMTFwdCand(im - 4, cand);
955  else {
956  gmtrr.setGMTCand(im - 8, cand);
957  if (!cand.empty()) GMTCands->push_back(cand);
958  }
959  }
960 
961  // skip the two sort rank words and two chip BX words
962  p += 4;
963 
964  gmtrc->addRecord(gmtrr);
965 
966  } else {
967  // increase the pointer with the GMT record size
968  p += gmtRecordSize32;
969  }
970 
971  // increase the BxInEvent number
972  iBxInEvent++;
973 
974  }
975 
976  iEvent.put(DTCands, "DT");
977  iEvent.put(CSCCands, "CSC");
978  iEvent.put(RPCbCands, "RPCb");
979  iEvent.put(RPCfCands, "RPCf");
980  iEvent.put(GMTCands);
981 
982 }
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:120
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 779 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().

779  {
780 
781  // TODO if needed in another format
782 
783  // print the header info
784  if (m_verbosity && m_isDebugEnabled) {
785 
786  const cms_uint64_t* payload =
787  reinterpret_cast<cms_uint64_t*> (const_cast<unsigned char*> (gtPtr));
788 
789  std::ostringstream myCoutStream;
790 
791  // one word only
792  int iWord = 0;
793 
794  myCoutStream << std::setw(4) << iWord << " " << std::hex << std::setfill('0')
795  << std::setw(16) << payload[iWord] << std::dec << std::setfill(' ') << "\n"
796  << std::endl;
797 
798  myCoutStream << " Event_type: " << std::hex << " hex: " << " " << std::setw(1)
799  << std::setfill('0') << cmsHeader.triggerType() << std::setfill(' ') << std::dec
800  << " dec: " << cmsHeader.triggerType() << std::endl;
801 
802  myCoutStream << " LVL1_Id: " << std::hex << " hex: " << "" << std::setw(6)
803  << std::setfill('0') << cmsHeader.lvl1ID() << std::setfill(' ') << std::dec
804  << " dec: " << cmsHeader.lvl1ID() << std::endl;
805 
806  myCoutStream << " BX_Id: " << std::hex << " hex: " << " " << std::setw(3)
807  << std::setfill('0') << cmsHeader.bxID() << std::setfill(' ') << std::dec
808  << " dec: " << cmsHeader.bxID() << std::endl;
809 
810  myCoutStream << " Source_Id: " << std::hex << " hex: " << " " << std::setw(3)
811  << std::setfill('0') << cmsHeader.sourceID() << std::setfill(' ') << std::dec
812  << " dec: " << cmsHeader.sourceID() << std::endl;
813 
814  myCoutStream << " FOV: " << std::hex << " hex: " << " " << std::setw(1)
815  << std::setfill('0') << cmsHeader.version() << std::setfill(' ') << std::dec
816  << " dec: " << cmsHeader.version() << std::endl;
817 
818  myCoutStream << " H: " << std::hex << " hex: " << " " << std::setw(1)
819  << std::setfill('0') << cmsHeader.moreHeaders() << std::setfill(' ') << std::dec
820  << " dec: " << cmsHeader.moreHeaders() << std::endl;
821 
822  LogDebug("L1GlobalTriggerRawToDigi") << "\n CMS Header \n" << myCoutStream.str() << "\n"
823  << std::endl;
824 
825  }
826 
827 }
#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 831 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().

832  {
833 
834  //LogDebug("L1GlobalTriggerRawToDigi")
835  //<< "\nUnpacking PSB block.\n"
836  //<< std::endl;
837 
839 
840  int psbSize = psbWord.getSize();
841  int psbWords = psbSize / uLength;
842 
843  const cms_uint64_t* payload =
844  reinterpret_cast<cms_uint64_t*> (const_cast<unsigned char*> (psbPtr));
845 
846  for (int iWord = 0; iWord < psbWords; ++iWord) {
847 
848  // fill PSB
849  // the second argument must match the word index defined in L1GtPsbWord class
850 
851  psbWord.setBoardId(payload[iWord], iWord);
852  psbWord.setBxInEvent(payload[iWord], iWord);
853  psbWord.setBxNr(payload[iWord], iWord);
854  psbWord.setEventNr(payload[iWord], iWord);
855 
856  psbWord.setAData(payload[iWord], iWord);
857  psbWord.setBData(payload[iWord], iWord);
858 
859  psbWord.setLocalBxNr(payload[iWord], iWord);
860 
861  LogTrace("L1GlobalTriggerRawToDigi") << std::setw(4) << iWord << " " << std::hex
862  << std::setfill('0') << std::setw(16) << payload[iWord] << std::dec
863  << std::setfill(' ') << std::endl;
864 
865  }
866 
867 }
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 986 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().

986  {
987 
988  // TODO if needed in another format
989 
990  // print the trailer info
991  if (m_verbosity && m_isDebugEnabled) {
992 
993  const cms_uint64_t* payload =
994  reinterpret_cast<cms_uint64_t*> (const_cast<unsigned char*> (trlPtr));
995 
996  std::ostringstream myCoutStream;
997 
998  // one word only
999  int iWord = 0;
1000 
1001  myCoutStream << std::setw(4) << iWord << " " << std::hex << std::setfill('0')
1002  << std::setw(16) << payload[iWord] << std::dec << std::setfill(' ') << "\n"
1003  << std::endl;
1004 
1005  myCoutStream << " Event_length: " << std::hex << " hex: " << "" << std::setw(6)
1006  << std::setfill('0') << cmsTrailer.lenght() << std::setfill(' ') << std::dec
1007  << " dec: " << cmsTrailer.lenght() << std::endl;
1008 
1009  myCoutStream << " CRC: " << std::hex << " hex: " << " " << std::setw(4)
1010  << std::setfill('0') << cmsTrailer.crc() << std::setfill(' ') << std::dec
1011  << " dec: " << cmsTrailer.crc() << std::endl;
1012 
1013  myCoutStream << " Event_status: " << std::hex << " hex: " << " " << std::setw(2)
1014  << std::setfill('0') << cmsTrailer.evtStatus() << std::setfill(' ') << std::dec
1015  << " dec: " << cmsTrailer.evtStatus() << std::endl;
1016 
1017  myCoutStream << " TTS_bits: " << std::hex << " hex: " << " " << std::setw(1)
1018  << std::setfill('0') << cmsTrailer.ttsBits() << std::setfill(' ') << std::dec
1019  << " dec: " << cmsTrailer.ttsBits() << std::endl;
1020 
1021  myCoutStream << " More trailers: " << std::hex << " hex: " << " " << std::setw(1)
1022  << std::setfill('0') << cmsTrailer.moreTrailers() << std::setfill(' ') << std::dec
1023  << " dec: " << cmsTrailer.moreTrailers() << std::endl;
1024 
1025  LogDebug("L1GlobalTriggerRawToDigi") << "\n CMS Trailer \n" << myCoutStream.str() << "\n"
1026  << std::endl;
1027 
1028  }
1029 
1030 }
#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 106 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 103 of file L1GlobalTriggerRawToDigi.h.

Referenced by L1GlobalTriggerRawToDigi(), and produce().

edm::InputTag L1GlobalTriggerRawToDigi::m_daqGtInputTag
private

input tags for GT DAQ record

Definition at line 99 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 113 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 122 of file L1GlobalTriggerRawToDigi.h.

Referenced by produce().

int L1GlobalTriggerRawToDigi::m_recordLength1
private

corresponding to alternative 1 in altNrBxBoard()

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

Referenced by produce(), and unpackGMT().

const L1MuTriggerPtScale* L1GlobalTriggerRawToDigi::m_TriggerPtScale
private

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

Referenced by produce(), and unpackGMT().

int L1GlobalTriggerRawToDigi::m_unpackBxInEvent
private

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

Referenced by produce(), and unpackGMT().

int L1GlobalTriggerRawToDigi::m_verbosity
private

verbosity level

Definition at line 138 of file L1GlobalTriggerRawToDigi.h.

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