47 m_firstEvLumiSegment(
true),
66 const std::vector<int> &prescaleFactorsAlgoTrig,
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,
73 const int totalBxInEvent,
75 const unsigned int numberPhysTriggers,
76 const unsigned int numberTechnicalTriggers,
77 const unsigned int numberDaqPartitions,
80 const int pfAlgoSetIndex,
81 const int pfTechSetIndex,
82 const bool algorithmTriggersUnprescaled,
83 const bool algorithmTriggersUnmasked,
84 const bool technicalTriggersUnprescaled,
85 const bool technicalTriggersUnmasked,
86 const bool technicalTriggersVetoUnmasked) {
91 std::bitset<numberPhysTriggersSet> gtlDecisionWord = ptrGTL->
getAlgorithmOR();
96 for (
unsigned int iBit = 0; iBit < numberPhysTriggers; ++iBit) {
97 bool bitValue = gtlDecisionWord.test(iBit);
98 algoDecisionWord[iBit] = bitValue;
107 for (
int iBxInEvent = 0; iBxInEvent <= totalBxInEvent; ++iBxInEvent) {
114 for (
int iBxInEvent = 0; iBxInEvent <= totalBxInEvent; ++iBxInEvent) {
124 for (
int iBxInEvent = 0; iBxInEvent <= totalBxInEvent; ++iBxInEvent) {
129 for (
int iBxInEvent = 0; iBxInEvent <= totalBxInEvent; ++iBxInEvent) {
139 int inBxInEvent = totalBxInEvent / 2 + iBxInEvent;
141 for (
unsigned int iBit = 0; iBit < numberPhysTriggers; ++iBit) {
142 if ((!algorithmTriggersUnprescaled) && (prescaleFactorsAlgoTrig.at(iBit) != 1)) {
143 bool bitValue = algoDecisionWord.at(iBit);
157 algoDecisionWord[iBit] =
false;
179 for (
unsigned int iBit = 0; iBit < numberTechnicalTriggers; ++iBit) {
180 if ((!technicalTriggersUnprescaled) && (prescaleFactorsTechTrig.at(iBit) != 1)) {
181 bool bitValue = techDecisionWord.at(iBit);
195 techDecisionWord[iBit] =
false;
213 uint16_t finalOrValue = 0;
215 for (
unsigned int iDaq = 0; iDaq < numberDaqPartitions; ++iDaq) {
216 bool daqPartitionFinalOR =
false;
221 bool vetoTechTrig =
false;
224 if (!technicalTriggersVetoUnmasked) {
225 for (
unsigned int iBit = 0; iBit < numberTechnicalTriggers; ++iBit) {
226 int triggerMaskVetoTechTrigBit = triggerMaskVetoTechTrig[iBit] & (1 << iDaq);
233 if (triggerMaskVetoTechTrigBit && techDecisionWord[iBit]) {
234 daqPartitionFinalOR =
false;
251 bool algoFinalOr =
false;
253 for (
unsigned int iBit = 0; iBit < numberPhysTriggers; ++iBit) {
254 bool iBitDecision =
false;
256 int triggerMaskAlgoTrigBit = -1;
258 if (algorithmTriggersUnmasked) {
259 triggerMaskAlgoTrigBit = 0;
261 triggerMaskAlgoTrigBit = triggerMaskAlgoTrig[iBit] & (1 << iDaq);
269 if (triggerMaskAlgoTrigBit) {
270 iBitDecision =
false;
276 iBitDecision = algoDecisionWord[iBit];
279 algoFinalOr = algoFinalOr || iBitDecision;
285 bool techFinalOr =
false;
287 for (
unsigned int iBit = 0; iBit < numberTechnicalTriggers; ++iBit) {
288 bool iBitDecision =
false;
290 int triggerMaskTechTrigBit = -1;
292 if (technicalTriggersUnmasked) {
293 triggerMaskTechTrigBit = 0;
295 triggerMaskTechTrigBit = triggerMaskTechTrig[iBit] & (1 << iDaq);
302 if (triggerMaskTechTrigBit) {
303 iBitDecision =
false;
309 iBitDecision = techDecisionWord[iBit];
312 techFinalOr = techFinalOr || iBitDecision;
315 daqPartitionFinalOR = algoFinalOr || techFinalOr;
318 daqPartitionFinalOR =
false;
322 uint16_t daqPartitionFinalORValue =
static_cast<uint16_t
>(daqPartitionFinalOR);
324 finalOrValue = finalOrValue | (daqPartitionFinalORValue << iDaq);
329 typedef std::vector<L1GtBoard>::const_iterator CItBoardMaps;
330 for (CItBoardMaps itBoard = boardMaps.begin(); itBoard != boardMaps.end(); ++itBoard) {
331 if ((itBoard->gtBoardType() ==
FDL)) {
341 int bxCross =
iEvent.bunchCrossing();
342 uint16_t bxCrossHw = 0;
343 if ((bxCross & 0xFFF) == bxCross) {
344 bxCrossHw =
static_cast<uint16_t
>(bxCross);
348 LogDebug(
"L1GlobalTrigger") <<
"\nBunch cross number [hex] = " << std::hex << bxCross
349 <<
"\n larger than 12 bits. Set to 0! \n" 388 const uint16_t &activeBoardsGtDaq,
389 const int recordLength0,
390 const int recordLength1,
391 const unsigned int altNrBxBoardDaq,
392 const std::vector<L1GtBoard> &boardMaps,
394 typedef std::vector<L1GtBoard>::const_iterator CItBoardMaps;
395 for (CItBoardMaps itBoard = boardMaps.begin(); itBoard != boardMaps.end(); ++itBoard) {
396 int iPosition = itBoard->gtPositionDaqRecord();
398 int iActiveBit = itBoard->gtBitDaqActiveBoards();
399 bool activeBoard =
false;
400 bool writeBoard =
false;
404 if (iActiveBit >= 0) {
405 activeBoard = activeBoardsGtDaq & (1 << iActiveBit);
407 int altNrBxBoard = (altNrBxBoardDaq & (1 << iActiveBit)) >> iActiveBit;
409 if (altNrBxBoard == 1) {
410 recLength = recordLength1;
412 recLength = recordLength0;
415 int lowBxInEvent = (recLength + 1) / 2 - recLength;
416 int uppBxInEvent = (recLength + 1) / 2 - 1;
418 if ((iBxInEvent >= lowBxInEvent) && (iBxInEvent <= uppBxInEvent)) {
423 if (activeBoard && writeBoard && (itBoard->gtBoardType() ==
FDL)) {
432 const uint16_t &activeBoardsGtEvm,
433 const int recordLength0,
434 const int recordLength1,
435 const unsigned int altNrBxBoardEvm,
436 const std::vector<L1GtBoard> &boardMaps,
438 typedef std::vector<L1GtBoard>::const_iterator CItBoardMaps;
439 for (CItBoardMaps itBoard = boardMaps.begin(); itBoard != boardMaps.end(); ++itBoard) {
440 int iPosition = itBoard->gtPositionEvmRecord();
442 int iActiveBit = itBoard->gtBitEvmActiveBoards();
443 bool activeBoard =
false;
445 if (iActiveBit >= 0) {
446 activeBoard = activeBoardsGtEvm & (1 << iActiveBit);
449 if (activeBoard && (itBoard->gtBoardType() ==
FDL)) {
void setBoardId(const cms_uint16_t &boardIdValue)
set BoardId from a BoardId value
void setFinalOR(const cms_uint16_t &finalORValue)
L1GtFdlWord * m_gtFdlWord
void setEventNr(const cms_uint32_t &eventNrValue)
void setGtDecisionWord(const DecisionWord >DecisionWordValue)
void setLocalBxNr(const cms_uint16_t &localBxNrValue)
void setGtFdlWord(const L1GtFdlWord &, int bxInEventValue)
void setGtTechnicalTriggerWord(const TechnicalTriggerWord >TechnicalTriggerWordValue)
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 fillDaqFdlBlock(const int iBxInEvent, const 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
void reset()
reset the content of a L1GtFdlWord
void fillEvmFdlBlock(const int iBxInEvent, const 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
static const unsigned int NumberPhysTriggers
L1GlobalTriggerFDL()
constructor
void setGtPrescaleFactorIndexAlgo(const cms_uint16_t >PrescaleFactorIndexAlgoValue)
void setGtPrescaleFactorIndexTech(const cms_uint16_t >PrescaleFactorIndexTechValue)
const std::vector< bool > * getGtTechnicalTriggers() const
pointer to technical trigger bits
void setGtFdlWord(const L1GtFdlWord &, int bxInEvent)
const std::bitset< L1GlobalTriggerReadoutSetup::NumberPhysTriggers > & getAlgorithmOR() const
return algorithm OR decision
virtual ~L1GlobalTriggerFDL()
destructor
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)