22 if (
config.exists(
"andOrL1")) {
34 hltConfigInit_(
false),
39 errorReplyDcs_(
false),
52 errorReplyHlt_(
false),
58 configError_(
"CONFIG_ERROR"),
59 emptyKeyError_(
"EMPTY_KEY_ERROR") {
61 if (
config.exists(
"andOr")) {
63 if (
config.exists(
"verbosityLevel"))
74 if (
config.exists(
"andOrDcs")) {
83 if (
config.exists(
"andOrGt")) {
89 if (
config.exists(
"gtEvmInputTag")) {
93 if (
config.exists(
"gtDBKey"))
98 if (
config.exists(
"andOrL1")) {
100 if (
config.exists(
"stage2"))
106 if (
config.exists(
"l1DBKey"))
108 if (
config.exists(
"l1BeforeMask"))
113 if (
config.exists(
"andOrHlt")) {
119 if (
config.exists(
"hltDBKey"))
127 if (
config.exists(
"dbLabel"))
129 watchDB_ = std::make_unique<edm::ESWatcher<AlCaRecoTriggerBitsRcd> >();
144 if (stage1Valid ==
false)
145 throw cms::Exception(
"ConfigError") <<
" Error when constructing GenericTriggerEventFlag, legacy/stage-1 is "
146 "requested but the constructor called is stage2 only";
179 <<
"HLT TriggerResults InputTag \"" <<
hltInputTag_.
encode() <<
"\" specifies no process";
181 bool hltChanged(
false);
185 <<
"HLT config initialization error with process name \"" <<
hltInputTag_.
process() <<
"\"";
188 edm::LogError(
"GenericTriggerEventFlag") <<
"HLT config size error";
199 std::vector<std::string> algoNames;
204 const std::vector<std::pair<std::string, int> >
prescales =
l1uGt_->prescales();
206 algoNames.push_back(ip.first);
212 for (
CItAlgo iAlgo = l1GtPhys.begin(); iAlgo != l1GtPhys.end(); ++iAlgo) {
213 algoNames.push_back(iAlgo->second.algoName());
216 for (
CItAlgo iAlgo = l1GtTech.begin(); iAlgo != l1GtTech.end(); ++iAlgo) {
217 algoNames.push_back(iAlgo->second.algoName());
225 for (
size_t iAlgo = 0; iAlgo < l1AlgoLogicParser.operandTokenVector().size(); ++iAlgo) {
226 const std::string l1AlgoName(l1AlgoLogicParser.operandTokenVector().at(iAlgo).tokenName);
227 if (l1AlgoName.find(
'*') != std::string::npos) {
228 l1LogicalExpression.replace(
235 for (
unsigned iExpr = 0; iExpr <
tmp.size(); ++iExpr)
236 if (
std::find(algoNames.begin(), algoNames.end(),
tmp[iExpr]) == algoNames.end()) {
240 <<
"L1 algorithm \"" <<
tmp[iExpr]
241 <<
"\" does not exist in the L1 menu ==> drop it from the list of l1LogicalExpressions";
250 for (
size_t iPath = 0; iPath < hltAlgoLogicParser.operandTokenVector().size(); ++iPath) {
251 const std::string hltPathName(hltAlgoLogicParser.operandTokenVector().at(iPath).tokenName);
252 if (hltPathName.find(
'*') != std::string::npos) {
253 hltLogicalExpression.replace(hltLogicalExpression.find(hltPathName),
289 if ((*dcsStatus).empty()) {
299 for (std::vector<int>::const_iterator partitionNumber =
dcsPartitions_.begin();
307 for (std::vector<int>::const_iterator partitionNumber =
dcsPartitions_.begin();
317 int dcsPartition)
const {
319 switch (dcsPartition) {
348 <<
"DCS partition number \"" << dcsPartition <<
"\" does not exist ==> decision: " <<
errorReplyDcs_;
353 return dcsStatus->at(0).ready(dcsPartition);
366 ++gtLogicalExpression) {
374 ++gtLogicalExpression) {
384 if (gtLogicalExpression.empty()) {
391 bool negExpr(
negate(gtLogicalExpression));
392 if (negExpr && gtLogicalExpression.empty()) {
395 <<
"Empty (negated) logical expression ==> decision: " <<
errorReplyGt_;
402 for (
size_t iStatusBit = 0; iStatusBit < gtAlgoLogicParser.
operandTokenVector().size(); ++iStatusBit) {
407 if (gtStatusBit ==
"PhysDecl" || gtStatusBit ==
"PhysicsDeclared") {
410 if (!gtReadoutRecord.
isValid()) {
413 <<
"L1GlobalTriggerReadoutRecord product with InputTag \"" <<
gtInputTag_.
encode()
419 }
else if (gtStatusBit ==
"Stable" || gtStatusBit ==
"StableBeam" || gtStatusBit ==
"Adjust" ||
420 gtStatusBit ==
"Sqeeze" || gtStatusBit ==
"Flat" || gtStatusBit ==
"FlatTop" || gtStatusBit ==
"7TeV" ||
421 gtStatusBit ==
"8TeV" || gtStatusBit ==
"13TeV" || gtStatusBit ==
"2360GeV" || gtStatusBit ==
"900GeV") {
424 if (!gtEvmReadoutRecord.
isValid()) {
432 if (gtStatusBit ==
"Stable" || gtStatusBit ==
"StableBeam") {
434 }
else if (gtStatusBit ==
"Adjust") {
436 }
else if (gtStatusBit ==
"Sqeeze") {
438 }
else if (gtStatusBit ==
"Flat" || gtStatusBit ==
"FlatTop") {
440 }
else if (gtStatusBit ==
"7TeV") {
442 }
else if (gtStatusBit ==
"8TeV") {
444 }
else if (gtStatusBit ==
"13TeV") {
446 }
else if (gtStatusBit ==
"2360GeV") {
448 }
else if (gtStatusBit ==
"900GeV") {
454 <<
"GT status bit \"" << gtStatusBit <<
"\" is not defined ==> decision: " <<
errorReplyGt_;
461 return negExpr ? (!gtDecision) : gtDecision;
474 ++l1LogicalExpression) {
482 ++l1LogicalExpression) {
501 if (l1LogicalExpression.empty()) {
508 bool negExpr(
negate(l1LogicalExpression));
509 if (negExpr && l1LogicalExpression.empty()) {
512 <<
"Empty (negated) logical expression ==> decision: " <<
errorReplyL1_;
519 for (
size_t iAlgorithm = 0; iAlgorithm < l1AlgoLogicParser.
operandTokenVector().size(); ++iAlgorithm) {
522 bool decision =
false;
526 :
l1uGt_->getFinalDecisionByName(l1AlgoName, decision));
532 :
l1Gt_->decisionAfterMask(
event, l1AlgoName, errorINT));
533 error = (errorINT != 0);
537 <<
"L1 algorithm \"" << l1AlgoName <<
"\" received error code " <<
error
538 <<
" from L1GtUtils::decisionBeforeMask ==> decision: " <<
errorReplyL1_;
545 <<
"L1 algorithm \"" << l1AlgoName <<
"\" does not exist in the L1 menu ==> decision: " <<
errorReplyL1_;
555 return negExpr ? (!l1Decision) : l1Decision;
574 if (!hltTriggerResults.
isValid()) {
580 if ((*hltTriggerResults).size() == 0) {
591 ++hltLogicalExpression) {
599 ++hltLogicalExpression) {
610 if (hltLogicalExpression.empty()) {
617 bool negExpr(
negate(hltLogicalExpression));
618 if (negExpr && hltLogicalExpression.empty()) {
621 <<
"Empty (negated) logical expression ==> decision: " <<
errorReplyHlt_;
628 for (
size_t iPath = 0; iPath < hltAlgoLogicParser.
operandTokenVector().size(); ++iPath) {
634 edm::LogWarning(
"GenericTriggerEventFlag") <<
"HLT path \"" << hltPathName <<
"\" is not found in process "
639 if (hltTriggerResults->
error(indexPath)) {
642 <<
"HLT path \"" << hltPathName <<
"\" in error ==> decision: " <<
errorReplyHlt_;
647 const bool decision(hltTriggerResults->
accept(indexPath));
653 return negExpr ? (!hltDecision) : hltDecision;
661 std::vector<std::string>
matched;
663 if (
expr.substr(
expr.size() - versionWildcard.size()) == versionWildcard) {
673 edm::LogWarning(
"GenericTriggerEventFlag") <<
"Logical expression: \"" <<
expr <<
"\" could not be resolved";
679 for (
unsigned iVers = 0; iVers <
matched.size(); ++iVers) {
681 expanded.append(useAnd ?
" AND " :
" OR ");
682 expanded.append(
matched.at(iVers));
684 expanded.append(
")");
686 edm::LogInfo(
"GenericTriggerEventFlag") <<
"Logical expression: \"" <<
expr <<
"\"\n"
687 <<
" --> expanded to \"" << expanded <<
"\"";
695 if (
word.at(0) ==
'~') {
707 std::vector<edm::eventsetup::DataKey>
labels;
709 std::vector<edm::eventsetup::DataKey>::const_iterator iKey =
labels.begin();
712 if (iKey ==
labels.end()) {
715 <<
"Label " <<
dbLabel_ <<
" not found in DB for 'AlCaRecoTriggerBitsRcd'";
719 const std::map<std::string, std::string>& expressionMap = alCaRecoTriggerBits.
m_alcarecoToTrig;
720 std::map<std::string, std::string>::const_iterator listIter = expressionMap.find(
key);
721 if (listIter == expressionMap.end()) {
724 <<
"No logical expressions found under key " <<
key <<
" in 'AlCaRecoTriggerBitsRcd'";
727 return alCaRecoTriggerBits.
decompose(listIter->second);
738 <<
"HLTConfigProvider is not initialized, method will return \"false\"";
753 for (
size_t iPath = 0; iPath < hltAlgoLogicParser.
operandTokenVector().size(); ++iPath) {
761 <<
"HLT path \"" << hltPathName <<
"\" is not found in process " <<
hltInputTag_.
process();