Belle II Software light-2406-ragdoll
softwareTriggerResult.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#include <mdst/dataobjects/SoftwareTriggerResult.h>
10#include <gtest/gtest.h>
11
12using namespace std;
13
14namespace Belle2 {
19 namespace SoftwareTrigger {
21 TEST(SoftwareTriggerResultTest, basic)
22 {
23 SoftwareTriggerResult result;
24
25 // First result: an accept result
27
28 EXPECT_EQ(SoftwareTriggerCutResult::c_accept, result.getResult("cutOne"));
29 EXPECT_EQ(SoftwareTriggerCutResult::c_accept, result.getNonPrescaledResult("cutOne"));
30 EXPECT_THROW(result.getResult("cutTwo"), std::out_of_range);
31
32 // Another first result: a reject result
33 result.clear();
35
36 EXPECT_EQ(SoftwareTriggerCutResult::c_reject, result.getResult("cutOne"));
37 EXPECT_EQ(SoftwareTriggerCutResult::c_reject, result.getNonPrescaledResult("cutOne"));
38
39 // Another first result: a don't know result
40 result.clear();
41 result.addResult("cutOne", SoftwareTriggerCutResult::c_noResult);
42
43 EXPECT_EQ(SoftwareTriggerCutResult::c_noResult, result.getResult("cutOne"));
44
45 // The default for non-prescaled should be noResult
46 result.clear();
47 result.addResult("cutOne", SoftwareTriggerCutResult::c_accept);
48
49 EXPECT_EQ(SoftwareTriggerCutResult::c_accept, result.getResult("cutOne"));
50 EXPECT_EQ(SoftwareTriggerCutResult::c_noResult, result.getNonPrescaledResult("cutOne"));
51
52 // Three result
53 result.clear();
54
57 result.addResult("cutThree", SoftwareTriggerCutResult::c_reject);
58
59 EXPECT_EQ(SoftwareTriggerCutResult::c_accept, result.getResult("cutOne"));
60 EXPECT_EQ(SoftwareTriggerCutResult::c_reject, result.getNonPrescaledResult("cutOne"));
61 EXPECT_EQ(SoftwareTriggerCutResult::c_noResult, result.getResult("cutTwo"));
62 EXPECT_EQ(SoftwareTriggerCutResult::c_accept, result.getNonPrescaledResult("cutTwo"));
63 EXPECT_EQ(SoftwareTriggerCutResult::c_reject, result.getResult("cutThree"));
64 EXPECT_EQ(SoftwareTriggerCutResult::c_noResult, result.getNonPrescaledResult("cutThree"));
65 }
66 }
68}
@ c_accept
Accept this event.
@ c_reject
Reject this event.
@ c_noResult
There were not enough information to decide on what to do with the event.
Abstract base class for different kinds of events.
Definition: ClusterUtils.h:24
STL namespace.