Belle II Software  release-08-01-10
v0fitter.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 <tracking/v0Finding/fitter/V0Fitter.h>
9 
10 #include <framework/gearbox/Const.h>
11 
12 #include <genfit/FieldManager.h>
13 #include <genfit/MaterialEffects.h>
14 #include <genfit/ConstField.h>
15 #include <genfit/TGeoMaterialInterface.h>
16 
17 #include <utility>
18 
19 #include <gtest/gtest.h>
20 
21 using namespace std;
22 
23 namespace Belle2 {
30  class V0FitterTest : public ::testing::Test {
31  };
32 
34  TEST_F(V0FitterTest, GetTrackHypotheses)
35  {
36  genfit::MaterialEffects::getInstance()->init(new genfit::TGeoMaterialInterface());
38  V0Fitter v0Fitter;
39  const auto kShortTracks = v0Fitter.getTrackHypotheses(Const::Kshort);
40  const auto photonTracks = v0Fitter.getTrackHypotheses(Const::photon);
41  const auto lambdaTracks = v0Fitter.getTrackHypotheses(Const::Lambda);
42  const auto antiLambdaTracks = v0Fitter.getTrackHypotheses(Const::antiLambda);
43 
44  EXPECT_EQ(Const::pion, kShortTracks.first);
45  EXPECT_EQ(Const::pion, kShortTracks.second);
46 
47  EXPECT_EQ(Const::electron, photonTracks.first);
48  EXPECT_EQ(Const::electron, photonTracks.second);
49 
50  EXPECT_EQ(Const::proton, lambdaTracks.first);
51  EXPECT_EQ(Const::pion, lambdaTracks.second);
52 
53  EXPECT_EQ(Const::pion, antiLambdaTracks.first);
54  EXPECT_EQ(Const::proton, antiLambdaTracks.second);
55  }
56 
58  TEST_F(V0FitterTest, InitializeCuts)
59  {
60  genfit::MaterialEffects::getInstance()->init(new genfit::TGeoMaterialInterface());
62  V0Fitter v0Fitter;
63  v0Fitter.initializeCuts(1.0, 10000., {0.425, 0.575}, {1.09, 1.14}, {0, 0.1});
64  EXPECT_EQ(1.0, v0Fitter.m_beamPipeRadius);
65  EXPECT_EQ(10000., v0Fitter.m_vertexChi2CutOutside);
66  EXPECT_EQ(std::make_tuple(0.425, 0.575), v0Fitter.m_invMassRangeKshort);
67  EXPECT_EQ(std::make_tuple(1.09, 1.14), v0Fitter.m_invMassRangeLambda);
68  EXPECT_EQ(std::make_tuple(0, 0.1), v0Fitter.m_invMassRangePhoton);
69  }
70 
72 } // namespace
Set up a few arrays and objects in the datastore.
Definition: v0fitter.cc:30
V0Fitter class to create V0 mdst's from reconstructed tracks.
Definition: V0Fitter.h:39
void initializeCuts(double beamPipeRadius, double vertexChi2CutOutside, std::tuple< double, double > invMassRangeKshort, std::tuple< double, double > invMassRangeLambda, std::tuple< double, double > invMassRangePhoton)
Initialize the cuts which will be applied during the fit and store process.
Definition: V0Fitter.cc:94
std::pair< Const::ParticleType, Const::ParticleType > getTrackHypotheses(const Const::ParticleType &v0Hypothesis) const
Get track hypotheses for a given v0 hypothesis.
Definition: V0Fitter.cc:189
double m_beamPipeRadius
Radius where inside/outside beampipe is defined.
Definition: V0Fitter.h:163
std::tuple< double, double > m_invMassRangePhoton
invariant mass cut for Photon.
Definition: V0Fitter.h:167
double m_vertexChi2CutOutside
Chi2 cut outside beampipe.
Definition: V0Fitter.h:164
std::tuple< double, double > m_invMassRangeKshort
invariant mass cut for Kshort.
Definition: V0Fitter.h:165
std::tuple< double, double > m_invMassRangeLambda
invariant mass cut for Lambda.
Definition: V0Fitter.h:166
Constant Magnetic field.
Definition: ConstField.h:37
static FieldManager * getInstance()
Get singleton instance.
Definition: FieldManager.h:119
void init(AbsBField *b)
set the magnetic field here. Magnetic field classes must be derived from AbsBField.
Definition: FieldManager.h:78
void init(AbsMaterialInterface *matIfc)
set the material interface here. Material interface classes must be derived from AbsMaterialInterface...
AbsMaterialInterface implementation for use with ROOT's TGeoManager.
TEST_F(V0FitterTest, InitializeCuts)
Test initialization of cuts.
Definition: v0fitter.cc:58
Abstract base class for different kinds of events.