46 m_firstEv(
true), m_firstEvLumiSegment(
true), m_firstEvRun(
true),
67 const std::vector<int> &prescaleFactorsTechTrig,
68 const std::vector<unsigned int> &triggerMaskAlgoTrig,
69 const std::vector<unsigned int> &triggerMaskTechTrig,
70 const std::vector<unsigned int> &triggerMaskVetoAlgoTrig,
71 const std::vector<unsigned int> &triggerMaskVetoTechTrig,
72 const std::vector<L1GtBoard> &boardMaps,
const int totalBxInEvent,
73 const int iBxInEvent,
const unsigned int numberPhysTriggers,
74 const unsigned int numberTechnicalTriggers,
77 const int pfTechSetIndex,
const bool algorithmTriggersUnprescaled,
78 const bool algorithmTriggersUnmasked,
79 const bool technicalTriggersUnprescaled,
80 const bool technicalTriggersUnmasked,
81 const bool technicalTriggersVetoUnmasked) {
84 const unsigned int numberPhysTriggersSet =
88 std::bitset<numberPhysTriggersSet> gtlDecisionWord = ptrGTL->
getAlgorithmOR();
93 for (
unsigned int iBit = 0; iBit < numberPhysTriggers; ++iBit) {
95 bool bitValue = gtlDecisionWord.test(iBit);
96 algoDecisionWord[iBit] = bitValue;
106 for (
int iBxInEvent = 0; iBxInEvent <= totalBxInEvent; ++iBxInEvent) {
114 for (
int iBxInEvent = 0; iBxInEvent <= totalBxInEvent; ++iBxInEvent) {
126 for (
int iBxInEvent = 0; iBxInEvent <= totalBxInEvent; ++iBxInEvent) {
131 for (
int iBxInEvent = 0; iBxInEvent <= totalBxInEvent; ++iBxInEvent) {
141 int inBxInEvent = totalBxInEvent / 2 + iBxInEvent;
143 for (
unsigned int iBit = 0; iBit < numberPhysTriggers; ++iBit) {
145 if ((!algorithmTriggersUnprescaled) &&
146 (prescaleFactorsAlgoTrig.at(iBit) != 1)) {
148 bool bitValue = algoDecisionWord.at(iBit);
156 prescaleFactorsAlgoTrig.at(iBit);
166 algoDecisionWord[iBit] =
false;
188 for (
unsigned int iBit = 0; iBit < numberTechnicalTriggers; ++iBit) {
190 if ((!technicalTriggersUnprescaled) &&
191 (prescaleFactorsTechTrig.at(iBit) != 1)) {
193 bool bitValue = techDecisionWord.at(iBit);
201 prescaleFactorsTechTrig.at(iBit);
211 techDecisionWord[iBit] =
false;
229 boost::uint16_t finalOrValue = 0;
231 for (
unsigned int iDaq = 0; iDaq < numberDaqPartitions; ++iDaq) {
233 bool daqPartitionFinalOR =
false;
238 bool vetoTechTrig =
false;
241 if (!technicalTriggersVetoUnmasked) {
243 for (
unsigned int iBit = 0; iBit < numberTechnicalTriggers; ++iBit) {
245 int triggerMaskVetoTechTrigBit =
246 triggerMaskVetoTechTrig[iBit] & (1 << iDaq);
253 if (triggerMaskVetoTechTrigBit && techDecisionWord[iBit]) {
255 daqPartitionFinalOR =
false;
273 bool algoFinalOr =
false;
275 for (
unsigned int iBit = 0; iBit < numberPhysTriggers; ++iBit) {
277 bool iBitDecision =
false;
279 int triggerMaskAlgoTrigBit = -1;
281 if (algorithmTriggersUnmasked) {
282 triggerMaskAlgoTrigBit = 0;
284 triggerMaskAlgoTrigBit = triggerMaskAlgoTrig[iBit] & (1 << iDaq);
292 if (triggerMaskAlgoTrigBit) {
293 iBitDecision =
false;
299 iBitDecision = algoDecisionWord[iBit];
302 algoFinalOr = algoFinalOr || iBitDecision;
308 bool techFinalOr =
false;
310 for (
unsigned int iBit = 0; iBit < numberTechnicalTriggers; ++iBit) {
312 bool iBitDecision =
false;
314 int triggerMaskTechTrigBit = -1;
316 if (technicalTriggersUnmasked) {
317 triggerMaskTechTrigBit = 0;
319 triggerMaskTechTrigBit = triggerMaskTechTrig[iBit] & (1 << iDaq);
326 if (triggerMaskTechTrigBit) {
328 iBitDecision =
false;
334 iBitDecision = techDecisionWord[iBit];
337 techFinalOr = techFinalOr || iBitDecision;
340 daqPartitionFinalOR = algoFinalOr || techFinalOr;
344 daqPartitionFinalOR =
false;
348 boost::uint16_t daqPartitionFinalORValue =
349 static_cast<boost::uint16_t
>(daqPartitionFinalOR);
351 finalOrValue = finalOrValue | (daqPartitionFinalORValue << iDaq);
356 typedef std::vector<L1GtBoard>::const_iterator CItBoardMaps;
357 for (CItBoardMaps itBoard = boardMaps.begin(); itBoard != boardMaps.end();
360 if ((itBoard->gtBoardType() ==
FDL)) {
372 boost::uint16_t bxCrossHw = 0;
373 if ((bxCross & 0xFFF) == bxCross) {
374 bxCrossHw =
static_cast<boost::uint16_t
>(bxCross);
379 <<
"\nBunch cross number [hex] = " << std::hex << bxCross
380 <<
"\n larger than 12 bits. Set to 0! \n" 389 static_cast<boost::uint32_t>(iEvent.
id().
event()));
399 static_cast<boost::uint16_t>(pfTechSetIndex));
401 static_cast<boost::uint16_t>(pfAlgoSetIndex));
410 static_cast<boost::uint32_t>(iEvent.
orbitNumber()));
424 const int iBxInEvent,
const boost::uint16_t &activeBoardsGtDaq,
425 const int recordLength0,
const int recordLength1,
426 const unsigned int altNrBxBoardDaq,
const std::vector<L1GtBoard> &boardMaps,
429 typedef std::vector<L1GtBoard>::const_iterator CItBoardMaps;
430 for (CItBoardMaps itBoard = boardMaps.begin(); itBoard != boardMaps.end();
433 int iPosition = itBoard->gtPositionDaqRecord();
436 int iActiveBit = itBoard->gtBitDaqActiveBoards();
437 bool activeBoard =
false;
438 bool writeBoard =
false;
442 if (iActiveBit >= 0) {
443 activeBoard = activeBoardsGtDaq & (1 << iActiveBit);
445 int altNrBxBoard = (altNrBxBoardDaq & (1 << iActiveBit)) >> iActiveBit;
447 if (altNrBxBoard == 1) {
448 recLength = recordLength1;
450 recLength = recordLength0;
453 int lowBxInEvent = (recLength + 1) / 2 - recLength;
454 int uppBxInEvent = (recLength + 1) / 2 - 1;
456 if ((iBxInEvent >= lowBxInEvent) && (iBxInEvent <= uppBxInEvent)) {
461 if (activeBoard && writeBoard && (itBoard->gtBoardType() ==
FDL)) {
471 const int iBxInEvent,
const boost::uint16_t &activeBoardsGtEvm,
472 const int recordLength0,
const int recordLength1,
473 const unsigned int altNrBxBoardEvm,
const std::vector<L1GtBoard> &boardMaps,
476 typedef std::vector<L1GtBoard>::const_iterator CItBoardMaps;
477 for (CItBoardMaps itBoard = boardMaps.begin(); itBoard != boardMaps.end();
480 int iPosition = itBoard->gtPositionEvmRecord();
483 int iActiveBit = itBoard->gtBitEvmActiveBoards();
484 bool activeBoard =
false;
486 if (iActiveBit >= 0) {
487 activeBoard = activeBoardsGtEvm & (1 << iActiveBit);
490 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 setGtDecisionWord(const DecisionWord >DecisionWordValue)
void setLocalBxNr(const cms_uint16_t &localBxNrValue)
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, L1GlobalTriggerEvmReadoutRecord *gtEvmReadoutRecord)
fill the FDL block in the L1 GT EVM record for iBxInEvent
void setGtFdlWord(const L1GtFdlWord &, int bxInEventValue)
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)
void setGtFdlWord(const L1GtFdlWord &, int bxInEvent)
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, L1GlobalTriggerReadoutRecord *gtDaqReadoutRecord)
fill the FDL block in the L1 GT DAQ record for iBxInEvent