Belle II Software  release-05-01-25
SVDRecoTimeBase.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Peter Kvasnicka *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #include <vxd/dataobjects/VxdID.h>
12 #include <svd/dataobjects/SVDModeByte.h>
13 #include <svd/dataobjects/SVDRecoTimeBase.h>
14 #include <vector>
15 #include <string>
16 #include <gtest/gtest.h>
17 
18 namespace Belle2 {
23  namespace SVD {
24 
28  TEST(SVDRecoTimeBase, ConstructEmpty)
29  {
30  // Create an empty time base
31  SVDRecoTimeBase timeBase;
32  // Test getters
33  EXPECT_EQ(0, timeBase.getSensorID());
34  EXPECT_TRUE(timeBase.isUStrip());
35  const SVDRecoTimeBase::BinEdgesArray bins = timeBase.getBins();
36  EXPECT_EQ(0, timeBase.getNBins());
37  for (auto bin : bins)
38  EXPECT_EQ(SVDRecoTimeBase::BinnedDataType(0.0), bin);
39  EXPECT_EQ(SVDModeByte::c_DefaultID, timeBase.getModeByte().getID());
40  EXPECT_EQ("0-suppr/global/6 samples/???", std::string(timeBase.getModeByte()));
41  }
42 
46  TEST(SVDRecoTimeBase, ConstructFromContainer)
47  {
48  // Create an arbitrary recotimeBase
49  VxdID sensorID(3, 4, 1);
50  SVDModeByte timeBaseModeByte(151);
51  std::vector<float> init_bins({ -5.0, -3.0, -1.0, 1.0, 3.0, 5.0});
52  SVDRecoTimeBase timeBase(sensorID, false, init_bins, timeBaseModeByte);
53  // Test getters
54  EXPECT_EQ(sensorID, timeBase.getSensorID());
55  EXPECT_FALSE(timeBase.isUStrip());
56  EXPECT_EQ(init_bins.size() - 1, timeBase.getNBins());
57  const SVDRecoTimeBase::BinEdgesArray& bins = timeBase.getBins();
58  for (size_t ib = 0; ib < bins.size(); ++ib)
59  EXPECT_EQ(init_bins[ib], bins[ib]);
60  EXPECT_EQ(timeBaseModeByte, timeBase.getModeByte());
61  EXPECT_EQ("0-suppr/global/6 samples/???", std::string(timeBase.getModeByte()));
62  }
66  TEST(SVDRecoTimeBase, toString)
67  {
68  // Create an arbitrary recotimeBase
69  VxdID sensorID(3, 4, 1);
70  SVDModeByte timeBaseModeByte(151);
71  std::vector<float> init_bins({ -5.0, -3.0, -1.0, 1.0, 3.0, 5.0});
72  SVDRecoTimeBase timeBase(sensorID, false, init_bins, timeBaseModeByte);
73  // Test toString method
74  EXPECT_EQ("VXDID : 25632 = 3.4.1 side: V bins: -5 -3 -1 1 3 5 mode: 0-suppr/global/6 samples/???\n", timeBase.toString());
75  }
76 
77  } // namespace SVD
79 } // namespace Belle2
Belle2::SVDRecoTimeBase::BinnedDataType
float BinnedDataType
Types for bins array.
Definition: SVDRecoTimeBase.h:51
Belle2::VxdID
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:43
Belle2::SVDRecoTimeBase
The SVD RecoTimeBase class.
Definition: SVDRecoTimeBase.h:45
Belle2::SVDModeByte::c_DefaultID
static const baseType c_DefaultID
Default / non-informative id 10010111 = 151 Run type: zero-suppressed, 2 Event type: global run,...
Definition: SVDModeByte.h:116
Belle2::SVDModeByte
Class to store SVD mode information.
Definition: SVDModeByte.h:79
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::SVDRecoTimeBase::BinEdgesArray
std::vector< BinnedDataType > BinEdgesArray
BinEdgesArray[i] is the left edge of bin i.
Definition: SVDRecoTimeBase.h:53
Belle2::SVD::TEST
TEST(NNTimeFitter, DISABLED_CompareNetworkCoefficient)
Compare NN fitter parameter dump from Python with internal data representation in C++ to verify that ...
Definition: NNFitterTest.cc:37