Belle II Software  release-08-01-10
RaveVertexFitter Class Reference

The RaveVertexFitter class is part of the RaveInterface together with RaveSetup. More...

#include <RaveVertexFitter.h>

Collaboration diagram for RaveVertexFitter:

Public Member Functions

 RaveVertexFitter ()
 The constructor.
 
 ~RaveVertexFitter ()
 Destructor.
 
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
 
void addTrack (const TrackFitResult *const aTrackPtr)
 add a track (in the format of a pointer to a Belle2::TrackFitResult) to set of tracks that should be fitted to a vertex
 
void addMother (const Particle *const aMotherParticlePtr)
 All daughters of the argument of this function will be used as input for the vertex fit.
 
int fit (std::string options="default")
 do the vertex fit with all tracks previously added with the addTrack or addMother function. More...
 
B2Vector3D getPos (VecSize vertexId=0) const
 get the position of the fitted vertex. More...
 
double getPValue (VecSize vertexId=0) const
 get the p value of the fitted vertex. More...
 
double getNdf (VecSize vertexId=0) const
 get the number of degrees of freedom (NDF) of the fitted vertex. More...
 
double getChi2 (VecSize vertexId=0) const
 get the χ² of the fitted vertex. More...
 
TMatrixDSym getCov (VecSize vertexId=0) const
 get the covariance matrix (3x3) of the of the fitted vertex position. More...
 
double getWeight (int trackId, VecSize vertexId=0) const
 get the weight Rave assigned to a specific input track. More...
 
std::vector< int > getTrackIdsForOneVertex (VecSize vertexId=0) const
 get the ids of the tracks Rave associated with a specific vertex. More...
 
void useBeamSpot (bool beamSpot=true)
 Overwrite the global option in ReveSetup that tells the fitter if beam spot info should be used or not. More...
 
void clearTracks ()
 Delete all information of previously added tracks and fitted results.
 
void Print () const
 Print all attributes of this object to terminal.
 
int getNTracks () const
 return the number of tracks that where added via addTrack or addMother
 
void updateDaughters ()
 update the Daughters particles
 

Protected Member Functions

void initBeamSpotMember ()
 Initialize m_useBeamSpot. More...
 
void isVertexIdValid (const VecSize vertexId) const
 checks if the vertex the user requested via one of the getters it actually there
 
rave::Track TrackFitResultToRaveTrack (const TrackFitResult *const aTrackPtr) const
 converts a track from Belle2::TrackFitResult format to rave::Track format
 

Protected Attributes

bool m_useBeamSpot
 flag determines if the beam spot will be used or not. More...
 
std::vector< rave::Track > m_raveTracks
 holds the tracks that were added to a RaveVertexFitter object in the format used by Rave
 
std::vector< rave::Vertex > m_raveVertices
 holds the fitted vertices after fit() was called in the format used by Rave
 
std::vector< Particle * > m_belleDaughters
 Belle Particle pointers input.
 

Private Types

typedef std::vector< int >::size_type VecSize
 I am using std::vector<int>::size_type because it is the official return value of .size() although on normal machines a ::size_type is just an unsigned int anyway. More...
 

Detailed Description

The RaveVertexFitter class is part of the RaveInterface together with RaveSetup.

To fit a vertex the user adds tracks (different formats are supported). Then calls the fit() function where the name of the fitting method and parameters can be passed as a string. RaveVertexFitter provides the getters to extract the results produced by Rave.

Definition at line 36 of file RaveVertexFitter.h.

Member Typedef Documentation

◆ VecSize

typedef std::vector<int>::size_type VecSize
private

I am using std::vector<int>::size_type because it is the official return value of .size() although on normal machines a ::size_type is just an unsigned int anyway.

Because std::vector<int>::size_type is so long it is shortened to VecSize

Definition at line 38 of file RaveVertexFitter.h.

Member Function Documentation

◆ fit()

int fit ( std::string  options = "default")

do the vertex fit with all tracks previously added with the addTrack or addMother function.

The argument is a string determining the Rave fitting method. See https://rave.hepforge.org/trac/wiki/RaveMethods for the different methods The return value is the number of successfully found vertices (depending on the selected algorithm this can be more then one vertex). Return value 0 means the fit was not successful. -1 means not enough tracks were added

Definition at line 121 of file RaveVertexFitter.cc.

