diff --git a/Trigger/TrigSteer/DecisionHandling/DecisionHandling/ComboHypoToolBase.h b/Trigger/TrigSteer/DecisionHandling/DecisionHandling/ComboHypoToolBase.h index 21037649564233a44710ea0ed051ab02ab6b008d..183fdf3636e577e7c28b3e2f9b0c9d0dd13eb188 100644 --- a/Trigger/TrigSteer/DecisionHandling/DecisionHandling/ComboHypoToolBase.h +++ b/Trigger/TrigSteer/DecisionHandling/DecisionHandling/ComboHypoToolBase.h @@ -108,6 +108,12 @@ public: Gaudi::Property<size_t> m_combinationsThresholdBreak {this, "CombinationsThresholdBreak", 10000, "Events processing this many combinations will generate a second WARNING message, and the loop over combinations will be terminated at this point."}; + + Gaudi::Property<bool> m_modeOR {this, "ModeOR", true, + "Accepts based on the logical OR over all calls to executeAlg. If this flag is set to false then the logical AND is required instead."}; + + Gaudi::Property<bool> m_enableOverride {this, "EnableOverride", false, + "Stops processing combinations as soon as a valid combination is found in OR mode, or as soon as an invalid combination is found in AND mode. This is to save CPU."}; // TODO - add optional write out of the data stored in passingCombinations in the decide function. diff --git a/Trigger/TrigSteer/DecisionHandling/share/test_ComboHypoTool.ref b/Trigger/TrigSteer/DecisionHandling/share/test_ComboHypoTool.ref index 34bb158195cb0225214b6df06c6acd941d0735b6..54c3d83970efe4047caa61bd1b1f86943a975685 100644 --- a/Trigger/TrigSteer/DecisionHandling/share/test_ComboHypoTool.ref +++ b/Trigger/TrigSteer/DecisionHandling/share/test_ComboHypoTool.ref @@ -1,5 +1,4 @@ - ApplicationMgr INFO Application Manager Configured successfully EventLoopMgr WARNING Unable to locate service "EventSelector" EventLoopMgr WARNING No events will be processed from external input. @@ -52,7 +51,7 @@ HLT_e25 SUCCESS Next Combination: HLT_e25 SUCCESS -- HLT_e25 ID#3480115263 f:My_ELEC_Container i:1 pT:40 HLT_e25 SUCCESS Next Combination: HLT_e25 SUCCESS -- HLT_e25 ID#3480115263 f:My_ELEC_Container i:2 pT:30 -HLT_e25 DEBUG Passing 1 combinations out of 3, HLT_e25 ID#3480115263 **ACCEPTS** this event. +HLT_e25 DEBUG Passing 1 combinations out of 3, HLT_e25 ID#3480115263 **ACCEPTS** this event based on OR logic. HLT_e25 DEBUG -- Passing combination 0 of 1 HLT_e25 DEBUG -- -- HLT_e25 ID#3480115263 container:HLTNav_Elec, index:0 HLT_e25 DEBUG ComboHypoToolBase: End of HLT_e25 ID#3480115263, passing elements are: @@ -88,7 +87,7 @@ HLT_e25_mu35 SUCCESS -- leg001_HLT_e25_mu35 ID#4271136129 f:My_MUON_Contain HLT_e25_mu35 SUCCESS Next Combination: HLT_e25_mu35 SUCCESS -- leg000_HLT_e25_mu35 ID#2563460054 f:My_ELEC_Container i:2 pT:30 HLT_e25_mu35 SUCCESS -- leg001_HLT_e25_mu35 ID#4271136129 f:My_MUON_Container i:1 pT:40 -HLT_e25_mu35 DEBUG Passing 1 combinations out of 6, HLT_e25_mu35 ID#373038112 **ACCEPTS** this event. +HLT_e25_mu35 DEBUG Passing 1 combinations out of 6, HLT_e25_mu35 ID#373038112 **ACCEPTS** this event based on OR logic. HLT_e25_mu35 DEBUG -- Passing combination 0 of 1 HLT_e25_mu35 DEBUG -- -- leg000_HLT_e25_mu35 ID#2563460054 container:HLTNav_Elec, index:0 HLT_e25_mu35 DEBUG -- -- leg001_HLT_e25_mu35 ID#4271136129 container:HLTNav_Muon, index:0 @@ -120,7 +119,7 @@ HLT_e35_e35 SUCCESS -- leg001_HLT_e35_e35 ID#3593781442 f:My_ELEC_Containe HLT_e35_e35 SUCCESS Next Combination: HLT_e35_e35 SUCCESS -- leg000_HLT_e35_e35 ID#3620307964 f:My_ELEC_Container i:1 pT:40 HLT_e35_e35 SUCCESS -- leg001_HLT_e35_e35 ID#3593781442 f:My_ELEC_Container i:1 pT:40 -HLT_e35_e35 DEBUG Passing 1 combinations out of 4, HLT_e35_e35 ID#3161969949 **ACCEPTS** this event. +HLT_e35_e35 DEBUG Passing 1 combinations out of 4, HLT_e35_e35 ID#3161969949 **ACCEPTS** this event based on OR logic. HLT_e35_e35 DEBUG -- Passing combination 0 of 1 HLT_e35_e35 DEBUG -- -- leg000_HLT_e35_e35 ID#3620307964 container:HLTNav_Elec, index:0 HLT_e35_e35 DEBUG -- -- leg001_HLT_e35_e35 ID#3593781442 container:HLTNav_Elec, index:0 @@ -158,7 +157,7 @@ HLT_2mu15 SUCCESS -- HLT_2mu15 ID#1058481211 f:My_MUON_Container i:3 pT: HLT_2mu15 SUCCESS Next Combination: HLT_2mu15 SUCCESS -- HLT_2mu15 ID#1058481211 f:My_MUON_Container i:2 pT:30 HLT_2mu15 SUCCESS -- HLT_2mu15 ID#1058481211 f:My_MUON_Container i:3 pT:20 -HLT_2mu15 DEBUG Passing 3 combinations out of 6, HLT_2mu15 ID#1058481211 **ACCEPTS** this event. +HLT_2mu15 DEBUG Passing 3 combinations out of 6, HLT_2mu15 ID#1058481211 **ACCEPTS** this event based on OR logic. HLT_2mu15 DEBUG -- Passing combination 0 of 3 HLT_2mu15 DEBUG -- -- HLT_2mu15 ID#1058481211 container:HLTNav_Muon, index:0 HLT_2mu15 DEBUG -- -- HLT_2mu15 ID#1058481211 container:HLTNav_Muon, index:1 @@ -190,7 +189,7 @@ HLT_5mu5 SUCCESS -- HLT_5mu5 ID#1405614769 f:My_MUON_Container i:2 pT:3 HLT_5mu5 SUCCESS -- HLT_5mu5 ID#1405614769 f:My_MUON_Container i:3 pT:20 HLT_5mu5 SUCCESS -- HLT_5mu5 ID#1405614769 f:My_MUON_Container i:4 pT:10 HLT_5mu5 DEBUG Combination 0 decided to be passing -HLT_5mu5 DEBUG Passing 1 combinations out of 1, HLT_5mu5 ID#1405614769 **ACCEPTS** this event. +HLT_5mu5 DEBUG Passing 1 combinations out of 1, HLT_5mu5 ID#1405614769 **ACCEPTS** this event based on OR logic. HLT_5mu5 DEBUG -- Passing combination 0 of 1 HLT_5mu5 DEBUG -- -- HLT_5mu5 ID#1405614769 container:HLTNav_Muon, index:0 HLT_5mu5 DEBUG -- -- HLT_5mu5 ID#1405614769 container:HLTNav_Muon, index:1 @@ -307,7 +306,7 @@ HLT_2e25_3mu15 SUCCESS -- leg000_HLT_2e25_3mu15 ID#3088384102 f:My_ELEC_Conta HLT_2e25_3mu15 SUCCESS -- leg001_HLT_2e25_3mu15 ID#4138555611 f:My_MUON_Container i:1 pT:40 HLT_2e25_3mu15 SUCCESS -- leg001_HLT_2e25_3mu15 ID#4138555611 f:My_MUON_Container i:2 pT:30 HLT_2e25_3mu15 SUCCESS -- leg001_HLT_2e25_3mu15 ID#4138555611 f:My_MUON_Container i:3 pT:20 -HLT_2e25_3mu15 DEBUG Passing 6 combinations out of 12, HLT_2e25_3mu15 ID#270470543 **ACCEPTS** this event. +HLT_2e25_3mu15 DEBUG Passing 6 combinations out of 12, HLT_2e25_3mu15 ID#270470543 **ACCEPTS** this event based on OR logic. HLT_2e25_3mu15 DEBUG -- Passing combination 0 of 6 HLT_2e25_3mu15 DEBUG -- -- leg000_HLT_2e25_3mu15 ID#3088384102 container:HLTNav_Elec, index:0 HLT_2e25_3mu15 DEBUG -- -- leg000_HLT_2e25_3mu15 ID#3088384102 container:HLTNav_Elec, index:1 @@ -620,7 +619,7 @@ HLT_e35_2mu25_4j5 SUCCESS -- leg002_HLT_e35_2mu25_4j5 ID#862137673 f:My_JETS_Con HLT_e35_2mu25_4j5 SUCCESS -- leg002_HLT_e35_2mu25_4j5 ID#862137673 f:My_JETS_Container i:2 pT:30 HLT_e35_2mu25_4j5 SUCCESS -- leg002_HLT_e35_2mu25_4j5 ID#862137673 f:My_JETS_Container i:3 pT:20 HLT_e35_2mu25_4j5 SUCCESS -- leg002_HLT_e35_2mu25_4j5 ID#862137673 f:My_JETS_Container i:4 pT:10 -HLT_e35_2mu25_4j5 DEBUG Passing 8 combinations out of 30, HLT_e35_2mu25_4j5 ID#1056038866 **ACCEPTS** this event. +HLT_e35_2mu25_4j5 DEBUG Passing 8 combinations out of 30, HLT_e35_2mu25_4j5 ID#1056038866 **ACCEPTS** this event based on OR logic. HLT_e35_2mu25_4j5 DEBUG -- Passing combination 0 of 8 HLT_e35_2mu25_4j5 DEBUG -- -- leg000_HLT_e35_2mu25_4j5 ID#572077314 container:HLTNav_Elec, index:0 HLT_e35_2mu25_4j5 DEBUG -- -- leg001_HLT_e35_2mu25_4j5 ID#1863374539 container:HLTNav_Muon, index:0 @@ -957,7 +956,7 @@ HLT_2e35_e45_3m...SUCCESS -- leg002_HLT_2e35_e45_3mu15_mu35_j25 ID#873905799 f:M HLT_2e35_e45_3m...SUCCESS -- leg002_HLT_2e35_e45_3mu15_mu35_j25 ID#873905799 f:My_MUON_Container i:3 pT:20 HLT_2e35_e45_3m...SUCCESS -- leg003_HLT_2e35_e45_3mu15_mu35_j25 ID#1315781797 f:My_MUON_Container i:1 pT:40 HLT_2e35_e45_3m...SUCCESS -- leg004_HLT_2e35_e45_3mu15_mu35_j25 ID#4003323228 f:My_JETS_Container i:2 pT:30 -HLT_2e35_e45_3m... DEBUG Passing 3 combinations out of 24, HLT_2e35_e45_3mu15_mu35_j25 ID#1413975787 **ACCEPTS** this event. +HLT_2e35_e45_3m... DEBUG Passing 3 combinations out of 24, HLT_2e35_e45_3mu15_mu35_j25 ID#1413975787 **ACCEPTS** this event based on OR logic. HLT_2e35_e45_3m... DEBUG -- Passing combination 0 of 3 HLT_2e35_e45_3m... DEBUG -- -- leg000_HLT_2e35_e45_3mu15_mu35_j25 ID#1296237030 container:HLTNav_Elec, index:0 HLT_2e35_e45_3m... DEBUG -- -- leg000_HLT_2e35_e45_3mu15_mu35_j25 ID#1296237030 container:HLTNav_Elec, index:1 diff --git a/Trigger/TrigSteer/DecisionHandling/src/ComboHypoToolBase.cxx b/Trigger/TrigSteer/DecisionHandling/src/ComboHypoToolBase.cxx index e9e9dca088311905e4d82cb7f8cfd9c8efddfd22..1a97e3ac2cb22dd8d29938798dc2a03925d1caff 100644 --- a/Trigger/TrigSteer/DecisionHandling/src/ComboHypoToolBase.cxx +++ b/Trigger/TrigSteer/DecisionHandling/src/ComboHypoToolBase.cxx @@ -101,17 +101,25 @@ StatusCode ComboHypoToolBase::decide(Combo::LegDecisionsMap& passingLegs, const } } + ++iterations; + try { if (executeAlg(combinationToCheck)) { - ATH_MSG_DEBUG("Combination " << iterations << " decided to be passing"); + ATH_MSG_DEBUG("Combination " << (iterations - 1) << " decided to be passing"); passingCombinations.push_back(combinationToCheck); + if (m_modeOR == true and m_enableOverride) { + break; + } + } else { // the combination failed + if (m_modeOR == false and m_enableOverride) { + break; + } } } catch (std::exception& e) { ATH_MSG_ERROR(e.what()); return StatusCode::FAILURE; } - ++iterations; if ((iterations >= m_combinationsThresholdWarn && warnings == 0) or (iterations >= m_combinationsThresholdBreak)) { ATH_MSG_WARNING("Have so far processed " << iterations << " combinations for " << m_decisionId << " in this event, " << passingCombinations.size() << " passing."); ++warnings; @@ -123,8 +131,32 @@ StatusCode ComboHypoToolBase::decide(Combo::LegDecisionsMap& passingLegs, const } while (nucg); - ATH_MSG_DEBUG("Passing " << passingCombinations.size() << " combinations out of " << iterations << ", " - << m_decisionId << (passingCombinations.size() ? " **ACCEPTS**" : " **REJECTS**") << " this event."); + + if (m_modeOR) { + + ATH_MSG_DEBUG("Passing " << passingCombinations.size() << " combinations out of " << iterations << ", " + << m_decisionId << (passingCombinations.size() ? " **ACCEPTS**" : " **REJECTS**") << " this event based on OR logic."); + + if (m_enableOverride) { + ATH_MSG_DEBUG("Note: stopped after the first successful combination due to the EnableOverride flag."); + } + + } else { // modeAND + + const bool passAll = (passingCombinations.size() == iterations); + + ATH_MSG_DEBUG("Passing " << passingCombinations.size() << " combinations out of " << iterations << ", " + << m_decisionId << (passAll ? " **ACCEPTS**" : " **REJECTS**") << " this event based on AND logic."); + + if (m_enableOverride) { + ATH_MSG_DEBUG("Note: stopped after the first failed combination due to the EnableOverride flag."); + } + + if (not passAll) { + passingCombinations.clear(); + } + + } if (not passingCombinations.empty()) { // need partial erasure of the decsions (only those not present in any combination) updateLegDecisionsMap(passingCombinations, passingLegs);