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
50RaveSetup::RaveSetup(): m_useBeamSpot(false), m_raveVertexFactory(nullptr)/*, m_GFRaveVertexFactory(NULL)*/,
52{
53}
54
59
61{
62 //delete everything that could have potentially created with new in this class
63
64 delete m_raveVertexFactory; // workaround to avoid crashes with V0 finder
65 m_raveVertexFactory = nullptr;
68 // delete m_GFRaveVertexFactory;
69
70 m_initialized = false;
71}
72
73
74void RaveSetup::setBeamSpot(const ROOT::Math::XYZVector& beamSpot, const TMatrixDSym& beamSpotCov)
75{
76 m_beamSpot = beamSpot;
77 m_beamSpotCov.ResizeTo(beamSpotCov);
78 m_beamSpotCov = beamSpotCov;
79 m_useBeamSpot = true;
80}
81
83{
84 m_useBeamSpot = false;
85}
86
87
88
90{
91 if (getRawInstance() not_eq nullptr) {
92 if (getRawInstance()->m_useBeamSpot == false) {
93 B2INFO("use beam spot is false");
94 } else {
95 B2INFO("use beam spot is true and beam spot position and covariance matrix are:");
98 }
99 B2INFO("the pointer to rave::VertexFactory is " << getRawInstance()->m_raveVertexFactory);
100 } else {
101 B2INFO("RaveSetup::initialize was not called. There is nothing to Print.");
102 }
103}
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:74
RaveSetup()
default constructor
Definition RaveSetup.cc:50
void unsetBeamSpot()
unset beam spot constraint
Definition RaveSetup.cc:82
rave::KinematicTreeFactory * m_raveKinematicTreeFactory
< The RAVE Kinematic Tree factory is the principal interface offered by the RAVE for kinematic vertex...
Definition RaveSetup.h:81
bool m_useBeamSpot
flag determines if beam spot information should be used for vertex fit.
Definition RaveSetup.h:72
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:83
ROOT::Math::XYZVector m_beamSpot
beam spot position.
Definition RaveSetup.h:73
rave::VertexFactory * m_raveVertexFactory
The RAVE vertex factory is the principal interface offered by the RAVE vertex fitting library.
Definition RaveSetup.h:77
static void Print()
Print() writes all RaveSetup member variables to the terminal.
Definition RaveSetup.cc:89
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:74
~RaveSetup()
default destructor
Definition RaveSetup.cc:55
void reset()
frees memory allocated by initialize().
Definition RaveSetup.cc:60
B2Vector3< double > B2Vector3D
typedef for common usage with double
Definition B2Vector3.h:516
Abstract base class for different kinds of events.