Belle II Software  release-05-01-25
v0.cc
1 #include <mdst/dataobjects/V0.h>
2 #include <mdst/dataobjects/TrackFitResult.h>
3 #include <mdst/dataobjects/Track.h>
4 
5 #include <framework/datastore/StoreArray.h>
6 
7 #include <utility>
8 
9 #include <gtest/gtest.h>
10 
11 using namespace std;
12 
13 namespace Belle2 {
20  class V0Test : public ::testing::Test {
21  protected:
23  virtual void SetUp()
24  {
25  DataStore::Instance().setInitializeActive(true);
26  StoreArray<Track> tracks;
27  tracks.registerInDataStore();
28  StoreArray<TrackFitResult> trackFitResults;
29  trackFitResults.registerInDataStore();
30  DataStore::Instance().setInitializeActive(false);
31  }
32 
34  virtual void TearDown()
35  {
36  DataStore::Instance().reset();
37  }
38 
40  short m_default_index = -1;
41 
42  };
43 
45  TEST_F(V0Test, IndexGetters)
46  {
47  V0 myV0;
48  EXPECT_EQ(m_default_index, std::get<0>(myV0.getTrackIndices()));
49  EXPECT_EQ(m_default_index, std::get<1>(myV0.getTrackIndices()));
50  EXPECT_EQ(m_default_index, std::get<0>(myV0.getTrackFitResultIndices()));
51  EXPECT_EQ(m_default_index, std::get<1>(myV0.getTrackFitResultIndices()));
52 
53  } // Testcases for Index Getter
54 
56  TEST_F(V0Test, PointerGetters)
57  {
58  V0 myV0;
59  EXPECT_ANY_THROW(std::get<0>(myV0.getTracks()));
60  EXPECT_ANY_THROW(std::get<1>(myV0.getTracks()));
61  EXPECT_ANY_THROW(std::get<0>(myV0.getTrackFitResults()));
62  EXPECT_ANY_THROW(std::get<1>(myV0.getTrackFitResults()));
63  } // Testcases for Pointer Getter
64 
66 } // namespace
Belle2::V0Test
Set up a few arrays and objects in the datastore.
Definition: v0.cc:20
Belle2::V0
Object holding information for V0s.
Definition: V0.h:40
Belle2::V0::getTracks
std::pair< Track *, Track * > getTracks() const
Get pair of yhe Tracks, that are part of the V0 particle.
Definition: V0.h:50
Belle2::V0Test::TearDown
virtual void TearDown()
clear datastore
Definition: v0.cc:34
Belle2::V0::getTrackIndices
std::pair< short, short > getTrackIndices() const
Get indices of the Tracks, that are part of the V0 particle.
Definition: V0.h:57
Belle2::V0::getTrackFitResultIndices
std::pair< short, short > getTrackFitResultIndices() const
Get indices of the TrackFitResults, that are part of the V0 particle.
Definition: V0.h:70
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::V0::getTrackFitResults
std::pair< TrackFitResult *, TrackFitResult * > getTrackFitResults() const
Get pair of the TrackFitResults, that are part of the V0 particle.
Definition: V0.h:63
Belle2::TEST_F
TEST_F(V0Test, PointerGetters)
Test Pointer Getter.
Definition: v0.cc:56
Belle2::StoreArray
Accessor to arrays stored in the data store.
Definition: ECLMatchingPerformanceExpertModule.h:33
Belle2::V0Test::SetUp
virtual void SetUp()
register Particle array
Definition: v0.cc:23