Belle II Software development
RaveSetup.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
9
10#include <analysis/VertexFitting/RaveInterface/RaveSetup.h>
11
12#include <framework/geometry/B2Vector3.h>
13
14#include <rave/VacuumPropagator.h>
15#include <rave/MagneticField.h>
16#include <rave/ConstantMagneticField.h>
17#include <rave/VertexFactory.h>
18#include <rave/KinematicTreeFactory.h>
19
20//stl stuff
21#include <string>
22using std::string;
23#include <iostream>
24
25
26using namespace Belle2;
27using namespace analysis;
28
30{
31 static RaveSetup instance;
32 return &instance;
33}
34
35void RaveSetup::initialize(int verbosity, double magneticField)
36{
39 //now setup everything for the use of GFRave
40// getRawInstance()->m_GFRaveVertexFactory = new GFRaveVertexFactory(verbosity, true);
41
42
43 getRawInstance()->m_raveVertexFactory = new rave::VertexFactory(rave::ConstantMagneticField(0, 0, magneticField),
44 rave::VacuumPropagator(), "kalman", verbosity);
45 getRawInstance()->m_raveKinematicTreeFactory = new rave::KinematicTreeFactory(rave::ConstantMagneticField(0, 0, magneticField),
46 rave::VacuumPropagator(), verbosity);
48}
49
50// cppcheck-suppress uninitMemberVar
55
60
62{
63 //delete everything that could have potentially created with new in this class
64
65 delete m_raveVertexFactory; // workaround to avoid crashes with V0 finder
66 m_raveVertexFactory = nullptr;
69 // delete m_GFRaveVertexFactory;
70
71 m_initialized = false;
72}
73
74
75void RaveSetup::setBeamSpot(const ROOT::Math::XYZVector& beamSpot, const TMatrixDSym& beamSpotCov)
76{
77 m_beamSpot = beamSpot;
78 m_beamSpotCov.ResizeTo(beamSpotCov);
79 m_beamSpotCov = beamSpotCov;
80 m_useBeamSpot = true;
81}
82
84{
85 m_useBeamSpot = false;
86}
87
88
89
91{
92 if (getRawInstance() not_eq nullptr) {
93 if (getRawInstance()->m_useBeamSpot == false) {
94 B2INFO("use beam spot is false");
95 } else {
96 B2INFO("use beam spot is true and beam spot position and covariance matrix are:");
99 }
100 B2INFO("the pointer to rave::VertexFactory is " << getRawInstance()->m_raveVertexFactory);
101 } else {
102 B2INFO("RaveSetup::initialize was not called. There is nothing to Print.");
103 }
104}
std::string PrintString(unsigned precision=4) const
create a string containing vector in cartesian and spherical coordinates
Definition B2Vector3.h:481
TMatrixDSym m_beamSpotCov
beam spot position covariance matrix.
Definition RaveSetup.h:71
RaveSetup()
default constructor
Definition RaveSetup.cc:51
void unsetBeamSpot()
unset beam spot constraint
Definition RaveSetup.cc:83
rave::KinematicTreeFactory * m_raveKinematicTreeFactory
< The RAVE Kinematic Tree factory is the principal interface offered by the RAVE for kinematic vertex...
Definition RaveSetup.h:78
bool m_useBeamSpot
flag determines if beam spot information should be used for vertex fit.
Definition RaveSetup.h:69
static void initialize(int verbosity=1, double MagneticField=1.5)
Set everything up so everything needed for vertex fitting is there.
Definition RaveSetup.cc:35
static RaveSetup * getRawInstance()
Same as getInstance(), but no check if the instance is initialised.
Definition RaveSetup.cc:29
bool m_initialized
Has initialize() been called?
Definition RaveSetup.h:80
ROOT::Math::XYZVector m_beamSpot
beam spot position.
Definition RaveSetup.h:70
rave::VertexFactory * m_raveVertexFactory
The RAVE vertex factory is the principal interface offered by the RAVE vertex fitting library.
Definition RaveSetup.h:74
static void Print()
Print() writes all RaveSetup member variables to the terminal.
Definition RaveSetup.cc:90
void setBeamSpot(const ROOT::Math::XYZVector &beamSpot, const TMatrixDSym &beamSpotCov)
The beam spot position and covariance is known you can set it here so that and a vertex in the beam s...
Definition RaveSetup.cc:75
~RaveSetup()
default destructor
Definition RaveSetup.cc:56
void reset()
frees memory allocated by initialize().
Definition RaveSetup.cc:61
B2Vector3< double > B2Vector3D
typedef for common usage with double
Definition B2Vector3.h:516
Abstract base class for different kinds of events.