51 m_firstEvLumiSegment(
true),
78 const std::vector<int>& prescaleFactorsAlgoTrig,
79 const std::vector<int>& prescaleFactorsTechTrig,
80 const std::vector<unsigned int>& triggerMaskAlgoTrig,
81 const std::vector<unsigned int>& triggerMaskTechTrig,
82 const std::vector<unsigned int>& triggerMaskVetoAlgoTrig,
83 const std::vector<unsigned int>& triggerMaskVetoTechTrig,
84 const std::vector<L1GtBoard>& boardMaps,
85 const int totalBxInEvent,
87 const unsigned int numberPhysTriggers,
const unsigned int numberTechnicalTriggers,
88 const unsigned int numberDaqPartitions,
91 const int pfAlgoSetIndex,
92 const int pfTechSetIndex,
93 const bool algorithmTriggersUnprescaled,
94 const bool algorithmTriggersUnmasked,
95 const bool technicalTriggersUnprescaled,
96 const bool technicalTriggersUnmasked,
97 const bool technicalTriggersVetoUnmasked
102 const unsigned int numberPhysTriggersSet =
106 std::bitset<numberPhysTriggersSet> gtlDecisionWord = ptrGTL->
getAlgorithmOR();
111 for (
unsigned int iBit = 0; iBit < numberPhysTriggers; ++iBit) {
113 bool bitValue = gtlDecisionWord.test( iBit );
114 algoDecisionWord[ iBit ] = bitValue;
124 for (
int iBxInEvent = 0; iBxInEvent <= totalBxInEvent; ++iBxInEvent) {
132 for (
int iBxInEvent = 0; iBxInEvent <= totalBxInEvent; ++iBxInEvent) {
144 for (
int iBxInEvent = 0; iBxInEvent <= totalBxInEvent; ++iBxInEvent) {
149 for (
int iBxInEvent = 0; iBxInEvent <= totalBxInEvent; ++iBxInEvent) {
161 int inBxInEvent = totalBxInEvent/2 + iBxInEvent;
163 for (
unsigned int iBit = 0; iBit < numberPhysTriggers; ++iBit) {
165 if ((!algorithmTriggersUnprescaled) && (prescaleFactorsAlgoTrig.at(iBit) != 1)) {
167 bool bitValue = algoDecisionWord.at( iBit );
175 prescaleFactorsAlgoTrig.at(iBit);
185 algoDecisionWord[iBit] =
false;;
207 for (
unsigned int iBit = 0; iBit < numberTechnicalTriggers; ++iBit) {
209 if ((!technicalTriggersUnprescaled) && (prescaleFactorsTechTrig.at(iBit) != 1)) {
211 bool bitValue = techDecisionWord.at( iBit );
219 prescaleFactorsTechTrig.at(iBit);
229 techDecisionWord[iBit] =
false;
247 boost::uint16_t finalOrValue = 0;
249 for (
unsigned int iDaq = 0; iDaq < numberDaqPartitions; ++iDaq) {
251 bool daqPartitionFinalOR =
false;
256 bool vetoTechTrig =
false;
259 if (!technicalTriggersVetoUnmasked) {
261 for (
unsigned int iBit = 0; iBit < numberTechnicalTriggers; ++iBit) {
263 int triggerMaskVetoTechTrigBit = triggerMaskVetoTechTrig[iBit]
271 if (triggerMaskVetoTechTrigBit && techDecisionWord[iBit]) {
273 daqPartitionFinalOR =
false;
291 bool algoFinalOr =
false;
293 for (
unsigned int iBit = 0; iBit < numberPhysTriggers; ++iBit) {
295 bool iBitDecision =
false;
297 int triggerMaskAlgoTrigBit = -1;
299 if (algorithmTriggersUnmasked) {
300 triggerMaskAlgoTrigBit = 0;
302 triggerMaskAlgoTrigBit = triggerMaskAlgoTrig[iBit] & (1
312 if (triggerMaskAlgoTrigBit) {
313 iBitDecision =
false;
319 iBitDecision = algoDecisionWord[iBit];
322 algoFinalOr = algoFinalOr || iBitDecision;
328 bool techFinalOr =
false;
330 for (
unsigned int iBit = 0; iBit < numberTechnicalTriggers; ++iBit) {
332 bool iBitDecision =
false;
334 int triggerMaskTechTrigBit = -1;
336 if (technicalTriggersUnmasked) {
337 triggerMaskTechTrigBit = 0;
339 triggerMaskTechTrigBit = triggerMaskTechTrig[iBit] & (1
347 if (triggerMaskTechTrigBit) {
349 iBitDecision =
false;
355 iBitDecision = techDecisionWord[iBit];
358 techFinalOr = techFinalOr || iBitDecision;
361 daqPartitionFinalOR = algoFinalOr || techFinalOr;
365 daqPartitionFinalOR =
false;
370 boost::uint16_t daqPartitionFinalORValue =
371 static_cast<boost::uint16_t
>(daqPartitionFinalOR);
373 finalOrValue = finalOrValue | (daqPartitionFinalORValue << iDaq);
380 typedef std::vector<L1GtBoard>::const_iterator CItBoardMaps;
382 itBoard = boardMaps.begin();
383 itBoard != boardMaps.end(); ++itBoard) {
386 if ((itBoard->gtBoardType() ==
FDL)) {
398 boost::uint16_t bxCrossHw = 0;
399 if ((bxCross & 0xFFF) == bxCross) {
400 bxCrossHw =
static_cast<boost::uint16_t
> (bxCross);
406 <<
"\nBunch cross number [hex] = "
407 << std::hex << bxCross
408 <<
"\n larger than 12 bits. Set to 0! \n"
409 << std::dec << std::endl;
417 static_cast<boost::uint32_t>(iEvent.
id().
event()) );
452 const boost::uint16_t& activeBoardsGtDaq,
const int recordLength0,
453 const int recordLength1,
const unsigned int altNrBxBoardDaq,
454 const std::vector<L1GtBoard>& boardMaps,
455 std::auto_ptr<L1GlobalTriggerReadoutRecord>& gtDaqReadoutRecord)
458 typedef std::vector<L1GtBoard>::const_iterator CItBoardMaps;
460 itBoard = boardMaps.begin();
461 itBoard != boardMaps.end(); ++itBoard) {
463 int iPosition = itBoard->gtPositionDaqRecord();
466 int iActiveBit = itBoard->gtBitDaqActiveBoards();
467 bool activeBoard =
false;
468 bool writeBoard =
false;
472 if (iActiveBit >= 0) {
473 activeBoard = activeBoardsGtDaq & ( 1 << iActiveBit );
475 int altNrBxBoard = (altNrBxBoardDaq & ( 1 << iActiveBit )) >> iActiveBit;
477 if (altNrBxBoard == 1) {
478 recLength = recordLength1;
480 recLength = recordLength0;
483 int lowBxInEvent = (recLength + 1)/2 - recLength;
484 int uppBxInEvent = (recLength + 1)/2 - 1;
486 if ((iBxInEvent >= lowBxInEvent) && (iBxInEvent <= uppBxInEvent)) {
492 if (activeBoard && writeBoard && (itBoard->gtBoardType() ==
FDL)) {
508 const boost::uint16_t& activeBoardsGtEvm,
const int recordLength0,
509 const int recordLength1,
const unsigned int altNrBxBoardEvm,
510 const std::vector<L1GtBoard>& boardMaps,
511 std::auto_ptr<L1GlobalTriggerEvmReadoutRecord>& gtEvmReadoutRecord)
514 typedef std::vector<L1GtBoard>::const_iterator CItBoardMaps;
516 itBoard = boardMaps.begin();
517 itBoard != boardMaps.end(); ++itBoard) {
519 int iPosition = itBoard->gtPositionEvmRecord();
522 int iActiveBit = itBoard->gtBitEvmActiveBoards();
523 bool activeBoard =
false;
525 if (iActiveBit >= 0) {
526 activeBoard = activeBoardsGtEvm & (1 << iActiveBit);
529 if (activeBoard && (itBoard->gtBoardType() ==
FDL)) {
EventNumber_t event() const
void setBoardId(const cms_uint16_t &boardIdValue)
set BoardId from a BoardId value
void setFinalOR(const cms_uint16_t &finalORValue)
L1GtFdlWord * m_gtFdlWord
int bunchCrossing() const
void setEventNr(const cms_uint32_t &eventNrValue)
edm::LuminosityBlockNumber_t luminosityBlock() const
void fillEvmFdlBlock(const int iBxInEvent, const boost::uint16_t &activeBoardsGtEvm, const int recordLength0, const int recordLength1, const unsigned int altNrBxBoardEvm, const std::vector< L1GtBoard > &boardMaps, std::auto_ptr< L1GlobalTriggerEvmReadoutRecord > >EvmReadoutRecord)
fill the FDL block in the L1 GT EVM record for iBxInEvent
void setGtDecisionWord(const DecisionWord >DecisionWordValue)
void setLocalBxNr(const cms_uint16_t &localBxNrValue)
void setGtTechnicalTriggerWord(const TechnicalTriggerWord >TechnicalTriggerWordValue)
const std::vector< bool > * getGtTechnicalTriggers() const
pointer to technical trigger bits
void setLumiSegmentNr(const cms_uint16_t &lumiSegmentNrValue)
std::vector< std::vector< int > > m_prescaleCounterAlgoTrig
prescale counters: NumberPhysTriggers counters per bunch cross in event
std::vector< bool > DecisionWord
typedefs
int m_verbosity
verbosity level
void reset()
reset the content of a L1GtFdlWord
static const unsigned int NumberPhysTriggers
L1GlobalTriggerFDL()
constructor
void setGtPrescaleFactorIndexAlgo(const cms_uint16_t >PrescaleFactorIndexAlgoValue)
void setGtPrescaleFactorIndexTech(const cms_uint16_t >PrescaleFactorIndexTechValue)
virtual ~L1GlobalTriggerFDL()
destructor
const std::bitset< L1GlobalTriggerReadoutSetup::NumberPhysTriggers > & getAlgorithmOR() const
return algorithm OR decision
bool m_firstEvLumiSegment
void run(edm::Event &iEvent, const std::vector< int > &prescaleFactorsAlgoTrig, const std::vector< int > &prescaleFactorsTechTrig, const std::vector< unsigned int > &triggerMaskAlgoTrig, const std::vector< unsigned int > &triggerMaskTechTrig, const std::vector< unsigned int > &triggerMaskVetoAlgoTrig, const std::vector< unsigned int > &triggerMaskVetoTechTrig, const std::vector< L1GtBoard > &boardMaps, const int totalBxInEvent, const int iBxInEvent, const unsigned int numberPhysTriggers, const unsigned int numberTechnicalTriggers, const unsigned int numberDaqPartitions, const L1GlobalTriggerGTL *ptrGTL, const L1GlobalTriggerPSB *ptrPSB, const int pfAlgoSetIndex, const int pfTechSetIndex, const bool algorithmTriggersUnprescaled, const bool algorithmTriggersUnmasked, const bool technicalTriggersUnprescaled, const bool technicalTriggersUnmasked, const bool technicalTriggersVetoUnmasked)
run the FDL
void setOrbitNr(const cms_uint32_t &orbitNrValue)
void setBxInEvent(const int bxInEventValue)
std::vector< std::vector< int > > m_prescaleCounterTechTrig
prescale counters: technical trigger counters per bunch cross in event
void setBxNr(const cms_uint16_t &bxNrValue)
void fillDaqFdlBlock(const int iBxInEvent, const boost::uint16_t &activeBoardsGtDaq, const int recordLength0, const int recordLength1, const unsigned int altNrBxBoardDaq, const std::vector< L1GtBoard > &boardMaps, std::auto_ptr< L1GlobalTriggerReadoutRecord > >DaqReadoutRecord)
fill the FDL block in the L1 GT DAQ record for iBxInEvent