Belle II Software development
eventLevelTrackingInfo.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#include <gtest/gtest.h>
9#include <framework/utilities/TestHelpers.h>
10#include <mdst/dataobjects/EventLevelTrackingInfo.h>
11
12namespace Belle2 {
18 class EventLevelTrackingInfoTest : public ::testing::Test {
19 protected:
20 };
21
23 TEST_F(EventLevelTrackingInfoTest, settersNGettersCDC)
24 {
25 // Test proper initialization for an empty afterimage.
26 EventLevelTrackingInfo eventLevelTrackingInfo;
27 EXPECT_EQ(eventLevelTrackingInfo.getNCDCHitsNotAssigned(), 0);
28 EXPECT_EQ(eventLevelTrackingInfo.getNCDCHitsNotAssignedPostCleaning(), 0);
29
30 //Let's set the total number CDC hits in the afterimage
31 eventLevelTrackingInfo.setNCDCHitsNotAssigned(324);
32 eventLevelTrackingInfo.setNCDCHitsNotAssignedPostCleaning(257);
33
34 EXPECT_EQ(eventLevelTrackingInfo.getNCDCHitsNotAssigned(), 324);
35 EXPECT_EQ(eventLevelTrackingInfo.getNCDCHitsNotAssignedPostCleaning(), 257);
36
37 //Let's set and get information for the various layers:
38 eventLevelTrackingInfo.setCDCLayer(9); // SL1
39 EXPECT_TRUE(eventLevelTrackingInfo.hasCDCLayer(9));
40 EXPECT_FALSE(eventLevelTrackingInfo.hasCDCLayer(10));
41 eventLevelTrackingInfo.setCDCLayer(23);
42 EXPECT_TRUE(eventLevelTrackingInfo.hasCDCLayer(23));
43 EXPECT_FALSE(eventLevelTrackingInfo.hasCDCLayer(55));
44
45 EXPECT_B2FATAL(eventLevelTrackingInfo.setCDCLayer(56));
46 EXPECT_B2FATAL(eventLevelTrackingInfo.hasCDCLayer(56));
47
48 //Let's have a look at the SuperLayers ...
49 EXPECT_TRUE(eventLevelTrackingInfo.hasCDCSLayer(1));
50 EXPECT_FALSE(eventLevelTrackingInfo.hasCDCSLayer(5));
51
52 //Let's set and get the information on unused segments:
53 eventLevelTrackingInfo.setNCDCSegments(21);
54 EXPECT_EQ(eventLevelTrackingInfo.getNCDCSegments(), 21);
55 eventLevelTrackingInfo.setNCDCSegments(300);
56 EXPECT_EQ(eventLevelTrackingInfo.getNCDCSegments(), 255);
57 }
58
60 TEST_F(EventLevelTrackingInfoTest, settersNGettersVXD)
61 {
62 EventLevelTrackingInfo eventLevelTrackingInfo;
63 EXPECT_EQ(eventLevelTrackingInfo.getNVXDClustersInLayer(3), 0);
64 eventLevelTrackingInfo.setNVXDClustersInLayer(3, true, 81);
65 EXPECT_EQ(eventLevelTrackingInfo.getNVXDClustersInLayer(3), 81);
66 eventLevelTrackingInfo.setNVXDClustersInLayer(2, true, 3456);
67 EXPECT_EQ(eventLevelTrackingInfo.getNVXDClustersInLayer(2), 3456);
68 EXPECT_EQ(eventLevelTrackingInfo.getNVXDClustersInLayer(3, true), 81);
69 EXPECT_EQ(eventLevelTrackingInfo.getNVXDClustersInLayer(3, false), 0);
70 EXPECT_B2FATAL(eventLevelTrackingInfo.getNVXDClustersInLayer(56));
71
72 eventLevelTrackingInfo.setNVXDClustersInLayer(6, true, 300);
73 EXPECT_EQ(eventLevelTrackingInfo.getNVXDClustersInLayer(6, true), 255);
74
75 eventLevelTrackingInfo.setSVDFirstSampleTime(-128);
76 EXPECT_EQ(eventLevelTrackingInfo.getSVDFirstSampleTime(), -128);
77 eventLevelTrackingInfo.setSVDFirstSampleTime(127);
78 EXPECT_EQ(eventLevelTrackingInfo.getSVDFirstSampleTime(), 127);
79 }
80
82 TEST_F(EventLevelTrackingInfoTest, settersNGettersFlagBlock)
83 {
84 EventLevelTrackingInfo eventLevelTrackingInfo;
85 EXPECT_EQ(eventLevelTrackingInfo.hasUnspecifiedTrackFindingFailure(), false);
86 EXPECT_EQ(eventLevelTrackingInfo.hasAnErrorFlag(), false);
87 EXPECT_EQ(eventLevelTrackingInfo.hasVXDTF2AbortionFlag(), false);
88 eventLevelTrackingInfo.setUnspecifiedTrackFindingFailure();
89 EXPECT_EQ(eventLevelTrackingInfo.hasUnspecifiedTrackFindingFailure(), true);
90 EXPECT_EQ(eventLevelTrackingInfo.hasAnErrorFlag(), true);
91 EXPECT_EQ(eventLevelTrackingInfo.hasVXDTF2AbortionFlag(), false);
92
93 EventLevelTrackingInfo eventLevelTrackingInfo2;
94 EXPECT_EQ(eventLevelTrackingInfo2.hasVXDTF2AbortionFlag(), false);
95 EXPECT_EQ(eventLevelTrackingInfo2.hasAnErrorFlag(), false);
96 EXPECT_EQ(eventLevelTrackingInfo2.hasUnspecifiedTrackFindingFailure(), false);
97 eventLevelTrackingInfo2.setVXDTF2AbortionFlag();
98 EXPECT_EQ(eventLevelTrackingInfo2.hasVXDTF2AbortionFlag(), true);
99 EXPECT_EQ(eventLevelTrackingInfo2.hasAnErrorFlag(), true);
100 EXPECT_EQ(eventLevelTrackingInfo2.hasUnspecifiedTrackFindingFailure(), false);
101 }
103} // namespace Belle2
Unit tests for the event level tracking information.
Tracking-related info on event-level, for example number of unassigned measurements.
bool hasCDCLayer(uint16_t const cdcLayer) const
Getter for presence of hit in specific CDC Layer.
bool hasCDCSLayer(uint16_t const cdcSLayer) const
Getter for the presence of hit in a SuperLayer.
uint16_t getNCDCSegments() const
Getter for number of segments not used in Tracks.
bool hasVXDTF2AbortionFlag() const
Getter for flag indicating that the VXDTF2 was aborted due to high combinatorics in the event.
uint16_t getNVXDClustersInLayer(uint16_t const layer, bool const isU)
Getter for number of clusters in a specific VXD layer, SVD separated by direction.
void setSVDFirstSampleTime(int8_t const sampleTime)
Setter for time of first SVD sample relatvie to event T0.
void setNVXDClustersInLayer(uint16_t const layer, bool const isU, uint16_t const nClusters)
Setter for number of clusters in specific VXD layer, SVD directions are separated.
uint16_t getNCDCHitsNotAssignedPostCleaning() const
Getter for number of CDC measurements, that are not assigned to any Track nor very likely beam-backgr...
void setNCDCHitsNotAssignedPostCleaning(uint16_t const nCDCHitsNotAssignedPostCleaning)
Setter for number of CDC measurements, that are not assigned to any Track nor very likely beam-backgr...
int8_t getSVDFirstSampleTime() const
Getter for time of first SVD sample relative to event T0.
uint16_t getNCDCHitsNotAssigned() const
Getter for number of CDC measurements, that are not assigned to any Track.
void setVXDTF2AbortionFlag()
Setter for flag indicating that the VXDTF2 was aborted due to high combinatorics in the event.
bool hasAnErrorFlag() const
Check if any flag was set in the event.
bool hasUnspecifiedTrackFindingFailure() const
Getter for unspecified hint of track finding failure.
void setCDCLayer(uint16_t const cdcLayer)
Setter for presence of hit in specific CDC Layer.
void setUnspecifiedTrackFindingFailure()
Setter for unspecified hint of track finding failure.
void setNCDCSegments(uint16_t nHits)
Setter for number of Segments not used in Tracks.
void setNCDCHitsNotAssigned(uint16_t const nCDCHitsNotAssigned)
Setter for number of CDC measurements, that are not assigned to any Track.
Abstract base class for different kinds of events.