Belle II Software light-2406-ragdoll
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/dataobjects/Particle.h>
12#include <analysis/VertexFitting/RaveInterface/RaveSetup.h>
13
14//std
15#include <string>
16#include <iostream>
17
18//rave
19#include <rave/Track.h>
20#include <rave/Vertex.h>
21
22
23namespace Belle2 {
28 class TrackFitResult;
29
30 namespace analysis {
38 typedef std::vector<int>::size_type VecSize;
39 public:
40
42 RaveVertexFitter(/*std::string howToInterfaceRave*/);
43
46
48 void addTrack(const Particle* const aParticlePtr);
49
51 void addTrack(const TrackFitResult* const aTrackPtr);
52
54 void addMother(const Particle* const aMotherParticlePtr);
55
58 int fit(std::string options = "default");
59
61 B2Vector3D getPos(VecSize vertexId = 0) const;
62
64 double getPValue(VecSize vertexId = 0) const;
65
67 double getNdf(VecSize vertexId = 0) const;
68
70 double getChi2(VecSize vertexId = 0) const;
71
73 TMatrixDSym getCov(VecSize vertexId = 0) const;
74
76 double getWeight(int trackId, VecSize vertexId = 0) const;
77
79 std::vector<int> getTrackIdsForOneVertex(VecSize vertexId = 0) const;
80
82 void useBeamSpot(bool beamSpot = true)
83 {
84 if (beamSpot == true) {
86 B2FATAL("Beam spot information cannot be used because the beam spot position and covariance was not set in RaveSetup");
87 }
88 m_useBeamSpot = true;
89 } else {
90 m_useBeamSpot = false;
91 }
92 }
93
96 {
97 m_raveTracks.clear();
98 }
99
100
102 void Print() const
103 {
104 B2INFO("useBeamSpot: " << m_useBeamSpot);
105 B2INFO("number of rave::Tracks: " << m_raveTracks.size());
106 B2INFO("number of fitted rave::Vertices: " << m_raveVertices.size());
107
108 }
110 int getNTracks() const
111 {
112 return m_raveTracks.size();
113 }
114
116 void updateDaughters();
117
118
119 protected:
120
121// /** The default constructor checks if RaveSetup was initialized and will set the attributes of RaveVertexFitter */
122// RaveVertexFitter();
124 void initBeamSpotMember();
126 void isVertexIdValid(const VecSize vertexId) const;
127
129 rave::Track TrackFitResultToRaveTrack(const TrackFitResult* const aTrackPtr) const;
133 //std::string m_raveAlgorithm;
134
136 std::vector<rave::Track> m_raveTracks;
137
139 std::vector < rave::Vertex > m_raveVertices;
140
142 std::vector<Particle*> m_belleDaughters;
143
144
145 };
146 }
147
149}
150
Class to store reconstructed particles.
Definition: Particle.h:75
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:27
The RaveVertexFitter class is part of the RaveInterface together with RaveSetup.
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 ....
void addTrack(const Particle *const aParticlePtr)
add a track (in the format of a Belle2::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 Belle2::TrackFitResult format to rave::Track format
double getChi2(VecSize vertexId=0) const
get the χ² of the fitted vertex.
B2Vector3D getPos(VecSize vertexId=0) const
get the position 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()
Initialize m_useBeamSpot.
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.
Definition: ClusterUtils.h:24