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)) {