Belle II Software development
eventLevelTriggerTimeInfo.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 <gtest/gtest.h>
10#include <framework/utilities/TestHelpers.h>
11#include <mdst/dataobjects/EventLevelTriggerTimeInfo.h>
12
13namespace Belle2 {
18
20 class EventLevelTriggerTimeInfoTest : public ::testing::Test {
21 protected:
22 };
23
26 {
28 EXPECT_EQ(short(tti.getEventT0Sources()), 0);
29 EXPECT_FALSE(tti.hasAnyEventT0Sources());
30 EXPECT_FALSE(tti.hasEventT0SourceFromSVD());
31 EXPECT_FALSE(tti.hasEventT0SourceFromCDC());
32 EXPECT_FALSE(tti.hasEventT0SourceFromECL());
33
34 tti.addEventT0SourceFromSVD(); // +1
35 EXPECT_EQ(short(tti.getEventT0Sources()), 1);
36 EXPECT_TRUE(tti.hasAnyEventT0Sources());
37 EXPECT_TRUE(tti.hasEventT0SourceFromSVD());
38 EXPECT_FALSE(tti.hasEventT0SourceFromCDC());
39 EXPECT_FALSE(tti.hasEventT0SourceFromECL());
40
41 tti.addEventT0SourceFromECL(); // +4
42 EXPECT_EQ(short(tti.getEventT0Sources()), 5);
43 EXPECT_TRUE(tti.hasAnyEventT0Sources());
44 EXPECT_TRUE(tti.hasEventT0SourceFromSVD());
45 EXPECT_FALSE(tti.hasEventT0SourceFromCDC());
46 EXPECT_TRUE(tti.hasEventT0SourceFromECL());
47
48 tti.unsetEventT0SourceFromSVD(); // -1
49 EXPECT_EQ(short(tti.getEventT0Sources()), 4);
50 EXPECT_TRUE(tti.hasAnyEventT0Sources());
51 EXPECT_FALSE(tti.hasEventT0SourceFromSVD());
52 EXPECT_FALSE(tti.hasEventT0SourceFromCDC());
53 EXPECT_TRUE(tti.hasEventT0SourceFromECL());
54
55 tti.unsetEventT0SourceFromCDC(); // no effect
56 EXPECT_EQ(short(tti.getEventT0Sources()), 4);
57 EXPECT_TRUE(tti.hasAnyEventT0Sources());
58 EXPECT_FALSE(tti.hasEventT0SourceFromSVD());
59 EXPECT_FALSE(tti.hasEventT0SourceFromCDC());
60 EXPECT_TRUE(tti.hasEventT0SourceFromECL());
61
62 tti.resetEventT0Sources(); // same as initialized
63 EXPECT_EQ(short(tti.getEventT0Sources()), 0);
64 EXPECT_FALSE(tti.hasAnyEventT0Sources());
65 EXPECT_FALSE(tti.hasEventT0SourceFromSVD());
66 EXPECT_FALSE(tti.hasEventT0SourceFromCDC());
67 EXPECT_FALSE(tti.hasEventT0SourceFromECL());
68
69 tti.addEventT0SourceFromSVD(); // +1
70 tti.addEventT0SourceFromCDC(); // +2
71 tti.addEventT0SourceFromECL(); // +4
72 EXPECT_EQ(short(tti.getEventT0Sources()), 7);
73 EXPECT_TRUE(tti.hasAnyEventT0Sources());
74 EXPECT_TRUE(tti.hasEventT0SourceFromSVD());
75 EXPECT_TRUE(tti.hasEventT0SourceFromCDC());
76 EXPECT_TRUE(tti.hasEventT0SourceFromECL());
77
78 tti.unsetEventT0SourceFromECL(); // -4
79 EXPECT_EQ(short(tti.getEventT0Sources()), 3);
80 EXPECT_TRUE(tti.hasAnyEventT0Sources());
81 EXPECT_TRUE(tti.hasEventT0SourceFromSVD());
82 EXPECT_TRUE(tti.hasEventT0SourceFromCDC());
83 EXPECT_FALSE(tti.hasEventT0SourceFromECL());
84 }
85
86} // namespace Belle2
Unit tests for the event level trigger time information.
Storage element for information from the Trigger Timing Distribution (TTD) and EventT0-related inform...
void addEventT0SourceFromSVD()
Add the flag c_fromSVD to the EventT0 source mask.
void addEventT0SourceFromECL()
Add the flag c_fromECL to the EventT0 source mask.
void unsetEventT0SourceFromSVD()
Remove the flag c_fromSVD from the EventT0 source mask.
bool hasAnyEventT0Sources() const
Return if at least one flag is set in the EventT0 source mask.
void unsetEventT0SourceFromCDC()
Remove the flag c_fromCDC from the EventT0 source mask.
void resetEventT0Sources()
Reset all the flags from the EventT0 source mask (aka: set the "total" mask to 0)
bool hasEventT0SourceFromECL() const
Return if the c_fromECL flag is set in the EventT0 source mask.
void addEventT0SourceFromCDC()
Add the flag c_fromCDC to the EventT0 source mask.
bool hasEventT0SourceFromCDC() const
Return if the c_fromCDC flag is set in the EventT0 source mask.
const EventT0Source & getEventT0Sources() const
Return the EventT0 source mask.
void unsetEventT0SourceFromECL()
Remove the flag c_fromECL from the EventT0 source mask.
bool hasEventT0SourceFromSVD() const
Return if the c_fromSVD flag is set in the EventT0 source mask.
TEST_F(GlobalLabelTest, LargeNumberOfTimeDependentParameters)
Test large number of time-dep params for registration and retrieval.
Abstract base class for different kinds of events.