50 m_l1GtStableParCacheID(0ULL), m_numberAlgorithmTriggers(0),
52 m_numberTechnicalTriggers(0),
54 m_l1GtPfAlgoCacheID(0ULL), m_l1GtPfTechCacheID(0ULL),
56 m_l1GtTmAlgoCacheID(0ULL), m_l1GtTmTechCacheID(0ULL),
58 m_l1GtTmVetoAlgoCacheID(0ULL), m_l1GtTmVetoTechCacheID(0ULL),
60 m_l1GtMenuCacheID(0ULL),
62 m_l1EventSetupValid(
false),
64 m_l1GtMenuLiteValid(
false),
66 m_beginRunCache(
false),
72 m_physicsDaqPartition(0),
74 m_retrieveL1EventSetup(
false),
76 m_retrieveL1GtTriggerMenuLite(
false)
93 switch (trigCategory) {
95 return "Algorithm Trigger";
99 return "Technical Trigger";
122 unsigned long long l1GtStableParCacheID =
152 unsigned long long l1GtPfAlgoCacheID =
167 unsigned long long l1GtPfTechCacheID = evSetup.
get<
185 unsigned long long l1GtTmAlgoCacheID =
200 unsigned long long l1GtTmTechCacheID =
215 unsigned long long l1GtTmVetoAlgoCacheID =
230 unsigned long long l1GtTmVetoTechCacheID =
248 unsigned long long l1GtMenuCacheID =
277 iRun.
getByLabel(l1GtMenuLiteInputTag, l1GtMenuLite);
281 LogDebug(
"L1GtUtils") <<
"\nL1GtTriggerMenuLite with \n "
282 << l1GtMenuLiteInputTag
283 <<
"\nrequested in configuration, but not found in the event."
291 LogDebug(
"L1GtUtils") <<
"\nL1GtTriggerMenuLite with \n "
292 << l1GtMenuLiteInputTag <<
"\nretrieved for run "
321 if (useL1EventSetup) {
330 if (useL1GtTriggerMenuLite) {
341 if (useL1GtTriggerMenuLite) {
346 getL1GtRunCache(iRun, evSetup, useL1EventSetup, useL1GtTriggerMenuLite,
362 if (useL1EventSetup) {
378 if (useL1GtTriggerMenuLite) {
408 if (useL1GtTriggerMenuLite) {
421 getL1GtRunCache(iEvent, evSetup, useL1EventSetup, useL1GtTriggerMenuLite,
431 typedef std::vector<edm::Provenance const*> Provenances;
432 Provenances provenances;
438 bool foundL1GtRecord =
false;
439 bool foundL1GtReadoutRecord =
false;
441 LogDebug(
"L1GtUtils") <<
"\nTry to get AllProvenance for event "
442 << iEvent.
id().
event() << std::endl;
446 LogTrace(
"L1GtUtils") <<
"\n" <<
"Event contains " << provenances.size()
447 <<
" product" << (provenances.size() == 1 ?
"" :
"s")
448 <<
" with friendlyClassName, moduleLabel, productInstanceName and processName:\n"
451 for (Provenances::iterator itProv = provenances.begin(), itProvEnd =
452 provenances.end(); itProv != itProvEnd; ++itProv) {
454 friendlyName = (*itProv)->friendlyClassName();
455 modLabel = (*itProv)->moduleLabel();
456 instanceName = (*itProv)->productInstanceName();
457 processName = (*itProv)->processName();
459 LogTrace(
"L1GtUtils") << friendlyName <<
"\t \"" << modLabel
460 <<
"\" \t \"" << instanceName <<
"\" \t \"" << processName
461 <<
"\"" << std::endl;
463 if (friendlyName ==
"L1GlobalTriggerRecord") {
466 foundL1GtRecord =
true;
467 }
else if (friendlyName ==
"L1GlobalTriggerReadoutRecord") {
469 l1GtReadoutRecordInputTag =
edm::InputTag(modLabel, instanceName,
471 foundL1GtReadoutRecord =
true;
476 if (!foundL1GtRecord) {
480 <<
"\nL1GlobalTriggerRecord found in the event with \n "
481 << l1GtRecordInputTag << std::endl;
484 if (!foundL1GtReadoutRecord) {
488 <<
"\nL1GlobalTriggerReadoutRecord found in the event with \n "
489 << l1GtReadoutRecordInputTag << std::endl;
497 typedef std::vector<edm::Provenance const*> Provenances;
498 Provenances provenances;
504 bool foundL1GtTriggerMenuLite =
false;
506 LogDebug(
"L1GtUtils") <<
"\nTry to get AllProvenance for run "
511 LogTrace(
"L1GtUtils") <<
"\n" <<
"Run contains " << provenances.size()
512 <<
" product" << (provenances.size() == 1 ?
"" :
"s")
513 <<
" with friendlyClassName, moduleLabel, productInstanceName and processName:\n"
516 for (Provenances::iterator itProv = provenances.begin(), itProvEnd =
517 provenances.end(); itProv != itProvEnd; ++itProv) {
519 friendlyName = (*itProv)->friendlyClassName();
520 modLabel = (*itProv)->moduleLabel();
521 instanceName = (*itProv)->productInstanceName();
522 processName = (*itProv)->processName();
524 LogTrace(
"L1GtUtils") << friendlyName <<
"\t \"" << modLabel
525 <<
"\" \t \"" << instanceName <<
"\" \t \"" << processName
526 <<
"\"" << std::endl;
528 if (friendlyName ==
"L1GtTriggerMenuLite") {
529 l1GtTriggerMenuLiteInputTag =
edm::InputTag(modLabel, instanceName,
531 foundL1GtTriggerMenuLite =
true;
536 if (!foundL1GtTriggerMenuLite) {
538 LogTrace(
"L1GtUtils") <<
"\nL1GtTriggerMenuLite not found in Run"
541 LogTrace(
"L1GtUtils") <<
"\nL1GtTriggerMenuLite found in Run with \n "
542 << l1GtTriggerMenuLiteInputTag << std::endl;
550 int& bitNumber)
const {
563 if (itTrig->second == nameAlgoTechTrig) {
566 bitNumber = itTrig->first;
577 if (itTrig->second == nameAlgoTechTrig) {
580 bitNumber = itTrig->first;
591 if (itTrig->second == nameAlgoTechTrig) {
594 bitNumber = itTrig->first;
606 bitNumber = (itAlgo->second).algoBitNumber();
615 bitNumber = (itAlgo->second).algoBitNumber();
624 bitNumber = (itAlgo->second).algoBitNumber();
640 bitNumber = (itAlgo->second).algoBitNumber();
649 bitNumber = (itAlgo->second).algoBitNumber();
658 bitNumber = (itAlgo->second).algoBitNumber();
679 aliasL1Trigger.clear();
680 nameL1Trigger.clear();
688 bool trigAliasFound =
false;
689 bool trigNameFound =
false;
695 if (static_cast<int>(itTrig->first) == bitNumber) {
696 aliasL1Trigger = itTrig->second;
697 trigAliasFound =
true;
706 if (static_cast<int>(itTrig->first) == bitNumber) {
707 nameL1Trigger = itTrig->second;
708 trigNameFound =
true;
713 if (!(trigAliasFound && trigNameFound)) {
723 bool trigNameFound =
false;
729 if (static_cast<int>(itTrig->first) == bitNumber) {
730 nameL1Trigger = itTrig->second;
734 aliasL1Trigger = itTrig->second;
736 trigNameFound =
true;
741 if (!(trigNameFound)) {
758 bool trigAliasFound =
false;
763 if ((itTrig->second).algoBitNumber() == bitNumber) {
764 aliasL1Trigger = itTrig->first;
766 nameL1Trigger = (itTrig->second).algoName();
768 trigAliasFound =
true;
773 if (!(trigAliasFound)) {
783 bool trigNameFound =
false;
788 if ((itTrig->second).algoBitNumber() == bitNumber) {
789 nameL1Trigger = (itTrig->second).algoName();
792 aliasL1Trigger = nameL1Trigger;
794 trigNameFound =
true;
799 if (!(trigNameFound)) {
821 bool trigAliasFound =
false;
826 if ((itTrig->second).algoBitNumber() == bitNumber) {
827 aliasL1Trigger = itTrig->first;
829 nameL1Trigger = (itTrig->second).algoName();
831 trigAliasFound =
true;
836 if (!(trigAliasFound)) {
846 bool trigNameFound =
false;
851 if ((itTrig->second).algoBitNumber() == bitNumber) {
852 nameL1Trigger = (itTrig->second).algoName();
855 aliasL1Trigger = itTrig->first;
857 trigNameFound =
true;
862 if (!(trigNameFound)) {
888 const std::string& nameAlgoTechTrig,
bool& decisionBeforeMask,
889 bool& decisionAfterMask,
int&
prescaleFactor,
int& triggerMask)
const {
892 decisionBeforeMask =
false;
893 decisionAfterMask =
false;
919 iError = l1ConfCode + 1;
924 LogDebug(
"L1GtUtils") <<
"\nAlgorithm/technical trigger \n "
926 <<
"\not found in the trigger menu \n "
928 <<
"\nretrieved from L1GtTriggerMenuLite" << std::endl;
933 LogDebug(
"L1GtUtils") <<
"\nAlgorithm/technical trigger \n "
935 <<
"\not found in the trigger menu \n "
937 <<
"\nretrieved from Event Setup" << std::endl;
943 LogDebug(
"L1GtUtils") <<
"\nAlgorithm/technical trigger \n "
945 <<
"\not found in the trigger menu \n "
947 <<
"\nretrieved from Event Setup" << std::endl;
960 iError = l1ConfCode + 2;
964 LogDebug(
"L1GtUtils") <<
"\nNegative bit number for "
966 << nameAlgoTechTrig <<
"\nfrom menu \n "
968 <<
"\nretrieved from L1GtTriggerMenuLite" << std::endl;
972 LogDebug(
"L1GtUtils") <<
"\nNegative bit number for "
974 << nameAlgoTechTrig <<
"\nfrom menu \n "
976 <<
"\nretrieved from Event Setup" << std::endl;
982 LogDebug(
"L1GtUtils") <<
"\nNegative bit number for "
984 << nameAlgoTechTrig <<
"\nfrom menu \n "
986 <<
"\nretrieved from Event Setup" << std::endl;
998 int iErrorRecord = 0;
1000 bool validRecord =
false;
1001 bool gtReadoutRecordValid =
false;
1004 iEvent.
getByLabel(l1GtRecordInputTag, gtRecord);
1013 LogDebug(
"L1GtUtils") <<
"\nL1GlobalTriggerRecord with \n "
1014 << l1GtRecordInputTag <<
"\nnot found in the event."
1019 iEvent.
getByLabel(l1GtReadoutRecordInputTag, gtReadoutRecord);
1021 if (gtReadoutRecord.
isValid()) {
1023 gtReadoutRecordValid =
true;
1028 iErrorRecord = iErrorRecord + 100;
1029 LogDebug(
"L1GtUtils") <<
"\nL1GlobalTriggerReadoutRecord with \n "
1030 << l1GtReadoutRecordInputTag <<
"\nnot found in the event."
1041 int pfIndexTechTrig = -1;
1042 int pfIndexAlgoTrig = -1;
1045 if (gtReadoutRecordValid) {
1048 = (gtReadoutRecord->gtFdlWord()).gtPrescaleFactorIndexTech();
1050 = (gtReadoutRecord->gtFdlWord()).gtPrescaleFactorIndexAlgo();
1055 =
static_cast<int> (gtRecord->gtPrescaleFactorIndexTech());
1057 =
static_cast<int> (gtRecord->gtPrescaleFactorIndexAlgo());
1063 LogDebug(
"L1GtUtils") <<
"\nError: "
1064 <<
"\nNo valid L1GlobalTriggerRecord with \n "
1065 << l1GtRecordInputTag <<
"\nfound in the event."
1066 <<
"\nNo valid L1GlobalTriggerReadoutRecord with \n "
1067 << l1GtReadoutRecordInputTag <<
"\nfound in the event."
1070 iError = l1ConfCode + iErrorRecord;
1083 size_t pfSetsSize = 0;
1085 const std::vector<int>* prescaleFactorsSubset = 0;
1086 const std::vector<unsigned int>* triggerMasksSet = 0;
1088 switch (trigCategory) {
1109 pfIndex = pfIndexAlgoTrig;
1133 pfIndex = pfIndexTechTrig;
1139 iError = l1ConfCode + iErrorRecord + 3;
1151 iError = l1ConfCode + iErrorRecord + 1000;
1153 <<
"\nError: index of prescale factor set retrieved from the data \n"
1154 <<
"less than zero."
1155 <<
"\n Value of index retrieved from data = " << pfIndex
1160 }
else if (pfIndex >= (static_cast<int>(pfSetsSize))) {
1161 iError = l1ConfCode + iErrorRecord + 2000;
1163 <<
"\nError: index of prescale factor set retrieved from the data \n"
1164 <<
"greater than the size of the vector of prescale factor sets."
1165 <<
"\n Value of index retrieved from data = " << pfIndex
1166 <<
"\n Vector size = " << pfSetsSize << std::endl;
1171 switch (trigCategory) {
1175 prescaleFactorsSubset
1176 = &((*m_prescaleFactorsAlgoTrigLite).at(pfIndex));
1180 prescaleFactorsSubset
1181 = &((*m_prescaleFactorsAlgoTrig).at(pfIndex));
1187 prescaleFactorsSubset
1188 = &((*m_prescaleFactorsAlgoTrig).at(pfIndex));
1197 prescaleFactorsSubset
1198 = &((*m_prescaleFactorsTechTrigLite).at(pfIndex));
1202 prescaleFactorsSubset
1203 = &((*m_prescaleFactorsTechTrig).at(pfIndex));
1209 prescaleFactorsSubset
1210 = &((*m_prescaleFactorsTechTrig).at(pfIndex));
1229 switch (trigCategory) {
1231 if (gtReadoutRecordValid) {
1232 const DecisionWord& decWord = gtReadoutRecord->decisionWord();
1233 decisionBeforeMask =
trigResult(decWord, bitNumber,
1234 nameAlgoTechTrig, trigCategory, iError);
1236 return (iError + l1ConfCode + iErrorRecord);
1242 gtRecord->decisionWordBeforeMask();
1243 decisionBeforeMask =
trigResult(decWord, bitNumber,
1244 nameAlgoTechTrig, trigCategory, iError);
1246 return (iError + l1ConfCode + iErrorRecord);
1254 if (gtReadoutRecordValid) {
1256 gtReadoutRecord->technicalTriggerWord();
1257 decisionBeforeMask =
trigResult(decWord, bitNumber,
1258 nameAlgoTechTrig, trigCategory, iError);
1260 return (iError + l1ConfCode + iErrorRecord);
1266 gtRecord->technicalTriggerWordBeforeMask();
1267 decisionBeforeMask =
trigResult(decWord, bitNumber,
1268 nameAlgoTechTrig, trigCategory, iError);
1270 return (iError + l1ConfCode + iErrorRecord);
1287 if (bitNumber < (static_cast<int> (prescaleFactorsSubset->size()))) {
1288 prescaleFactor = (*prescaleFactorsSubset)[bitNumber];
1290 iError = l1ConfCode + iErrorRecord + 4000;
1291 LogDebug(
"L1GtUtils") <<
"\nError: bit number " << bitNumber
1294 <<
"\ngreater than size of actual L1 GT prescale factor set: "
1295 << prescaleFactorsSubset->size()
1296 <<
"\nError: Inconsistent L1 trigger configuration!"
1304 if (bitNumber < (static_cast<int> ((*triggerMasksSet).size()))) {
1308 triggerMask = (*triggerMasksSet)[bitNumber];
1313 triggerMask = ((*triggerMasksSet)[bitNumber]) & (1
1321 triggerMask = ((*triggerMasksSet)[bitNumber]) & (1
1328 iError = l1ConfCode + iErrorRecord + 5000;
1329 LogDebug(
"L1GtUtils") <<
"\nError: bit number " << bitNumber
1332 <<
"\ngreater than size of L1 GT trigger mask set: "
1333 << (*triggerMasksSet).size()
1334 <<
"\nError: Inconsistent L1 trigger configuration!"
1344 decisionAfterMask =
false;
1353 const std::string& nameAlgoTechTrig,
bool& decisionBeforeMask,
1354 bool& decisionAfterMask,
int&
prescaleFactor,
int& triggerMask)
const {
1357 decisionBeforeMask =
false;
1358 decisionAfterMask =
false;
1359 prescaleFactor = -1;
1362 int l1ErrorCode = 0;
1366 decisionAfterMask, prescaleFactor, triggerMask);
1377 const std::string& nameAlgoTechTrig,
int& errorCode)
const {
1385 errorCode =
l1Results(iEvent, l1GtRecordInputTag,
1386 l1GtReadoutRecordInputTag, nameAlgoTechTrig, decisionBeforeMask,
1387 decisionAfterMask, prescaleFactor, triggerMask);
1394 const std::string& nameAlgoTechTrig,
int& errorCode)
const {
1402 errorCode =
l1Results(iEvent, nameAlgoTechTrig, decisionBeforeMask,
1403 decisionAfterMask, prescaleFactor, triggerMask);
1414 const std::string& nameAlgoTechTrig,
int& errorCode)
const {
1422 errorCode =
l1Results(iEvent, l1GtRecordInputTag,
1423 l1GtReadoutRecordInputTag, nameAlgoTechTrig, decisionBeforeMask,
1424 decisionAfterMask, prescaleFactor, triggerMask);
1431 const std::string& nameAlgoTechTrig,
int& errorCode)
const {
1439 errorCode =
l1Results(iEvent, nameAlgoTechTrig, decisionBeforeMask,
1440 decisionAfterMask, prescaleFactor, triggerMask);
1451 const std::string& nameAlgoTechTrig,
int& errorCode)
const {
1459 errorCode =
l1Results(iEvent, l1GtRecordInputTag,
1460 l1GtReadoutRecordInputTag, nameAlgoTechTrig, decisionBeforeMask,
1461 decisionAfterMask, prescaleFactor, triggerMask);
1468 const std::string& nameAlgoTechTrig,
int& errorCode)
const {
1476 errorCode =
l1Results(iEvent, nameAlgoTechTrig, decisionBeforeMask,
1477 decisionAfterMask, prescaleFactor, triggerMask);
1488 const std::string& nameAlgoTechTrig,
int& errorCode)
const {
1496 errorCode =
l1Results(iEvent, l1GtRecordInputTag,
1497 l1GtReadoutRecordInputTag, nameAlgoTechTrig, decisionBeforeMask,
1498 decisionAfterMask, prescaleFactor, triggerMask);
1505 const std::string& nameAlgoTechTrig,
int& errorCode)
const {
1513 errorCode =
l1Results(iEvent, nameAlgoTechTrig, decisionBeforeMask,
1514 decisionAfterMask, prescaleFactor, triggerMask);
1523 const std::string& nameAlgoTechTrig,
int& errorCode)
const {
1531 errorCode =
l1Results(iEvent, l1GtRecordInputTag,
1532 l1GtReadoutRecordInputTag, nameAlgoTechTrig, decisionBeforeMask,
1533 decisionAfterMask, prescaleFactor, triggerMask);
1540 const std::string& nameAlgoTechTrig,
int& errorCode)
const {
1548 errorCode =
l1Results(iEvent, nameAlgoTechTrig, decisionBeforeMask,
1549 decisionAfterMask, prescaleFactor, triggerMask);
1556 int& errorCode)
const {
1559 int triggerMaskValue = -1;
1569 return triggerMaskValue;
1583 iError = l1ConfCode + 1;
1588 LogDebug(
"L1GtUtils") <<
"\nAlgorithm/technical trigger \n "
1590 <<
"\not found in the trigger menu \n "
1592 <<
"\nretrieved from L1GtTriggerMenuLite" << std::endl;
1597 LogDebug(
"L1GtUtils") <<
"\nAlgorithm/technical trigger \n "
1599 <<
"\not found in the trigger menu \n "
1601 <<
"\nretrieved from Event Setup" << std::endl;
1607 LogDebug(
"L1GtUtils") <<
"\nAlgorithm/technical trigger \n "
1609 <<
"\not found in the trigger menu \n "
1611 <<
"\nretrieved from Event Setup" << std::endl;
1616 return triggerMaskValue;
1623 if (bitNumber < 0) {
1625 iError = l1ConfCode + 2;
1629 LogDebug(
"L1GtUtils") <<
"\nNegative bit number for "
1631 << nameAlgoTechTrig <<
"\nfrom menu \n "
1633 <<
"\nretrieved from L1GtTriggerMenuLite" << std::endl;
1637 LogDebug(
"L1GtUtils") <<
"\nNegative bit number for "
1639 << nameAlgoTechTrig <<
"\nfrom menu \n "
1641 <<
"\nretrieved from Event Setup" << std::endl;
1647 LogDebug(
"L1GtUtils") <<
"\nNegative bit number for "
1649 << nameAlgoTechTrig <<
"\nfrom menu \n "
1651 <<
"\nretrieved from Event Setup" << std::endl;
1656 return triggerMaskValue;
1664 const std::vector<unsigned int>* triggerMasksSet = 0;
1666 switch (trigCategory) {
1707 iError = l1ConfCode + 3;
1710 return triggerMaskValue;
1718 if (bitNumber < (static_cast<int> ((*triggerMasksSet).size()))) {
1722 triggerMaskValue = (*triggerMasksSet)[bitNumber];
1727 triggerMaskValue = ((*triggerMasksSet)[bitNumber]) & (1
1735 triggerMaskValue = ((*triggerMasksSet)[bitNumber]) & (1
1741 iError = l1ConfCode + 5000;
1742 LogDebug(
"L1GtUtils") <<
"\nError: bit number " << bitNumber
1745 <<
"\ngreater than size of L1 GT trigger mask set: "
1746 << (*triggerMasksSet).size()
1747 <<
"\nError: Inconsistent L1 trigger configuration!"
1751 return triggerMaskValue;
1756 return triggerMaskValue;
1786 int iErrorRecord = 0;
1788 bool validRecord =
false;
1789 bool gtReadoutRecordValid =
false;
1792 iEvent.
getByLabel(l1GtRecordInputTag, gtRecord);
1801 LogDebug(
"L1GtUtils") <<
"\nL1GlobalTriggerRecord with \n "
1802 << l1GtRecordInputTag <<
"\nnot found in the event."
1807 iEvent.
getByLabel(l1GtReadoutRecordInputTag, gtReadoutRecord);
1809 if (gtReadoutRecord.
isValid()) {
1811 gtReadoutRecordValid =
true;
1816 iErrorRecord = iErrorRecord + 100;
1817 LogDebug(
"L1GtUtils") <<
"\nL1GlobalTriggerReadoutRecord with \n "
1818 << l1GtReadoutRecordInputTag <<
"\nnot found in the event."
1829 int pfIndexTechTrig = -1;
1830 int pfIndexAlgoTrig = -1;
1833 if (gtReadoutRecordValid) {
1836 = (gtReadoutRecord->gtFdlWord()).gtPrescaleFactorIndexTech();
1838 = (gtReadoutRecord->gtFdlWord()).gtPrescaleFactorIndexAlgo();
1843 =
static_cast<int> (gtRecord->gtPrescaleFactorIndexTech());
1845 =
static_cast<int> (gtRecord->gtPrescaleFactorIndexAlgo());
1851 LogDebug(
"L1GtUtils") <<
"\nError: "
1852 <<
"\nNo valid L1GlobalTriggerRecord with \n "
1853 << l1GtRecordInputTag <<
"\nfound in the event."
1854 <<
"\nNo valid L1GlobalTriggerReadoutRecord with \n "
1855 << l1GtReadoutRecordInputTag <<
"\nfound in the event."
1858 iError = l1ConfCode + iErrorRecord;
1873 size_t pfSetsSize = 0;
1875 switch (trigCategory) {
1893 pfIndex = pfIndexAlgoTrig;
1914 pfIndex = pfIndexTechTrig;
1920 iError = l1ConfCode + iErrorRecord + 3;
1932 iError = l1ConfCode + iErrorRecord + 1000;
1934 <<
"\nError: index of prescale factor set retrieved from the data \n"
1935 <<
"less than zero."
1936 <<
"\n Value of index retrieved from data = " << pfIndex
1942 }
else if (pfIndex >= (static_cast<int>(pfSetsSize))) {
1943 iError = l1ConfCode + iErrorRecord + 2000;
1945 <<
"\nError: index of prescale factor set retrieved from the data \n"
1946 <<
"greater than the size of the vector of prescale factor sets."
1947 <<
"\n Value of index retrieved from data = " << pfIndex
1948 <<
"\n Vector size = " << pfSetsSize << std::endl;
1996 l1GtReadoutRecordInputTag, trigCategory, iError);
2000 switch (trigCategory) {
2005 = (*m_prescaleFactorsAlgoTrigLite).at(pfIndex);
2027 = (*m_prescaleFactorsTechTrigLite).at(pfIndex);
2105 switch (trigCategory) {
2162 iError = l1ConfCode + 3;
2245 iError = l1ConfCode;
2276 iError = l1ConfCode;
2282 iError = l1ConfCode;
2298 <<
"\nRetrieve L1 trigger configuration from L1GtTriggerMenuLite only.\n"
2303 <<
"\nFall through: retrieve L1 trigger configuration from L1GtTriggerMenuLite."
2304 <<
"\nIf L1GtTriggerMenuLite not valid, try to retrieve from event setup.\n"
2306 l1ConfCode = 100000;
2311 <<
"\nRetrieve L1 trigger configuration from L1GtTriggerMenuLite, valid product.\n"
2313 l1ConfCode = l1ConfCode + 10000;
2321 <<
"\nFall through: retrieve L1 trigger configuration from event setup."
2322 <<
"\nFirst option was L1GtTriggerMenuLite - but product is not valid.\n"
2324 l1ConfCode = l1ConfCode + 20000;
2331 <<
"\nFall through: L1GtTriggerMenuLite not valid, event setup not valid.\n"
2334 errorCode = l1ConfCode;
2343 <<
"\nError: L1 trigger configuration requested from L1GtTriggerMenuLite only"
2344 <<
"\nbut L1GtTriggerMenuLite is not valid.\n" << std::endl;
2346 errorCode = l1ConfCode;
2354 <<
"\nRetrieve L1 trigger configuration from event setup."
2355 <<
"\nL1GtTriggerMenuLite product was not requested.\n"
2357 l1ConfCode = 200000;
2361 <<
"\nRetrieve L1 trigger configuration from event setup only."
2362 <<
"\nValid L1 trigger event setup.\n"
2364 l1ConfCode = l1ConfCode + 10000;
2371 <<
"\nRetrieve L1 trigger configuration from event setup only."
2372 <<
"\nNo valid L1 trigger event setup.\n"
2375 errorCode = l1ConfCode;
2384 <<
"\nError: no L1 trigger configuration requested to be retrieved."
2385 <<
"\nMust call before getL1GtRunCache in beginRun and analyze.\n"
2387 l1ConfCode = 300000;
2388 errorCode = l1ConfCode;
2398 const int bitNumber,
const std::string& nameAlgoTechTrig,
2401 bool trigRes =
false;
2404 if (bitNumber < (static_cast<int> (decWord.size()))) {
2405 trigRes = decWord[bitNumber];
2408 LogDebug(
"L1GtUtils") <<
"\nError: bit number " << bitNumber
2411 <<
"\ngreater than size of L1 GT decision word: "
2413 <<
"\nError: Inconsistent L1 trigger configuration!"
2423 m_logicalExpression(expression),
2425 m_l1GtUtils(l1GtUtils),
2427 m_l1GtRecordInputTag(edm::InputTag()),
2429 m_l1GtReadoutRecordInputTag(edm::InputTag()),
2433 m_validL1Configuration(
false),
2435 m_validLogicalExpression(
false),
2437 m_l1GtInputTagsFromProv(
true),
2439 m_l1ResultsAlreadyCalled(
false),
2441 m_expL1TriggersSize(0),
2443 m_expBitsTechTrigger(
false) {
2453 m_logicalExpression(expression),
2455 m_l1GtUtils(l1GtUtils),
2457 m_l1GtRecordInputTag(l1GtRecordInputTag),
2459 m_l1GtReadoutRecordInputTag(l1GtReadoutRecordInputTag),
2463 m_validL1Configuration(
false),
2465 m_validLogicalExpression(
false),
2467 m_l1GtInputTagsFromProv(
false),
2469 m_l1ResultsAlreadyCalled(
false),
2471 m_expL1TriggersSize(0),
2473 m_expBitsTechTrigger(
false) {
2493 m_logicalExpression);
2497 m_expL1TriggersSize = m_expL1Triggers.size();
2499 m_validLogicalExpression =
true;
2502 m_validLogicalExpression =
false;
2516 m_expBitsTechTrigger =
true;
2518 for (
size_t iTrig = 0; iTrig < m_expL1TriggersSize; ++iTrig) {
2519 const std::string& bitString = (m_expL1Triggers[iTrig]).tokenName;
2520 std::istringstream bitStream(bitString);
2523 if ((bitStream >> bitInt).
fail()) {
2525 m_expBitsTechTrigger =
false;
2530 (m_expL1Triggers[iTrig]).tokenNumber = bitInt;
2535 m_decisionsBeforeMask.resize(m_expL1TriggersSize);
2536 m_decisionsAfterMask.resize(m_expL1TriggersSize);
2537 m_prescaleFactors.resize(m_expL1TriggersSize);
2538 m_triggerMasks.resize(m_expL1TriggersSize);
2539 m_errorCodes.resize(m_expL1TriggersSize);
2540 m_expTriggerCategory.resize(m_expL1TriggersSize);
2541 m_expTriggerInMenu.resize(m_expL1TriggersSize);
2543 LogDebug(
"L1GtUtils") << std::endl;
2544 LogTrace(
"L1GtUtils") <<
"\nLogical expression\n " << m_logicalExpression
2545 <<
"\n has " << m_expL1TriggersSize <<
" L1 triggers" << std::endl;
2546 for (
size_t iTrig = 0; iTrig < m_expL1TriggersSize; ++iTrig) {
2548 const std::string& trigNameOrAlias = (m_expL1Triggers[iTrig]).tokenName;
2549 LogTrace(
"L1GtUtils") <<
" " << trigNameOrAlias << std::endl;
2551 (m_decisionsBeforeMask[iTrig]).
first = trigNameOrAlias;
2552 (m_decisionsBeforeMask[iTrig]).
second =
false;
2554 (m_decisionsAfterMask[iTrig]).
first = trigNameOrAlias;
2555 (m_decisionsAfterMask[iTrig]).
second =
false;
2557 (m_prescaleFactors[iTrig]).
first = trigNameOrAlias;
2558 (m_prescaleFactors[iTrig]).
second = -1;
2560 (m_triggerMasks[iTrig]).
first = trigNameOrAlias;
2561 (m_triggerMasks[iTrig]).
second = -1;
2563 (m_errorCodes[iTrig]).
first = trigNameOrAlias;
2564 (m_errorCodes[iTrig]).
second = -1;
2568 m_expTriggerInMenu[iTrig] =
false;
2571 LogTrace(
"L1GtUtils") << std::endl;
2588 m_logicalExpression = logicExpression;
2589 m_validLogicalExpression =
false;
2591 m_l1ResultsAlreadyCalled =
false;
2593 m_expL1TriggersSize = 0;
2594 m_expBitsTechTrigger =
false;
2597 m_decisionsBeforeMask.clear();
2598 m_decisionsAfterMask.clear();
2599 m_prescaleFactors.clear();
2600 m_triggerMasks.clear();
2601 m_errorCodes.clear();
2602 m_expTriggerCategory.clear();
2603 m_expTriggerInMenu.clear();
2609 errorCode = logicalExpressionRunUpdate(iRun, evSetup);
2626 if (!(m_l1GtUtils.availableL1Configuration(errorCode, l1ConfCode))) {
2628 m_validL1Configuration =
false;
2632 m_validL1Configuration =
true;
2633 m_l1ConfCode = l1ConfCode;
2646 for (
size_t iTrig = 0; iTrig < m_expL1TriggersSize; ++iTrig) {
2650 const std::string& trigNameOrAlias = (m_expL1Triggers[iTrig]).tokenName;
2652 if (!m_expBitsTechTrigger) {
2653 const bool triggerInMenu = m_l1GtUtils.l1AlgoTechTrigBitNumber(
2654 trigNameOrAlias, trigCategory, bitNumber);
2656 (m_expL1Triggers[iTrig]).tokenNumber = bitNumber;
2657 m_expTriggerCategory[iTrig] = trigCategory;
2658 m_expTriggerInMenu[iTrig] = triggerInMenu;
2666 bitNumber = (m_expL1Triggers[iTrig]).tokenNumber;
2668 const bool triggerInMenu = m_l1GtUtils.l1TriggerNameFromBit(
2669 bitNumber, trigCategory, aliasL1Trigger, nameL1Trigger);
2671 if (!triggerInMenu) {
2672 aliasL1Trigger =
"Technical_trigger_bit_"
2673 + (m_expL1Triggers[iTrig]).tokenName +
"_empty";
2676 (m_expL1Triggers[iTrig]).tokenName = aliasL1Trigger;
2677 m_expTriggerCategory[iTrig] = trigCategory;
2678 m_expTriggerInMenu[iTrig] = triggerInMenu;
2682 (m_decisionsBeforeMask[iTrig]).
first = aliasL1Trigger;
2683 (m_decisionsAfterMask[iTrig]).
first = aliasL1Trigger;
2684 (m_prescaleFactors[iTrig]).
first = aliasL1Trigger;
2685 (m_triggerMasks[iTrig]).
first = aliasL1Trigger;
2686 (m_errorCodes[iTrig]).
first = aliasL1Trigger;
2698 if (!m_l1ResultsAlreadyCalled) {
2700 <<
"\n Method 'errorCodes' must be called in the event loop before attempting to use this method.\n"
2704 return m_decisionsBeforeMask;
2711 if (!m_l1ResultsAlreadyCalled) {
2713 <<
"\n Method 'errorCodes' must be called in the event loop before attempting to use this method.\n"
2717 return m_decisionsAfterMask;
2724 if (!m_l1ResultsAlreadyCalled) {
2726 <<
"\n Method 'errorCodes' must be called in the event loop before attempting to use this method.\n"
2730 return m_prescaleFactors;
2737 if (!m_l1ResultsAlreadyCalled) {
2739 <<
"\n Method 'errorCodes' must be called in the event loop before attempting to use this method.\n"
2743 return m_triggerMasks;
2750 m_l1ResultsAlreadyCalled =
false;
2753 if (!m_validL1Configuration) {
2754 reset(m_decisionsBeforeMask);
2755 reset(m_decisionsAfterMask);
2756 reset(m_prescaleFactors);
2757 reset(m_triggerMasks);
2758 reset(m_errorCodes);
2760 m_l1ResultsAlreadyCalled =
true;
2761 return m_errorCodes;
2765 if (m_l1GtInputTagsFromProv) {
2767 l1Results(iEvent, m_l1GtUtils.provL1GtRecordInputTag(),
2768 m_l1GtUtils.provL1GtReadoutRecordInputTag());
2772 l1Results(iEvent, m_l1GtRecordInputTag, m_l1GtReadoutRecordInputTag);
2775 m_l1ResultsAlreadyCalled =
true;
2777 return m_errorCodes;
2782 const std::vector<std::pair<std::string, bool> >& _pairVector)
const {
2783 std::vector<std::pair<std::string, bool> > pairVector = _pairVector;
2784 for (
size_t iTrig = 0; iTrig < m_expL1TriggersSize; ++iTrig) {
2785 (pairVector[iTrig]).
second =
false;
2790 const std::vector<std::pair<std::string, int> >& _pairVector)
const {
2791 std::vector<std::pair<std::string, int> > pairVector = _pairVector;
2792 for (
size_t iTrig = 0; iTrig < m_expL1TriggersSize; ++iTrig) {
2793 (pairVector[iTrig]).
second = -1;
2802 reset(m_decisionsBeforeMask);
2803 reset(m_decisionsAfterMask);
2804 reset(m_prescaleFactors);
2805 reset(m_triggerMasks);
2806 reset(m_errorCodes);
2809 bool decisionBeforeMaskValue =
false;
2810 bool decisionAfterMaskValue =
false;
2811 int prescaleFactorValue = -1;
2812 int triggerMaskValue = -1;
2815 LogDebug(
"L1GtUtils") << std::endl;
2816 LogTrace(
"L1GtUtils") <<
"\nLogical expression\n " << m_logicalExpression
2821 for (
size_t iTrig = 0; iTrig < m_expL1TriggersSize; ++iTrig) {
2823 const std::string& trigNameOrAlias = (m_expL1Triggers[iTrig]).tokenName;
2825 if (m_expTriggerInMenu[iTrig]) {
2826 errorCode = m_l1GtUtils.l1Results(iEvent, l1GtRecordInputTag,
2827 l1GtReadoutRecordInputTag, trigNameOrAlias,
2828 decisionBeforeMaskValue, decisionAfterMaskValue,
2829 prescaleFactorValue, triggerMaskValue);
2831 if (errorCode != 0) {
2836 decisionBeforeMaskValue =
false;
2837 decisionAfterMaskValue =
false;
2838 prescaleFactorValue = -1;
2839 triggerMaskValue = -1;
2847 decisionBeforeMaskValue =
false;
2848 decisionAfterMaskValue =
false;
2849 prescaleFactorValue = -1;
2850 triggerMaskValue = -1;
2851 errorCode = m_l1ConfCode + 1;
2855 LogTrace(
"L1GtUtils") <<
"\n" << trigNameOrAlias <<
":" << std::endl;
2857 (m_decisionsBeforeMask[iTrig]).
second = decisionBeforeMaskValue;
2858 LogTrace(
"L1GtUtils") <<
" decision before mask = "
2859 << decisionBeforeMaskValue << std::endl;
2861 (m_decisionsAfterMask[iTrig]).
second = decisionAfterMaskValue;
2862 LogTrace(
"L1GtUtils") <<
" decision after mask = "
2863 << decisionAfterMaskValue << std::endl;
2865 (m_prescaleFactors[iTrig]).
second = prescaleFactorValue;
2866 LogTrace(
"L1GtUtils") <<
" prescale factor = "
2867 << prescaleFactorValue << std::endl;
2869 (m_triggerMasks[iTrig]).
second = triggerMaskValue;
2870 LogTrace(
"L1GtUtils") <<
" trigger mask = "
2871 << triggerMaskValue << std::endl;
2873 (m_errorCodes[iTrig]).
second = errorCode;
2874 LogTrace(
"L1GtUtils") <<
" error code = " << errorCode
2879 LogDebug(
"L1GtUtils") << std::endl;
bool m_retrieveL1GtTriggerMenuLite
virtual char const * what() const
edm::RunID m_runIDCache
run cache ID
EventNumber_t event() const
static AlgebraicMatrix initialize()
bool getByLabel(std::string const &label, Handle< PROD > &result) const
void getAllProvenance(std::vector< Provenance const * > &provenances) const
const bool l1TriggerNameFromBit(const int &bitNumber, const TriggerCategory &trigCategory, std::string &aliasL1Trigger, std::string &nameL1Trigger) const
const bool decisionAfterMask(const edm::Event &iEvent, const edm::InputTag &l1GtRecordInputTag, const edm::InputTag &l1GtReadoutRecordInputTag, const std::string &nameAlgoTechTrig, int &errorCode) const
return decision after trigger mask for a given algorithm or technical trigger
LogicalExpressionL1Results(const std::string &, L1GtUtils &)
constructor(s)
const int l1Results(const edm::Event &iEvent, const edm::InputTag &l1GtRecordInputTag, const edm::InputTag &l1GtReadoutRecordInputTag, const std::string &nameAlgoTechTrig, bool &decisionBeforeMask, bool &decisionAfterMask, int &prescaleFactor, int &triggerMask) const
std::vector< unsigned int > m_triggerMaskSet
unsigned long long m_l1GtMenuCacheID
const std::vector< unsigned int > * m_triggerMaskAlgoTrig
static const bool useL1GtTriggerMenuLite(false)
const int logicalExpressionRunUpdate(const edm::Run &, const edm::EventSetup &, const std::string &)
edm::InputTag m_provL1GtReadoutRecordInputTag
void retrieveL1GtTriggerMenuLite(const edm::Run &, const edm::InputTag &)
retrieve L1GtTriggerMenuLite (per run product) and cache it to improve the speed
const L1GtTriggerMenuLite * ptrL1GtTriggerMenuLite(int &errorCode)
return a pointer to the L1GtTriggerMenuLite product
const std::vector< unsigned int > * m_triggerMaskTechTrig
void l1Results(const edm::Event &iEvent, const edm::InputTag &l1GtRecordInputTag, const edm::InputTag &l1GtReadoutRecordInputTag)
virtual std::string explainSelf() const
const L1GtTriggerMask * m_l1GtTmVetoTech
const bool l1AlgoTechTrigBitNumber(const std::string &nameAlgoTechTrig, TriggerCategory &trigCategory, int &bitNumber) const
void getAllProvenance(std::vector< Provenance const * > &provenances) const
const bool availableL1Configuration(int &errorCode, int &l1ConfCode) const
edm::InputTag m_provL1GtTriggerMenuLiteInputTag
const std::vector< std::vector< int > > * m_prescaleFactorsAlgoTrigLite
virtual ~L1GtUtils()
destructor
const L1GtTriggerMask * m_l1GtTmAlgo
trigger masks & veto masks
const AlgorithmMap * m_algorithmMap
const std::vector< std::pair< std::string, int > > & prescaleFactors()
const std::vector< std::vector< int > > * m_prescaleFactorsTechTrig
Run const & getRun() const
const L1GtStableParameters * m_l1GtStablePar
event setup cached stuff
unsigned long long m_l1GtPfAlgoCacheID
const std::vector< unsigned int > & triggerMaskSet(const TriggerCategory &trigCategory, int &errorCode)
const std::vector< std::pair< std::string, int > > & triggerMasks()
const std::string & l1TriggerMenu() const
return the L1 trigger menu name
const std::vector< std::vector< int > > * m_prescaleFactorsAlgoTrig
const bool decisionBeforeMask(const edm::Event &iEvent, const edm::InputTag &l1GtRecordInputTag, const edm::InputTag &l1GtReadoutRecordInputTag, const std::string &nameAlgoTechTrig, int &errorCode) const
return decision before trigger mask for a given algorithm or technical trigger
const L1GtTriggerMenuLite::L1TriggerMap * m_algorithmAliasMapLite
U second(std::pair< T, U > const &p)
const L1GtTriggerMenuLite::L1TriggerMap * m_algorithmMapLite
unsigned int gtNumberTechnicalTriggers() const
get / set the number of technical triggers
unsigned long long m_l1GtTmVetoTechCacheID
const std::vector< std::pair< std::string, bool > > & decisionsAfterMask()
void getL1GtRecordInputTag(const edm::Event &iEvent, edm::InputTag &l1GtRecordInputTag, edm::InputTag &l1GtReadoutRecordInputTag) const
unsigned int gtNumberPhysTriggers() const
get / set the number of physics trigger algorithms
const std::vector< std::pair< std::string, bool > > & decisionsBeforeMask()
const bool decision(const edm::Event &iEvent, const edm::InputTag &l1GtRecordInputTag, const edm::InputTag &l1GtReadoutRecordInputTag, const std::string &nameAlgoTechTrig, int &errorCode) const
edm::InputTag m_provL1GtRecordInputTag
cached input tags from provenance - they are updated once per run only
edm::RunID m_provRunIDCache
const std::string & l1TriggerMenuImplementation() const
return the L1 trigger menu implementation
const AlgorithmMap * m_algorithmAliasMap
std::string friendlyName(std::string const &iFullName)
std::vector< OperandToken > & operandTokenVector()
return the vector of operand tokens
unsigned long long m_l1GtTmTechCacheID
const std::vector< unsigned int > & gtTriggerMask() const
get the trigger mask
const std::vector< std::vector< int > > * m_prescaleFactorsTechTrigLite
const L1GtTriggerMask * m_l1GtTmVetoAlgo
std::vector< bool > DecisionWord
typedefs
static const std::string EmptyString
const std::string triggerCategory(const TriggerCategory &) const
public methods
const L1GtPrescaleFactors * m_l1GtPfAlgo
prescale factors
unsigned long long m_l1GtTmAlgoCacheID
const std::vector< int > & prescaleFactorSet(const edm::Event &iEvent, const edm::InputTag &l1GtRecordInputTag, const edm::InputTag &l1GtReadoutRecordInputTag, const TriggerCategory &trigCategory, int &errorCode)
unsigned int m_numberTechnicalTriggers
number of technical triggers
void getL1GtTriggerMenuLiteInputTag(const edm::Run &iRun, edm::InputTag &l1GtTriggerMenuLiteInputTag) const
get the input tag for L1GtTriggerMenuLite
bool m_retrieveL1EventSetup
flags to check which method was used to retrieve L1 trigger configuration
void retrieveL1EventSetup(const edm::EventSetup &)
retrieve all the relevant L1 trigger event setup records and cache them to improve the speed ...
static const bool useL1EventSetup(true)
unsigned int m_physicsDaqPartition
index of physics DAQ partition
unsigned int m_numberAlgorithmTriggers
number of algorithm triggers
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
void getL1GtRunCache(const edm::Run &, const edm::EventSetup &, const bool, const bool, const edm::InputTag &)
get all the run-constant quantities for L1 trigger and cache them
const L1GtTriggerMask * m_l1GtTmTech
const L1GtTriggerMenuLite * m_l1GtMenuLite
L1GtTriggerMenuLite cached stuff.
const std::vector< std::vector< int > > & gtPrescaleFactors() const
get the prescale factors by reference
void reset(const std::vector< std::pair< std::string, bool > > &) const
reset for each L1 trigger the value from pair.second
const L1GtPrescaleFactors * m_l1GtPfTech
const AlgorithmMap * m_technicalTriggerMap
const std::vector< unsigned int > * m_triggerMaskVetoAlgoTrig
T const * product() const
const std::vector< unsigned int > * m_triggerMaskTechTrigLite
RunAuxiliary const & runAuxiliary() const
T const * product() const
const std::vector< unsigned int > * m_triggerMaskAlgoTrigLite
bool m_beginRunCache
flag for call of getL1GtRunCache in beginRun
const int prescaleFactorSetIndex(const edm::Event &iEvent, const edm::InputTag &l1GtRecordInputTag, const edm::InputTag &l1GtReadoutRecordInputTag, const TriggerCategory &trigCategory, int &errorCode) const
const int triggerMask(const edm::Event &iEvent, const edm::InputTag &l1GtRecordInputTag, const edm::InputTag &l1GtReadoutRecordInputTag, const std::string &nameAlgoTechTrig, int &errorCode) const
return trigger mask for a given algorithm or technical trigger
const bool trigResult(const DecisionWord &decWord, const int bitNumber, const std::string &nameAlgoTechTrig, const TriggerCategory &trigCategory, int &errorCode) const
const L1GtTriggerMenu * m_l1GtMenu
~LogicalExpressionL1Results()
destructor
unsigned long long m_l1GtPfTechCacheID
static const int L1GtNotValidError
volatile std::atomic< bool > shutdown_flag false
unsigned long long m_l1GtTmVetoAlgoCacheID
std::vector< int > m_prescaleFactorSet
const L1GtTriggerMenu * ptrL1TriggerMenuEventSetup(int &errorCode)
return a pointer to the L1 trigger menu from event setup
const int prescaleFactor(const edm::Event &iEvent, const edm::InputTag &l1GtRecordInputTag, const edm::InputTag &l1GtReadoutRecordInputTag, const std::string &nameAlgoTechTrig, int &errorCode) const
return prescale factor for a given algorithm or technical trigger
void reset(double vett[256])
unsigned long long m_l1GtStableParCacheID
const L1GtTriggerMenuLite::L1TriggerMap * m_technicalTriggerMapLite
const std::vector< unsigned int > * m_triggerMaskVetoTechTrig
const std::vector< std::pair< std::string, int > > & errorCodes(const edm::Event &)