52 m_l1GtStableParCacheID(0ULL), m_numberAlgorithmTriggers(0),
54 m_numberTechnicalTriggers(0),
56 m_l1GtPfAlgoCacheID(0ULL), m_l1GtPfTechCacheID(0ULL),
58 m_l1GtTmAlgoCacheID(0ULL), m_l1GtTmTechCacheID(0ULL),
60 m_l1GtTmVetoAlgoCacheID(0ULL), m_l1GtTmVetoTechCacheID(0ULL),
62 m_l1GtMenuCacheID(0ULL),
64 m_l1EventSetupValid(
false),
66 m_l1GtMenuLiteValid(
false),
68 m_beginRunCache(
false),
74 m_physicsDaqPartition(0),
76 m_retrieveL1EventSetup(
false),
78 m_retrieveL1GtTriggerMenuLite(
false)
95 switch (trigCategory) {
97 return "Algorithm Trigger";
101 return "Technical Trigger";
124 unsigned long long l1GtStableParCacheID =
154 unsigned long long l1GtPfAlgoCacheID =
169 unsigned long long l1GtPfTechCacheID = evSetup.
get<
187 unsigned long long l1GtTmAlgoCacheID =
202 unsigned long long l1GtTmTechCacheID =
217 unsigned long long l1GtTmVetoAlgoCacheID =
232 unsigned long long l1GtTmVetoTechCacheID =
250 unsigned long long l1GtMenuCacheID =
279 iRun.
getByLabel(l1GtMenuLiteInputTag, l1GtMenuLite);
283 LogDebug(
"L1GtUtils") <<
"\nL1GtTriggerMenuLite with \n "
284 << l1GtMenuLiteInputTag
285 <<
"\nrequested in configuration, but not found in the event."
293 LogDebug(
"L1GtUtils") <<
"\nL1GtTriggerMenuLite with \n "
294 << l1GtMenuLiteInputTag <<
"\nretrieved for run "
323 if (useL1EventSetup) {
332 if (useL1GtTriggerMenuLite) {
343 if (useL1GtTriggerMenuLite) {
348 getL1GtRunCache(iRun, evSetup, useL1EventSetup, useL1GtTriggerMenuLite,
364 if (useL1EventSetup) {
380 if (useL1GtTriggerMenuLite) {
410 if (useL1GtTriggerMenuLite) {
423 getL1GtRunCache(iEvent, evSetup, useL1EventSetup, useL1GtTriggerMenuLite,
433 typedef std::vector<edm::Provenance const*> Provenances;
434 Provenances provenances;
440 bool foundL1GtRecord =
false;
441 bool foundL1GtReadoutRecord =
false;
443 LogDebug(
"L1GtUtils") <<
"\nTry to get AllProvenance for event "
444 << iEvent.
id().
event() << std::endl;
448 LogTrace(
"L1GtUtils") <<
"\n" <<
"Event contains " << provenances.size()
449 <<
" product" << (provenances.size() == 1 ?
"" :
"s")
450 <<
" with friendlyClassName, moduleLabel, productInstanceName and processName:\n"
453 for (Provenances::iterator itProv = provenances.begin(), itProvEnd =
454 provenances.end(); itProv != itProvEnd; ++itProv) {
456 friendlyName = (*itProv)->friendlyClassName();
457 modLabel = (*itProv)->moduleLabel();
458 instanceName = (*itProv)->productInstanceName();
459 processName = (*itProv)->processName();
461 LogTrace(
"L1GtUtils") << friendlyName <<
"\t \"" << modLabel
462 <<
"\" \t \"" << instanceName <<
"\" \t \"" << processName
463 <<
"\"" << std::endl;
465 if (friendlyName ==
"L1GlobalTriggerRecord") {
468 foundL1GtRecord =
true;
469 }
else if (friendlyName ==
"L1GlobalTriggerReadoutRecord") {
471 l1GtReadoutRecordInputTag =
edm::InputTag(modLabel, instanceName,
473 foundL1GtReadoutRecord =
true;
478 if (!foundL1GtRecord) {
482 <<
"\nL1GlobalTriggerRecord found in the event with \n "
483 << l1GtRecordInputTag << std::endl;
486 if (!foundL1GtReadoutRecord) {
490 <<
"\nL1GlobalTriggerReadoutRecord found in the event with \n "
491 << l1GtReadoutRecordInputTag << std::endl;
499 typedef std::vector<edm::Provenance const*> Provenances;
500 Provenances provenances;
506 bool foundL1GtTriggerMenuLite =
false;
508 LogDebug(
"L1GtUtils") <<
"\nTry to get AllProvenance for run "
513 LogTrace(
"L1GtUtils") <<
"\n" <<
"Run contains " << provenances.size()
514 <<
" product" << (provenances.size() == 1 ?
"" :
"s")
515 <<
" with friendlyClassName, moduleLabel, productInstanceName and processName:\n"
518 for (Provenances::iterator itProv = provenances.begin(), itProvEnd =
519 provenances.end(); itProv != itProvEnd; ++itProv) {
521 friendlyName = (*itProv)->friendlyClassName();
522 modLabel = (*itProv)->moduleLabel();
523 instanceName = (*itProv)->productInstanceName();
524 processName = (*itProv)->processName();
526 LogTrace(
"L1GtUtils") << friendlyName <<
"\t \"" << modLabel
527 <<
"\" \t \"" << instanceName <<
"\" \t \"" << processName
528 <<
"\"" << std::endl;
530 if (friendlyName ==
"L1GtTriggerMenuLite") {
531 l1GtTriggerMenuLiteInputTag =
edm::InputTag(modLabel, instanceName,
533 foundL1GtTriggerMenuLite =
true;
538 if (!foundL1GtTriggerMenuLite) {
540 LogTrace(
"L1GtUtils") <<
"\nL1GtTriggerMenuLite not found in Run"
543 LogTrace(
"L1GtUtils") <<
"\nL1GtTriggerMenuLite found in Run with \n "
544 << l1GtTriggerMenuLiteInputTag << std::endl;
552 int& bitNumber)
const {
565 if (itTrig->second == nameAlgoTechTrig) {
568 bitNumber = itTrig->first;
579 if (itTrig->second == nameAlgoTechTrig) {
582 bitNumber = itTrig->first;
593 if (itTrig->second == nameAlgoTechTrig) {
596 bitNumber = itTrig->first;
608 bitNumber = (itAlgo->second).algoBitNumber();
617 bitNumber = (itAlgo->second).algoBitNumber();
626 bitNumber = (itAlgo->second).algoBitNumber();
642 bitNumber = (itAlgo->second).algoBitNumber();
651 bitNumber = (itAlgo->second).algoBitNumber();
660 bitNumber = (itAlgo->second).algoBitNumber();
681 aliasL1Trigger.clear();
682 nameL1Trigger.clear();
690 bool trigAliasFound =
false;
691 bool trigNameFound =
false;
697 if (static_cast<int>(itTrig->first) == bitNumber) {
698 aliasL1Trigger = itTrig->second;
699 trigAliasFound =
true;
708 if (static_cast<int>(itTrig->first) == bitNumber) {
709 nameL1Trigger = itTrig->second;
710 trigNameFound =
true;
715 if (!(trigAliasFound && trigNameFound)) {
725 bool trigNameFound =
false;
731 if (static_cast<int>(itTrig->first) == bitNumber) {
732 nameL1Trigger = itTrig->second;
736 aliasL1Trigger = itTrig->second;
738 trigNameFound =
true;
743 if (!(trigNameFound)) {
760 bool trigAliasFound =
false;
765 if ((itTrig->second).algoBitNumber() == bitNumber) {
766 aliasL1Trigger = itTrig->first;
768 nameL1Trigger = (itTrig->second).algoName();
770 trigAliasFound =
true;
775 if (!(trigAliasFound)) {
785 bool trigNameFound =
false;
790 if ((itTrig->second).algoBitNumber() == bitNumber) {
791 nameL1Trigger = (itTrig->second).algoName();
794 aliasL1Trigger = nameL1Trigger;
796 trigNameFound =
true;
801 if (!(trigNameFound)) {
823 bool trigAliasFound =
false;
828 if ((itTrig->second).algoBitNumber() == bitNumber) {
829 aliasL1Trigger = itTrig->first;
831 nameL1Trigger = (itTrig->second).algoName();
833 trigAliasFound =
true;
838 if (!(trigAliasFound)) {
848 bool trigNameFound =
false;
853 if ((itTrig->second).algoBitNumber() == bitNumber) {
854 nameL1Trigger = (itTrig->second).algoName();
857 aliasL1Trigger = itTrig->first;
859 trigNameFound =
true;
864 if (!(trigNameFound)) {
890 const std::string& nameAlgoTechTrig,
bool& decisionBeforeMask,
891 bool& decisionAfterMask,
int&
prescaleFactor,
int& triggerMask)
const {
894 decisionBeforeMask =
false;
895 decisionAfterMask =
false;
921 iError = l1ConfCode + 1;
926 LogDebug(
"L1GtUtils") <<
"\nAlgorithm/technical trigger \n "
928 <<
"\not found in the trigger menu \n "
930 <<
"\nretrieved from L1GtTriggerMenuLite" << std::endl;
935 LogDebug(
"L1GtUtils") <<
"\nAlgorithm/technical trigger \n "
937 <<
"\not found in the trigger menu \n "
939 <<
"\nretrieved from Event Setup" << std::endl;
945 LogDebug(
"L1GtUtils") <<
"\nAlgorithm/technical trigger \n "
947 <<
"\not found in the trigger menu \n "
949 <<
"\nretrieved from Event Setup" << std::endl;
962 iError = l1ConfCode + 2;
966 LogDebug(
"L1GtUtils") <<
"\nNegative bit number for "
968 << nameAlgoTechTrig <<
"\nfrom menu \n "
970 <<
"\nretrieved from L1GtTriggerMenuLite" << std::endl;
974 LogDebug(
"L1GtUtils") <<
"\nNegative bit number for "
976 << nameAlgoTechTrig <<
"\nfrom menu \n "
978 <<
"\nretrieved from Event Setup" << std::endl;
984 LogDebug(
"L1GtUtils") <<
"\nNegative bit number for "
986 << nameAlgoTechTrig <<
"\nfrom menu \n "
988 <<
"\nretrieved from Event Setup" << std::endl;
1000 int iErrorRecord = 0;
1002 bool validRecord =
false;
1003 bool gtReadoutRecordValid =
false;
1006 iEvent.
getByLabel(l1GtRecordInputTag, gtRecord);
1015 LogDebug(
"L1GtUtils") <<
"\nL1GlobalTriggerRecord with \n "
1016 << l1GtRecordInputTag <<
"\nnot found in the event."
1021 iEvent.
getByLabel(l1GtReadoutRecordInputTag, gtReadoutRecord);
1023 if (gtReadoutRecord.
isValid()) {
1025 gtReadoutRecordValid =
true;
1030 iErrorRecord = iErrorRecord + 100;
1031 LogDebug(
"L1GtUtils") <<
"\nL1GlobalTriggerReadoutRecord with \n "
1032 << l1GtReadoutRecordInputTag <<
"\nnot found in the event."
1043 int pfIndexTechTrig = -1;
1044 int pfIndexAlgoTrig = -1;
1047 if (gtReadoutRecordValid) {
1050 = (gtReadoutRecord->gtFdlWord()).gtPrescaleFactorIndexTech();
1052 = (gtReadoutRecord->gtFdlWord()).gtPrescaleFactorIndexAlgo();
1057 =
static_cast<int> (gtRecord->gtPrescaleFactorIndexTech());
1059 =
static_cast<int> (gtRecord->gtPrescaleFactorIndexAlgo());
1065 LogDebug(
"L1GtUtils") <<
"\nError: "
1066 <<
"\nNo valid L1GlobalTriggerRecord with \n "
1067 << l1GtRecordInputTag <<
"\nfound in the event."
1068 <<
"\nNo valid L1GlobalTriggerReadoutRecord with \n "
1069 << l1GtReadoutRecordInputTag <<
"\nfound in the event."
1072 iError = l1ConfCode + iErrorRecord;
1085 size_t pfSetsSize = 0;
1087 const std::vector<int>* prescaleFactorsSubset = 0;
1088 const std::vector<unsigned int>* triggerMasksSet = 0;
1090 switch (trigCategory) {
1111 pfIndex = pfIndexAlgoTrig;
1135 pfIndex = pfIndexTechTrig;
1141 iError = l1ConfCode + iErrorRecord + 3;
1153 iError = l1ConfCode + iErrorRecord + 1000;
1155 <<
"\nError: index of prescale factor set retrieved from the data \n"
1156 <<
"less than zero."
1157 <<
"\n Value of index retrieved from data = " << pfIndex
1162 }
else if (pfIndex >= (static_cast<int>(pfSetsSize))) {
1163 iError = l1ConfCode + iErrorRecord + 2000;
1165 <<
"\nError: index of prescale factor set retrieved from the data \n"
1166 <<
"greater than the size of the vector of prescale factor sets."
1167 <<
"\n Value of index retrieved from data = " << pfIndex
1168 <<
"\n Vector size = " << pfSetsSize << std::endl;
1173 switch (trigCategory) {
1177 prescaleFactorsSubset
1178 = &((*m_prescaleFactorsAlgoTrigLite).at(pfIndex));
1182 prescaleFactorsSubset
1183 = &((*m_prescaleFactorsAlgoTrig).at(pfIndex));
1189 prescaleFactorsSubset
1190 = &((*m_prescaleFactorsAlgoTrig).at(pfIndex));
1199 prescaleFactorsSubset
1200 = &((*m_prescaleFactorsTechTrigLite).at(pfIndex));
1204 prescaleFactorsSubset
1205 = &((*m_prescaleFactorsTechTrig).at(pfIndex));
1211 prescaleFactorsSubset
1212 = &((*m_prescaleFactorsTechTrig).at(pfIndex));
1231 switch (trigCategory) {
1233 if (gtReadoutRecordValid) {
1234 const DecisionWord& decWord = gtReadoutRecord->decisionWord();
1235 decisionBeforeMask =
trigResult(decWord, bitNumber,
1236 nameAlgoTechTrig, trigCategory, iError);
1238 return (iError + l1ConfCode + iErrorRecord);
1244 gtRecord->decisionWordBeforeMask();
1245 decisionBeforeMask =
trigResult(decWord, bitNumber,
1246 nameAlgoTechTrig, trigCategory, iError);
1248 return (iError + l1ConfCode + iErrorRecord);
1256 if (gtReadoutRecordValid) {
1258 gtReadoutRecord->technicalTriggerWord();
1259 decisionBeforeMask =
trigResult(decWord, bitNumber,
1260 nameAlgoTechTrig, trigCategory, iError);
1262 return (iError + l1ConfCode + iErrorRecord);
1268 gtRecord->technicalTriggerWordBeforeMask();
1269 decisionBeforeMask =
trigResult(decWord, bitNumber,
1270 nameAlgoTechTrig, trigCategory, iError);
1272 return (iError + l1ConfCode + iErrorRecord);
1289 if (bitNumber < (static_cast<int> (prescaleFactorsSubset->size()))) {
1290 prescaleFactor = (*prescaleFactorsSubset)[bitNumber];
1292 iError = l1ConfCode + iErrorRecord + 4000;
1293 LogDebug(
"L1GtUtils") <<
"\nError: bit number " << bitNumber
1296 <<
"\ngreater than size of actual L1 GT prescale factor set: "
1297 << prescaleFactorsSubset->size()
1298 <<
"\nError: Inconsistent L1 trigger configuration!"
1306 if (bitNumber < (static_cast<int> ((*triggerMasksSet).size()))) {
1310 triggerMask = (*triggerMasksSet)[bitNumber];
1315 triggerMask = ((*triggerMasksSet)[bitNumber]) & (1
1323 triggerMask = ((*triggerMasksSet)[bitNumber]) & (1
1330 iError = l1ConfCode + iErrorRecord + 5000;
1331 LogDebug(
"L1GtUtils") <<
"\nError: bit number " << bitNumber
1334 <<
"\ngreater than size of L1 GT trigger mask set: "
1335 << (*triggerMasksSet).size()
1336 <<
"\nError: Inconsistent L1 trigger configuration!"
1346 decisionAfterMask =
false;
1355 const std::string& nameAlgoTechTrig,
bool& decisionBeforeMask,
1356 bool& decisionAfterMask,
int&
prescaleFactor,
int& triggerMask)
const {
1359 decisionBeforeMask =
false;
1360 decisionAfterMask =
false;
1361 prescaleFactor = -1;
1364 int l1ErrorCode = 0;
1368 decisionAfterMask, prescaleFactor, triggerMask);
1379 const std::string& nameAlgoTechTrig,
int& errorCode)
const {
1387 errorCode =
l1Results(iEvent, l1GtRecordInputTag,
1388 l1GtReadoutRecordInputTag, nameAlgoTechTrig, decisionBeforeMask,
1389 decisionAfterMask, prescaleFactor, triggerMask);
1396 const std::string& nameAlgoTechTrig,
int& errorCode)
const {
1404 errorCode =
l1Results(iEvent, nameAlgoTechTrig, decisionBeforeMask,
1405 decisionAfterMask, prescaleFactor, triggerMask);
1416 const std::string& nameAlgoTechTrig,
int& errorCode)
const {
1424 errorCode =
l1Results(iEvent, l1GtRecordInputTag,
1425 l1GtReadoutRecordInputTag, nameAlgoTechTrig, decisionBeforeMask,
1426 decisionAfterMask, prescaleFactor, triggerMask);
1433 const std::string& nameAlgoTechTrig,
int& errorCode)
const {
1441 errorCode =
l1Results(iEvent, nameAlgoTechTrig, decisionBeforeMask,
1442 decisionAfterMask, prescaleFactor, triggerMask);
1453 const std::string& nameAlgoTechTrig,
int& errorCode)
const {
1461 errorCode =
l1Results(iEvent, l1GtRecordInputTag,
1462 l1GtReadoutRecordInputTag, nameAlgoTechTrig, decisionBeforeMask,
1463 decisionAfterMask, prescaleFactor, triggerMask);
1470 const std::string& nameAlgoTechTrig,
int& errorCode)
const {
1478 errorCode =
l1Results(iEvent, nameAlgoTechTrig, decisionBeforeMask,
1479 decisionAfterMask, prescaleFactor, triggerMask);
1490 const std::string& nameAlgoTechTrig,
int& errorCode)
const {
1498 errorCode =
l1Results(iEvent, l1GtRecordInputTag,
1499 l1GtReadoutRecordInputTag, nameAlgoTechTrig, decisionBeforeMask,
1500 decisionAfterMask, prescaleFactor, triggerMask);
1507 const std::string& nameAlgoTechTrig,
int& errorCode)
const {
1515 errorCode =
l1Results(iEvent, nameAlgoTechTrig, decisionBeforeMask,
1516 decisionAfterMask, prescaleFactor, triggerMask);
1525 const std::string& nameAlgoTechTrig,
int& errorCode)
const {
1533 errorCode =
l1Results(iEvent, l1GtRecordInputTag,
1534 l1GtReadoutRecordInputTag, nameAlgoTechTrig, decisionBeforeMask,
1535 decisionAfterMask, prescaleFactor, triggerMask);
1542 const std::string& nameAlgoTechTrig,
int& errorCode)
const {
1550 errorCode =
l1Results(iEvent, nameAlgoTechTrig, decisionBeforeMask,
1551 decisionAfterMask, prescaleFactor, triggerMask);
1558 int& errorCode)
const {
1561 int triggerMaskValue = -1;
1571 return triggerMaskValue;
1585 iError = l1ConfCode + 1;
1590 LogDebug(
"L1GtUtils") <<
"\nAlgorithm/technical trigger \n "
1592 <<
"\not found in the trigger menu \n "
1594 <<
"\nretrieved from L1GtTriggerMenuLite" << std::endl;
1599 LogDebug(
"L1GtUtils") <<
"\nAlgorithm/technical trigger \n "
1601 <<
"\not found in the trigger menu \n "
1603 <<
"\nretrieved from Event Setup" << std::endl;
1609 LogDebug(
"L1GtUtils") <<
"\nAlgorithm/technical trigger \n "
1611 <<
"\not found in the trigger menu \n "
1613 <<
"\nretrieved from Event Setup" << std::endl;
1618 return triggerMaskValue;
1625 if (bitNumber < 0) {
1627 iError = l1ConfCode + 2;
1631 LogDebug(
"L1GtUtils") <<
"\nNegative bit number for "
1633 << nameAlgoTechTrig <<
"\nfrom menu \n "
1635 <<
"\nretrieved from L1GtTriggerMenuLite" << std::endl;
1639 LogDebug(
"L1GtUtils") <<
"\nNegative bit number for "
1641 << nameAlgoTechTrig <<
"\nfrom menu \n "
1643 <<
"\nretrieved from Event Setup" << std::endl;
1649 LogDebug(
"L1GtUtils") <<
"\nNegative bit number for "
1651 << nameAlgoTechTrig <<
"\nfrom menu \n "
1653 <<
"\nretrieved from Event Setup" << std::endl;
1658 return triggerMaskValue;
1666 const std::vector<unsigned int>* triggerMasksSet = 0;
1668 switch (trigCategory) {
1709 iError = l1ConfCode + 3;
1712 return triggerMaskValue;
1720 if (bitNumber < (static_cast<int> ((*triggerMasksSet).size()))) {
1724 triggerMaskValue = (*triggerMasksSet)[bitNumber];
1729 triggerMaskValue = ((*triggerMasksSet)[bitNumber]) & (1
1737 triggerMaskValue = ((*triggerMasksSet)[bitNumber]) & (1
1743 iError = l1ConfCode + 5000;
1744 LogDebug(
"L1GtUtils") <<
"\nError: bit number " << bitNumber
1747 <<
"\ngreater than size of L1 GT trigger mask set: "
1748 << (*triggerMasksSet).size()
1749 <<
"\nError: Inconsistent L1 trigger configuration!"
1753 return triggerMaskValue;
1758 return triggerMaskValue;
1788 int iErrorRecord = 0;
1790 bool validRecord =
false;
1791 bool gtReadoutRecordValid =
false;
1794 iEvent.
getByLabel(l1GtRecordInputTag, gtRecord);
1803 LogDebug(
"L1GtUtils") <<
"\nL1GlobalTriggerRecord with \n "
1804 << l1GtRecordInputTag <<
"\nnot found in the event."
1809 iEvent.
getByLabel(l1GtReadoutRecordInputTag, gtReadoutRecord);
1811 if (gtReadoutRecord.
isValid()) {
1813 gtReadoutRecordValid =
true;
1818 iErrorRecord = iErrorRecord + 100;
1819 LogDebug(
"L1GtUtils") <<
"\nL1GlobalTriggerReadoutRecord with \n "
1820 << l1GtReadoutRecordInputTag <<
"\nnot found in the event."
1831 int pfIndexTechTrig = -1;
1832 int pfIndexAlgoTrig = -1;
1835 if (gtReadoutRecordValid) {
1838 = (gtReadoutRecord->gtFdlWord()).gtPrescaleFactorIndexTech();
1840 = (gtReadoutRecord->gtFdlWord()).gtPrescaleFactorIndexAlgo();
1845 =
static_cast<int> (gtRecord->gtPrescaleFactorIndexTech());
1847 =
static_cast<int> (gtRecord->gtPrescaleFactorIndexAlgo());
1853 LogDebug(
"L1GtUtils") <<
"\nError: "
1854 <<
"\nNo valid L1GlobalTriggerRecord with \n "
1855 << l1GtRecordInputTag <<
"\nfound in the event."
1856 <<
"\nNo valid L1GlobalTriggerReadoutRecord with \n "
1857 << l1GtReadoutRecordInputTag <<
"\nfound in the event."
1860 iError = l1ConfCode + iErrorRecord;
1875 size_t pfSetsSize = 0;
1877 switch (trigCategory) {
1895 pfIndex = pfIndexAlgoTrig;
1916 pfIndex = pfIndexTechTrig;
1922 iError = l1ConfCode + iErrorRecord + 3;
1934 iError = l1ConfCode + iErrorRecord + 1000;
1936 <<
"\nError: index of prescale factor set retrieved from the data \n"
1937 <<
"less than zero."
1938 <<
"\n Value of index retrieved from data = " << pfIndex
1944 }
else if (pfIndex >= (static_cast<int>(pfSetsSize))) {
1945 iError = l1ConfCode + iErrorRecord + 2000;
1947 <<
"\nError: index of prescale factor set retrieved from the data \n"
1948 <<
"greater than the size of the vector of prescale factor sets."
1949 <<
"\n Value of index retrieved from data = " << pfIndex
1950 <<
"\n Vector size = " << pfSetsSize << std::endl;
1998 l1GtReadoutRecordInputTag, trigCategory, iError);
2002 switch (trigCategory) {
2007 = (*m_prescaleFactorsAlgoTrigLite).at(pfIndex);
2029 = (*m_prescaleFactorsTechTrigLite).at(pfIndex);
2107 switch (trigCategory) {
2164 iError = l1ConfCode + 3;
2247 iError = l1ConfCode;
2278 iError = l1ConfCode;
2284 iError = l1ConfCode;
2300 <<
"\nRetrieve L1 trigger configuration from L1GtTriggerMenuLite only.\n"
2305 <<
"\nFall through: retrieve L1 trigger configuration from L1GtTriggerMenuLite."
2306 <<
"\nIf L1GtTriggerMenuLite not valid, try to retrieve from event setup.\n"
2308 l1ConfCode = 100000;
2313 <<
"\nRetrieve L1 trigger configuration from L1GtTriggerMenuLite, valid product.\n"
2315 l1ConfCode = l1ConfCode + 10000;
2323 <<
"\nFall through: retrieve L1 trigger configuration from event setup."
2324 <<
"\nFirst option was L1GtTriggerMenuLite - but product is not valid.\n"
2326 l1ConfCode = l1ConfCode + 20000;
2333 <<
"\nFall through: L1GtTriggerMenuLite not valid, event setup not valid.\n"
2336 errorCode = l1ConfCode;
2345 <<
"\nError: L1 trigger configuration requested from L1GtTriggerMenuLite only"
2346 <<
"\nbut L1GtTriggerMenuLite is not valid.\n" << std::endl;
2348 errorCode = l1ConfCode;
2356 <<
"\nRetrieve L1 trigger configuration from event setup."
2357 <<
"\nL1GtTriggerMenuLite product was not requested.\n"
2359 l1ConfCode = 200000;
2363 <<
"\nRetrieve L1 trigger configuration from event setup only."
2364 <<
"\nValid L1 trigger event setup.\n"
2366 l1ConfCode = l1ConfCode + 10000;
2373 <<
"\nRetrieve L1 trigger configuration from event setup only."
2374 <<
"\nNo valid L1 trigger event setup.\n"
2377 errorCode = l1ConfCode;
2386 <<
"\nError: no L1 trigger configuration requested to be retrieved."
2387 <<
"\nMust call before getL1GtRunCache in beginRun and analyze.\n"
2389 l1ConfCode = 300000;
2390 errorCode = l1ConfCode;
2400 const int bitNumber,
const std::string& nameAlgoTechTrig,
2403 bool trigRes =
false;
2406 if (bitNumber < (static_cast<int> (decWord.size()))) {
2407 trigRes = decWord[bitNumber];
2410 LogDebug(
"L1GtUtils") <<
"\nError: bit number " << bitNumber
2413 <<
"\ngreater than size of L1 GT decision word: "
2415 <<
"\nError: Inconsistent L1 trigger configuration!"
2425 m_logicalExpression(expression),
2427 m_l1GtUtils(l1GtUtils),
2429 m_l1GtRecordInputTag(edm::InputTag()),
2431 m_l1GtReadoutRecordInputTag(edm::InputTag()),
2435 m_validL1Configuration(
false),
2437 m_validLogicalExpression(
false),
2439 m_l1GtInputTagsFromProv(
true),
2441 m_l1ResultsAlreadyCalled(
false),
2443 m_expL1TriggersSize(0),
2445 m_expBitsTechTrigger(
false) {
2455 m_logicalExpression(expression),
2457 m_l1GtUtils(l1GtUtils),
2459 m_l1GtRecordInputTag(l1GtRecordInputTag),
2461 m_l1GtReadoutRecordInputTag(l1GtReadoutRecordInputTag),
2465 m_validL1Configuration(
false),
2467 m_validLogicalExpression(
false),
2469 m_l1GtInputTagsFromProv(
false),
2471 m_l1ResultsAlreadyCalled(
false),
2473 m_expL1TriggersSize(0),
2475 m_expBitsTechTrigger(
false) {
2495 m_logicalExpression);
2499 m_expL1TriggersSize = m_expL1Triggers.size();
2501 m_validLogicalExpression =
true;
2504 m_validLogicalExpression =
false;
2518 m_expBitsTechTrigger =
true;
2520 for (
size_t iTrig = 0; iTrig < m_expL1TriggersSize; ++iTrig) {
2521 const std::string& bitString = (m_expL1Triggers[iTrig]).tokenName;
2522 std::istringstream bitStream(bitString);
2525 if ((bitStream >> bitInt).
fail()) {
2527 m_expBitsTechTrigger =
false;
2532 (m_expL1Triggers[iTrig]).tokenNumber = bitInt;
2537 m_decisionsBeforeMask.resize(m_expL1TriggersSize);
2538 m_decisionsAfterMask.resize(m_expL1TriggersSize);
2539 m_prescaleFactors.resize(m_expL1TriggersSize);
2540 m_triggerMasks.resize(m_expL1TriggersSize);
2541 m_errorCodes.resize(m_expL1TriggersSize);
2542 m_expTriggerCategory.resize(m_expL1TriggersSize);
2543 m_expTriggerInMenu.resize(m_expL1TriggersSize);
2545 LogDebug(
"L1GtUtils") << std::endl;
2546 LogTrace(
"L1GtUtils") <<
"\nLogical expression\n " << m_logicalExpression
2547 <<
"\n has " << m_expL1TriggersSize <<
" L1 triggers" << std::endl;
2548 for (
size_t iTrig = 0; iTrig < m_expL1TriggersSize; ++iTrig) {
2550 const std::string& trigNameOrAlias = (m_expL1Triggers[iTrig]).tokenName;
2551 LogTrace(
"L1GtUtils") <<
" " << trigNameOrAlias << std::endl;
2553 (m_decisionsBeforeMask[iTrig]).
first = trigNameOrAlias;
2554 (m_decisionsBeforeMask[iTrig]).
second =
false;
2556 (m_decisionsAfterMask[iTrig]).
first = trigNameOrAlias;
2557 (m_decisionsAfterMask[iTrig]).
second =
false;
2559 (m_prescaleFactors[iTrig]).
first = trigNameOrAlias;
2560 (m_prescaleFactors[iTrig]).
second = -1;
2562 (m_triggerMasks[iTrig]).
first = trigNameOrAlias;
2563 (m_triggerMasks[iTrig]).
second = -1;
2565 (m_errorCodes[iTrig]).
first = trigNameOrAlias;
2566 (m_errorCodes[iTrig]).
second = -1;
2570 m_expTriggerInMenu[iTrig] =
false;
2573 LogTrace(
"L1GtUtils") << std::endl;
2590 m_logicalExpression = logicExpression;
2591 m_validLogicalExpression =
false;
2593 m_l1ResultsAlreadyCalled =
false;
2595 m_expL1TriggersSize = 0;
2596 m_expBitsTechTrigger =
false;
2599 m_decisionsBeforeMask.clear();
2600 m_decisionsAfterMask.clear();
2601 m_prescaleFactors.clear();
2602 m_triggerMasks.clear();
2603 m_errorCodes.clear();
2604 m_expTriggerCategory.clear();
2605 m_expTriggerInMenu.clear();
2611 errorCode = logicalExpressionRunUpdate(iRun, evSetup);
2628 if (!(m_l1GtUtils.availableL1Configuration(errorCode, l1ConfCode))) {
2630 m_validL1Configuration =
false;
2634 m_validL1Configuration =
true;
2635 m_l1ConfCode = l1ConfCode;
2648 for (
size_t iTrig = 0; iTrig < m_expL1TriggersSize; ++iTrig) {
2652 const std::string& trigNameOrAlias = (m_expL1Triggers[iTrig]).tokenName;
2654 if (!m_expBitsTechTrigger) {
2655 const bool triggerInMenu = m_l1GtUtils.l1AlgoTechTrigBitNumber(
2656 trigNameOrAlias, trigCategory, bitNumber);
2658 (m_expL1Triggers[iTrig]).tokenNumber = bitNumber;
2659 m_expTriggerCategory[iTrig] = trigCategory;
2660 m_expTriggerInMenu[iTrig] = triggerInMenu;
2668 bitNumber = (m_expL1Triggers[iTrig]).tokenNumber;
2670 const bool triggerInMenu = m_l1GtUtils.l1TriggerNameFromBit(
2671 bitNumber, trigCategory, aliasL1Trigger, nameL1Trigger);
2673 if (!triggerInMenu) {
2674 aliasL1Trigger =
"Technical_trigger_bit_"
2675 + (m_expL1Triggers[iTrig]).tokenName +
"_empty";
2678 (m_expL1Triggers[iTrig]).tokenName = aliasL1Trigger;
2679 m_expTriggerCategory[iTrig] = trigCategory;
2680 m_expTriggerInMenu[iTrig] = triggerInMenu;
2684 (m_decisionsBeforeMask[iTrig]).
first = aliasL1Trigger;
2685 (m_decisionsAfterMask[iTrig]).
first = aliasL1Trigger;
2686 (m_prescaleFactors[iTrig]).
first = aliasL1Trigger;
2687 (m_triggerMasks[iTrig]).
first = aliasL1Trigger;
2688 (m_errorCodes[iTrig]).
first = aliasL1Trigger;
2700 if (!m_l1ResultsAlreadyCalled) {
2702 <<
"\n Method 'errorCodes' must be called in the event loop before attempting to use this method.\n"
2706 return m_decisionsBeforeMask;
2713 if (!m_l1ResultsAlreadyCalled) {
2715 <<
"\n Method 'errorCodes' must be called in the event loop before attempting to use this method.\n"
2719 return m_decisionsAfterMask;
2726 if (!m_l1ResultsAlreadyCalled) {
2728 <<
"\n Method 'errorCodes' must be called in the event loop before attempting to use this method.\n"
2732 return m_prescaleFactors;
2739 if (!m_l1ResultsAlreadyCalled) {
2741 <<
"\n Method 'errorCodes' must be called in the event loop before attempting to use this method.\n"
2745 return m_triggerMasks;
2752 m_l1ResultsAlreadyCalled =
false;
2755 if (!m_validL1Configuration) {
2756 reset(m_decisionsBeforeMask);
2757 reset(m_decisionsAfterMask);
2758 reset(m_prescaleFactors);
2759 reset(m_triggerMasks);
2760 reset(m_errorCodes);
2762 m_l1ResultsAlreadyCalled =
true;
2763 return m_errorCodes;
2767 if (m_l1GtInputTagsFromProv) {
2769 l1Results(iEvent, m_l1GtUtils.provL1GtRecordInputTag(),
2770 m_l1GtUtils.provL1GtReadoutRecordInputTag());
2774 l1Results(iEvent, m_l1GtRecordInputTag, m_l1GtReadoutRecordInputTag);
2777 m_l1ResultsAlreadyCalled =
true;
2779 return m_errorCodes;
2784 const std::vector<std::pair<std::string, bool> >& _pairVector)
const {
2785 std::vector<std::pair<std::string, bool> > pairVector = _pairVector;
2786 for (
size_t iTrig = 0; iTrig < m_expL1TriggersSize; ++iTrig) {
2787 (pairVector[iTrig]).
second =
false;
2792 const std::vector<std::pair<std::string, int> >& _pairVector)
const {
2793 std::vector<std::pair<std::string, int> > pairVector = _pairVector;
2794 for (
size_t iTrig = 0; iTrig < m_expL1TriggersSize; ++iTrig) {
2795 (pairVector[iTrig]).
second = -1;
2804 reset(m_decisionsBeforeMask);
2805 reset(m_decisionsAfterMask);
2806 reset(m_prescaleFactors);
2807 reset(m_triggerMasks);
2808 reset(m_errorCodes);
2811 bool decisionBeforeMaskValue =
false;
2812 bool decisionAfterMaskValue =
false;
2813 int prescaleFactorValue = -1;
2814 int triggerMaskValue = -1;
2817 LogDebug(
"L1GtUtils") << std::endl;
2818 LogTrace(
"L1GtUtils") <<
"\nLogical expression\n " << m_logicalExpression
2823 for (
size_t iTrig = 0; iTrig < m_expL1TriggersSize; ++iTrig) {
2825 const std::string& trigNameOrAlias = (m_expL1Triggers[iTrig]).tokenName;
2827 if (m_expTriggerInMenu[iTrig]) {
2828 errorCode = m_l1GtUtils.l1Results(iEvent, l1GtRecordInputTag,
2829 l1GtReadoutRecordInputTag, trigNameOrAlias,
2830 decisionBeforeMaskValue, decisionAfterMaskValue,
2831 prescaleFactorValue, triggerMaskValue);
2833 if (errorCode != 0) {
2838 decisionBeforeMaskValue =
false;
2839 decisionAfterMaskValue =
false;
2840 prescaleFactorValue = -1;
2841 triggerMaskValue = -1;
2849 decisionBeforeMaskValue =
false;
2850 decisionAfterMaskValue =
false;
2851 prescaleFactorValue = -1;
2852 triggerMaskValue = -1;
2853 errorCode = m_l1ConfCode + 1;
2857 LogTrace(
"L1GtUtils") <<
"\n" << trigNameOrAlias <<
":" << std::endl;
2859 (m_decisionsBeforeMask[iTrig]).
second = decisionBeforeMaskValue;
2860 LogTrace(
"L1GtUtils") <<
" decision before mask = "
2861 << decisionBeforeMaskValue << std::endl;
2863 (m_decisionsAfterMask[iTrig]).
second = decisionAfterMaskValue;
2864 LogTrace(
"L1GtUtils") <<
" decision after mask = "
2865 << decisionAfterMaskValue << std::endl;
2867 (m_prescaleFactors[iTrig]).
second = prescaleFactorValue;
2868 LogTrace(
"L1GtUtils") <<
" prescale factor = "
2869 << prescaleFactorValue << std::endl;
2871 (m_triggerMasks[iTrig]).
second = triggerMaskValue;
2872 LogTrace(
"L1GtUtils") <<
" trigger mask = "
2873 << triggerMaskValue << std::endl;
2875 (m_errorCodes[iTrig]).
second = errorCode;
2876 LogTrace(
"L1GtUtils") <<
" error code = " << errorCode
2881 LogDebug(
"L1GtUtils") << std::endl;
bool m_retrieveL1GtTriggerMenuLite
virtual char const * what() const
edm::RunID m_runIDCache
run cache ID
EventNumber_t event() const
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 T & max(const T &a, const T &b)
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
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 &)