9 #include <hlt/softwaretrigger/core/FinalTriggerDecisionCalculator.h>
10 #include <mdst/dataobjects/SoftwareTriggerResult.h>
11 #include <hlt/softwaretrigger/core/SoftwareTriggerDBHandler.h>
12 #include <gtest/gtest.h>
21 namespace SoftwareTrigger {
23 TEST(FinalTriggerDecisionCalculatorTest, basic)
25 SoftwareTriggerResult result;
28 EXPECT_EQ(SoftwareTriggerCutResult::c_accept, FinalTriggerDecisionCalculator::getModuleResult(result,
"test",
true));
29 EXPECT_EQ(SoftwareTriggerCutResult::c_reject, FinalTriggerDecisionCalculator::getModuleResult(result,
"test",
false));
32 result.addResult(SoftwareTriggerDBHandler::makeFullCutName(
"test",
"cutOne"), SoftwareTriggerCutResult::c_accept);
34 EXPECT_EQ(SoftwareTriggerCutResult::c_accept, result.getResult(SoftwareTriggerDBHandler::makeFullCutName(
"test",
"cutOne")));
35 EXPECT_THROW(result.getResult(SoftwareTriggerDBHandler::makeFullCutName(
"test",
"cutTwo")), std::out_of_range);
37 EXPECT_EQ(SoftwareTriggerCutResult::c_accept, FinalTriggerDecisionCalculator::getModuleResult(result,
"test",
true));
38 EXPECT_EQ(SoftwareTriggerCutResult::c_accept, FinalTriggerDecisionCalculator::getModuleResult(result,
"test",
false));
42 result.addResult(SoftwareTriggerDBHandler::makeFullCutName(
"test",
"cutOne"), SoftwareTriggerCutResult::c_reject);
44 EXPECT_EQ(SoftwareTriggerCutResult::c_reject, result.getResult(SoftwareTriggerDBHandler::makeFullCutName(
"test",
"cutOne")));
45 EXPECT_EQ(SoftwareTriggerCutResult::c_reject, FinalTriggerDecisionCalculator::getModuleResult(result,
"test",
true));
46 EXPECT_EQ(SoftwareTriggerCutResult::c_reject, FinalTriggerDecisionCalculator::getModuleResult(result,
"test",
false));
50 result.addResult(SoftwareTriggerDBHandler::makeFullCutName(
"test",
"cutOne"), SoftwareTriggerCutResult::c_noResult);
52 EXPECT_EQ(SoftwareTriggerCutResult::c_noResult, result.getResult(SoftwareTriggerDBHandler::makeFullCutName(
"test",
"cutOne")));
53 EXPECT_EQ(SoftwareTriggerCutResult::c_accept, FinalTriggerDecisionCalculator::getModuleResult(result,
"test",
true));
54 EXPECT_EQ(SoftwareTriggerCutResult::c_reject, FinalTriggerDecisionCalculator::getModuleResult(result,
"test",
false));
57 result.addResult(SoftwareTriggerDBHandler::makeFullCutName(
"other_test",
"cutOne"), SoftwareTriggerCutResult::c_accept);
59 EXPECT_EQ(SoftwareTriggerCutResult::c_accept, result.getResult(SoftwareTriggerDBHandler::makeFullCutName(
"other_test",
"cutOne")));
61 EXPECT_EQ(SoftwareTriggerCutResult::c_accept, FinalTriggerDecisionCalculator::getModuleResult(result,
"test",
true));
62 EXPECT_EQ(SoftwareTriggerCutResult::c_reject, FinalTriggerDecisionCalculator::getModuleResult(result,
"test",
false));
65 result.addResult(SoftwareTriggerDBHandler::makeFullCutName(
"test",
"cutOne"), SoftwareTriggerCutResult::c_accept);
66 result.addResult(SoftwareTriggerDBHandler::makeFullCutName(
"test",
"cutTwo"), SoftwareTriggerCutResult::c_noResult);
67 result.addResult(SoftwareTriggerDBHandler::makeFullCutName(
"test",
"cutThree"), SoftwareTriggerCutResult::c_reject);
69 EXPECT_EQ(SoftwareTriggerCutResult::c_accept, result.getResult(SoftwareTriggerDBHandler::makeFullCutName(
"test",
"cutOne")));
70 EXPECT_EQ(SoftwareTriggerCutResult::c_noResult, result.getResult(SoftwareTriggerDBHandler::makeFullCutName(
"test",
"cutTwo")));
71 EXPECT_EQ(SoftwareTriggerCutResult::c_reject, result.getResult(SoftwareTriggerDBHandler::makeFullCutName(
"test",
"cutThree")));
73 EXPECT_EQ(SoftwareTriggerCutResult::c_accept, FinalTriggerDecisionCalculator::getModuleResult(result,
"test",
true));
74 EXPECT_EQ(SoftwareTriggerCutResult::c_reject, FinalTriggerDecisionCalculator::getModuleResult(result,
"test",
false));
77 result.addResult(SoftwareTriggerDBHandler::makeFullCutName(
"test",
"cutFour"), SoftwareTriggerCutResult::c_accept);
79 EXPECT_EQ(SoftwareTriggerCutResult::c_accept, FinalTriggerDecisionCalculator::getModuleResult(result,
"test",
true));
80 EXPECT_EQ(SoftwareTriggerCutResult::c_reject, FinalTriggerDecisionCalculator::getModuleResult(result,
"test",
false));
84 result.addResult(SoftwareTriggerDBHandler::makeFullCutName(
"test",
"cutOne"), SoftwareTriggerCutResult::c_accept);
85 result.addResult(SoftwareTriggerDBHandler::makeFullCutName(
"test",
"cutTwo"), SoftwareTriggerCutResult::c_accept);
86 result.addResult(SoftwareTriggerDBHandler::makeFullCutName(
"test",
"cutThree"), SoftwareTriggerCutResult::c_reject);
88 EXPECT_EQ(SoftwareTriggerCutResult::c_accept, FinalTriggerDecisionCalculator::getModuleResult(result,
"test",
true));
89 EXPECT_EQ(SoftwareTriggerCutResult::c_reject, FinalTriggerDecisionCalculator::getModuleResult(result,
"test",
false));
93 result.addResult(SoftwareTriggerDBHandler::makeFullCutName(
"test",
"cutOne"), SoftwareTriggerCutResult::c_reject);
94 result.addResult(SoftwareTriggerDBHandler::makeFullCutName(
"test",
"cutTwo"), SoftwareTriggerCutResult::c_accept);
95 result.addResult(SoftwareTriggerDBHandler::makeFullCutName(
"test",
"cutThree"), SoftwareTriggerCutResult::c_reject);
97 EXPECT_EQ(SoftwareTriggerCutResult::c_accept, FinalTriggerDecisionCalculator::getModuleResult(result,
"test",
true));
98 EXPECT_EQ(SoftwareTriggerCutResult::c_reject, FinalTriggerDecisionCalculator::getModuleResult(result,
"test",
false));
101 result.addResult(SoftwareTriggerDBHandler::makeFullCutName(
"test",
"cutSix"), SoftwareTriggerCutResult::c_accept);
102 result.addResult(SoftwareTriggerDBHandler::makeFullCutName(
"test",
"cutSeven"), SoftwareTriggerCutResult::c_accept);
104 EXPECT_EQ(SoftwareTriggerCutResult::c_accept, FinalTriggerDecisionCalculator::getModuleResult(result,
"test",
true));
105 EXPECT_EQ(SoftwareTriggerCutResult::c_reject, FinalTriggerDecisionCalculator::getModuleResult(result,
"test",
false));
109 TEST(FinalTriggerDecisionCalculatorTest, result)
111 SoftwareTriggerResult result;
114 EXPECT_EQ(
true, FinalTriggerDecisionCalculator::getFinalTriggerDecision(result));
117 result.addResult(SoftwareTriggerDBHandler::makeFullCutName(
"filter",
"some_cut"), SoftwareTriggerCutResult::c_reject);
118 EXPECT_EQ(
true, FinalTriggerDecisionCalculator::getFinalTriggerDecision(result));
123 result.addResult(SoftwareTriggerDBHandler::makeTotalResultName(
"filter"), SoftwareTriggerCutResult::c_reject);
124 EXPECT_EQ(
false, FinalTriggerDecisionCalculator::getFinalTriggerDecision(result));
128 result.addResult(SoftwareTriggerDBHandler::makeTotalResultName(
"filter"), SoftwareTriggerCutResult::c_accept);
129 result.addResult(SoftwareTriggerDBHandler::makeTotalResultName(
"skim"), SoftwareTriggerCutResult::c_accept);
130 EXPECT_EQ(
true, FinalTriggerDecisionCalculator::getFinalTriggerDecision(result));
134 result.addResult(SoftwareTriggerDBHandler::makeTotalResultName(
"filter"), SoftwareTriggerCutResult::c_reject);
135 result.addResult(SoftwareTriggerDBHandler::makeTotalResultName(
"skim"), SoftwareTriggerCutResult::c_accept);
136 EXPECT_EQ(
false, FinalTriggerDecisionCalculator::getFinalTriggerDecision(result));
140 result.addResult(SoftwareTriggerDBHandler::makeTotalResultName(
"filter"), SoftwareTriggerCutResult::c_accept);
141 result.addResult(SoftwareTriggerDBHandler::makeTotalResultName(
"skim"), SoftwareTriggerCutResult::c_reject);
142 EXPECT_EQ(
true, FinalTriggerDecisionCalculator::getFinalTriggerDecision(result));
147 result.addResult(SoftwareTriggerDBHandler::makeTotalResultName(
"fast_reco"), SoftwareTriggerCutResult::c_reject);
148 EXPECT_EQ(
false, FinalTriggerDecisionCalculator::getFinalTriggerDecision(result));
152 result.addResult(SoftwareTriggerDBHandler::makeTotalResultName(
"fast_reco"), SoftwareTriggerCutResult::c_accept);
153 result.addResult(SoftwareTriggerDBHandler::makeTotalResultName(
"hlt"), SoftwareTriggerCutResult::c_accept);
154 EXPECT_EQ(
true, FinalTriggerDecisionCalculator::getFinalTriggerDecision(result));
158 result.addResult(SoftwareTriggerDBHandler::makeTotalResultName(
"fast_reco"), SoftwareTriggerCutResult::c_reject);
159 result.addResult(SoftwareTriggerDBHandler::makeTotalResultName(
"hlt"), SoftwareTriggerCutResult::c_accept);
160 EXPECT_EQ(
false, FinalTriggerDecisionCalculator::getFinalTriggerDecision(result));
164 result.addResult(SoftwareTriggerDBHandler::makeTotalResultName(
"fast_reco"), SoftwareTriggerCutResult::c_accept);
165 result.addResult(SoftwareTriggerDBHandler::makeTotalResultName(
"hlt"), SoftwareTriggerCutResult::c_accept);
166 result.addResult(SoftwareTriggerDBHandler::makeTotalResultName(
"calib"), SoftwareTriggerCutResult::c_reject);
TEST(TestgetDetectorRegion, TestgetDetectorRegion)
Test Constructors.
Abstract base class for different kinds of events.