Belle II Software development
RaveVertexFitter.h
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#pragma once
10
11#include <analysis/VertexFitting/RaveInterface/RaveSetup.h>
12
13//std
14#include <string>
15#include <vector>
16
17//rave
18#include <rave/Track.h>
19#include <rave/Vertex.h>
20
21//root
22#include <Math/Vector3D.h>
23
24namespace Belle2 {
29 class Particle;
30 class TrackFitResult;
31
32 namespace analysis {
40 typedef std::vector<int>::size_type VecSize;
41 public:
42
44 RaveVertexFitter(/*std::string howToInterfaceRave*/);
45
48
50 void addTrack(const Particle* const aParticlePtr);
51
53 void addTrack(const TrackFitResult* const aTrackPtr);
54
56 void addMother(const Particle* const aMotherParticlePtr);
57
60 int fit(std::string options = "default");
61
63 ROOT::Math::XYZVector getPos(VecSize vertexId = 0) const;
64
66 double getPValue(VecSize vertexId = 0) const;
67
69 double getNdf(VecSize vertexId = 0) const;
70
72 double getChi2(VecSize vertexId = 0) const;
73
75 TMatrixDSym getCov(VecSize vertexId = 0) const;
76
78 double getWeight(int trackId, VecSize vertexId = 0) const;
79
81 std::vector<int> getTrackIdsForOneVertex(VecSize vertexId = 0) const;
82
84 void useBeamSpot(bool beamSpot = true)
85 {
86 if (beamSpot == true) {
88 B2FATAL("Beam spot information cannot be used because the beam spot position and covariance was not set in RaveSetup");
89 }
90 m_useBeamSpot = true;
91 } else {
92 m_useBeamSpot = false;
93 }
94 }
95
98 {
99 m_raveTracks.clear();
100 }
101
102
104 void Print() const
105 {
106 B2INFO("useBeamSpot: " << m_useBeamSpot);
107 B2INFO("number of rave::Tracks: " << m_raveTracks.size());
108 B2INFO("number of fitted rave::Vertices: " << m_raveVertices.size());
109
110 }
111
112 int getNTracks() const
113 {
114 return m_raveTracks.size();
115 }
116
118 void updateDaughters();
119
120
121 protected:
122
123// /** The default constructor checks if RaveSetup was initialized and will set the attributes of RaveVertexFitter */
124// RaveVertexFitter();
126 void initBeamSpotMember();
128 void isVertexIdValid(const VecSize vertexId) const;
129
131 rave::Track TrackFitResultToRaveTrack(const TrackFitResult* const aTrackPtr) const;
133
134
135 //std::string m_raveAlgorithm;
136
138 std::vector<rave::Track> m_raveTracks;
139
141 std::vector < rave::Vertex > m_raveVertices;
142
144 std::vector<Particle*> m_belleDaughters;
145
146
147 };
148 }
149
151}
152
Class to store reconstructed particles.
Definition Particle.h:76
Values of the result of a track fit with a given particle hypothesis.
static RaveSetup * getRawInstance()
Same as getInstance(), but no check if the instance is initialised.
Definition RaveSetup.cc:29
std::vector< Particle * > m_belleDaughters
Belle Particle pointers input.
void useBeamSpot(bool beamSpot=true)
Overwrite the global option in ReveSetup that tells the fitter if beam spot info should be used or no...
TMatrixDSym getCov(VecSize vertexId=0) const
get the covariance matrix (3x3) of the of the fitted vertex position.
bool m_useBeamSpot
flag determines if the beam spot will be used or not.
int fit(std::string options="default")
do the vertex fit with all tracks previously added with the addTrack or addMother function.
std::vector< int >::size_type VecSize
I am using std::vector<int>::size_type because it is the official return value of ....
ROOT::Math::XYZVector getPos(VecSize vertexId=0) const
get the position of the fitted vertex.
void addTrack(const Particle *const aParticlePtr)
add a track (in the format of a Particle) to set of tracks that should be fitted to a vertex
std::vector< int > getTrackIdsForOneVertex(VecSize vertexId=0) const
get the ids of the tracks Rave associated with a specific vertex.
double getNdf(VecSize vertexId=0) const
get the number of degrees of freedom (NDF) of the fitted vertex.
rave::Track TrackFitResultToRaveTrack(const TrackFitResult *const aTrackPtr) const
converts a track from TrackFitResult format to rave::Track format
double getChi2(VecSize vertexId=0) const
get the χ² of the fitted vertex.
std::vector< rave::Vertex > m_raveVertices
holds the fitted vertices after fit() was called in the format used by Rave
void clearTracks()
Delete all information of previously added tracks and fitted results.
void isVertexIdValid(const VecSize vertexId) const
checks if the vertex the user requested via one of the getters it actually there
void initBeamSpotMember()
The default constructor checks if RaveSetup was initialized and will set the attributes of RaveVertex...
void updateDaughters()
update the Daughters particles
double getWeight(int trackId, VecSize vertexId=0) const
get the weight Rave assigned to a specific input track.
double getPValue(VecSize vertexId=0) const
get the p value of the fitted vertex.
void Print() const
Print all attributes of this object to terminal.
std::vector< rave::Track > m_raveTracks
holds the tracks that were added to a RaveVertexFitter object in the format used by Rave
void addMother(const Particle *const aMotherParticlePtr)
All daughters of the argument of this function will be used as input for the vertex fit.
int getNTracks() const
return the number of tracks that where added via addTrack or addMother
Abstract base class for different kinds of events.