Belle II Software development
v0.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 <mdst/dataobjects/V0.h>
9#include <mdst/dataobjects/TrackFitResult.h>
10#include <mdst/dataobjects/Track.h>
11
12#include <framework/datastore/StoreArray.h>
13
14#include <utility>
15
16#include <gtest/gtest.h>
17
18using namespace std;
19
20namespace Belle2 {
27 class V0Test : public ::testing::Test {
28 protected:
30 virtual void SetUp()
31 {
33 StoreArray<Track> tracks;
34 tracks.registerInDataStore();
35 StoreArray<TrackFitResult> trackFitResults;
36 trackFitResults.registerInDataStore();
38 }
39
41 virtual void TearDown()
42 {
44 }
45
47 short m_default_index = -1;
48
49 };
50
52 TEST_F(V0Test, IndexGetters)
53 {
54 V0 myV0;
55 EXPECT_EQ(m_default_index, std::get<0>(myV0.getTrackIndices()));
56 EXPECT_EQ(m_default_index, std::get<1>(myV0.getTrackIndices()));
57 EXPECT_EQ(m_default_index, std::get<0>(myV0.getTrackFitResultIndices()));
58 EXPECT_EQ(m_default_index, std::get<1>(myV0.getTrackFitResultIndices()));
59
60 } // Testcases for Index Getter
61
63 TEST_F(V0Test, PointerGetters)
64 {
65 V0 myV0;
66 EXPECT_ANY_THROW(std::get<0>(myV0.getTracks()));
67 EXPECT_ANY_THROW(std::get<1>(myV0.getTracks()));
68 EXPECT_ANY_THROW(std::get<0>(myV0.getTrackFitResults()));
69 EXPECT_ANY_THROW(std::get<1>(myV0.getTrackFitResults()));
70 } // Testcases for Pointer Getter
71
73} // namespace
static DataStore & Instance()
Instance of singleton Store.
Definition: DataStore.cc:54
void setInitializeActive(bool active)
Setter for m_initializeActive.
Definition: DataStore.cc:94
void reset(EDurability durability)
Frees memory occupied by data store items and removes all objects from the map.
Definition: DataStore.cc:86
bool registerInDataStore(DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut)
Register the object/array in the DataStore.
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
Set up a few arrays and objects in the datastore.
Definition: v0.cc:27
short m_default_index
Default index in constructor if no tracks/tfrs are given.
Definition: v0.cc:47
virtual void TearDown()
clear datastore
Definition: v0.cc:41
virtual void SetUp()
register Particle array
Definition: v0.cc:30
Object holding information for V0s.
Definition: V0.h:34
std::pair< short, short > getTrackFitResultIndices() const
Get indices of the TrackFitResults, that are part of the V0 particle.
Definition: V0.h:65
std::pair< Track *, Track * > getTracks() const
Get pair of yhe Tracks, that are part of the V0 particle.
Definition: V0.h:45
std::pair< short, short > getTrackIndices() const
Get indices of the Tracks, that are part of the V0 particle.
Definition: V0.h:52
std::pair< TrackFitResult *, TrackFitResult * > getTrackFitResults() const
Get pair of the TrackFitResults, that are part of the V0 particle.
Definition: V0.h:58
Abstract base class for different kinds of events.
STL namespace.