122 {
123  //B2WARNING("RaveVertexFitter::fit(string options)" );
124  //B2WARNING("m_useBeamSpot " << m_useBeamSpot );
125  if (options == "default") {
126  options = "kalman";
127  }
128  int ndf = 0;
129 
130  ndf = 2 * m_raveTracks.size();
131 
132  if (m_useBeamSpot == true) {
133  ndf += 3;
134  }
135  if (ndf < 4) {
136  return -1;
137  }
138  int nOfVertices = -100;
139 
140  if (m_useBeamSpot == true) {
142  const TMatrixDSym& bsCov = RaveSetup::getRawInstance()->m_beamSpotCov;
143  const rave::Covariance3D bsCovRave(bsCov(0, 0), bsCov(0, 1), bsCov(0, 2), bsCov(1, 1), bsCov(1, 2), bsCov(2, 2));
144  RaveSetup::getRawInstance()->m_raveVertexFactory->setBeamSpot(rave::Ellipsoid3D(rave::Point3D(bsPos.X(), bsPos.Y(), bsPos.Z()),
145  bsCovRave));
146  }
147  //B2WARNING( "now fitting with m_raveVertexFactory" );
148  RaveSetup::getRawInstance()->m_raveVertexFactory->setDefaultMethod(options);
150  nOfVertices = m_raveVertices.size();
151 
152  return nOfVertices;
153 }
DataType Z() const
access variable Z (= .at(2) without boundary check)
Definition: B2Vector3.h:435
DataType X() const
access variable X (= .at(0) without boundary check)
Definition: B2Vector3.h:431
DataType Y() const
access variable Y (= .at(1) without boundary check)
Definition: B2Vector3.h:433
TMatrixDSym m_beamSpotCov
beam spot position covariance matrix.
Definition: RaveSetup.h:74
static RaveSetup * getRawInstance()
Same as getInstance(), but no check if the instance is initialised.
Definition: RaveSetup.cc:27
B2Vector3D 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
bool m_useBeamSpot
flag determines if the beam spot will be used or not.
std::vector< rave::Vertex > m_raveVertices
holds the fitted vertices after fit() was called in the format used by Rave
std::vector< rave::Track > m_raveTracks
holds the tracks that were added to a RaveVertexFitter object in the format used by Rave
HepGeom::Point3D< double > Point3D
3D point
Definition: Cell.h:32

◆ getChi2()

double getChi2 ( VecSize  vertexId = 0) const

get the χ² of the fitted vertex.

If Rave was also used to find different vertices the user has to provide the index of that vertex

Definition at line 222 of file RaveVertexFitter.cc.

◆ getCov()

TMatrixDSym getCov ( VecSize  vertexId = 0) const

get the covariance matrix (3x3) of the of the fitted vertex position.

If Rave was also used to find different vertices the user has to provide the index of that vertex

Definition at line 230 of file RaveVertexFitter.cc.

◆ getNdf()

double getNdf ( VecSize  vertexId = 0) const

get the number of degrees of freedom (NDF) of the fitted vertex.

If Rave was also used to find different vertices the user has to provide the index of that vertex

Definition at line 214 of file RaveVertexFitter.cc.

◆ getPos()

B2Vector3D getPos ( VecSize  vertexId = 0) const

get the position of the fitted vertex.

If Rave was also used to find different vertices the user has to provide the index of that vertex

Definition at line 169 of file RaveVertexFitter.cc.

◆ getPValue()

double getPValue ( VecSize  vertexId = 0) const

get the p value of the fitted vertex.

If Rave was also used to find different vertices the user has to provide the index of that vertex

Definition at line 206 of file RaveVertexFitter.cc.

◆ getTrackIdsForOneVertex()

std::vector< int > getTrackIdsForOneVertex ( VecSize  vertexId = 0) const

get the ids of the tracks Rave associated with a specific vertex.

The trackId is determined by the order of the addTrack calls. So the first track added with addTrack has trackId = 0, the next has 1 etc

Definition at line 194 of file RaveVertexFitter.cc.

◆ getWeight()

double getWeight ( int  trackId,
VecSize  vertexId = 0 
) const

get the weight Rave assigned to a specific input track.

The trackId is determined by the order of the addTrack calls. So the first track added with addTrack has trackId = 0, the next has 1 etc

Definition at line 178 of file RaveVertexFitter.cc.

◆ initBeamSpotMember()

void initBeamSpotMember ( )
protected

Initialize m_useBeamSpot.

Called by constructor

Definition at line 41 of file RaveVertexFitter.cc.

◆ useBeamSpot()

void useBeamSpot ( bool  beamSpot = true)
inline

Overwrite the global option in ReveSetup that tells the fitter if beam spot info should be used or not.

The beam spot pos and cov must still be set in the RaveSetup class if you what to use it

Definition at line 82 of file RaveVertexFitter.h.

83  {
84  if (beamSpot == true) {
85  if (RaveSetup::getRawInstance()->m_useBeamSpot == false) {
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  }

Member Data Documentation

◆ m_useBeamSpot

bool m_useBeamSpot
protected

flag determines if the beam spot will be used or not.

Overwrites the global flag in RaveSetup

Definition at line 130 of file RaveVertexFitter.h.


The documentation for this class was generated from the following files: