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

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

#include <RaveKinematicVertexFitter.h>

Collaboration diagram for RaveKinematicVertexFitter:

Public Member Functions

 RaveKinematicVertexFitter ()
 The default constructor checks if RaveSetup was initialized and will set the attributes of RaveKinematicVertexFitter.
 
 ~RaveKinematicVertexFitter ()
 Destructor.
 
void addTrack (const Particle *aParticlePtr)
 add a track (in the format of a Belle2::Particle) to set of tracks that should be fitted to a vertex
 
void addMother (const Particle *aMotherParticlePtr)
 All daughters of the argument of this function will be used as input for the vertex fit. More...
 
void setMother (const Particle *aMotherParticlePtr)
 Set Mother particle for Vertex/momentum update. More...
 
int fit ()
 do the kinematic vertex fit with all tracks previously added with the addTrack or addMother function. More...
 
ROOT::Math::XYZVector getPos ()
 get the position of the fitted vertex. More...
 
double getPValue ()
 get the p value of the fitted vertex. More...
 
double getNdf ()
 get the number of degrees of freedom (NDF) of the fitted vertex. More...
 
double getChi2 ()
 get the χ² of the fitted vertex.
 
TMatrixDSym getCov ()
 get the covariance matrix (7x7). More...
 
TMatrixDSym getVertexErrorMatrix ()
 get the covariance matrix (3x3) of the of the fitted vertex position. 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...
 
ParticlegetMother ()
 returns a pointer to the mother particle
 
void updateMother ()
 update the mother particle
 
void updateDaughters ()
 update the Daughters particles
 
void clearTracks ()
 Delete all information of previously added tracks and fitted results.
 
void setMassConstFit (bool isConstFit=true)
 Set mass constrained fit

 
void setVertFit (bool isVertFit=true)
 Set vertex fit: set false in case of mass fit only.
 
void Print () const
 Print all attributes of this object to terminal.
 

Protected Attributes

bool m_useBeamSpot
 flag determines if the beam spot will be used or not. More...
 
Particlem_motherParticlePtr
 pointer to the mother particle who's daughters will be used in the fit. More...
 
std::string m_raveAlgorithm
 Algorithm used by rave (kalman, avr, ...)
 
rave::KinematicTree m_fittedResult
 the output of the kinematic fit
 
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< rave::KinematicParticle > m_inputParticles
 input particles for vertex fit in rave format
 
rave::KinematicParticle m_fittedParticle
 Particle fit output.
 
std::vector< Particle * > m_belleDaughters
 Belle Particle pointers input.
 
bool m_massConstFit
 flag determines if the mass fit is performed
 
bool m_vertFit
 flag determines if the vertex fit is performed
 
double m_fittedNdf
 Ndf of the vertex fit.
 
double m_fittedPValue
 Pvalue of the fit result.
 
double m_fittedChi2
 chi^2 of the vertex fit
 
ROOT::Math::XYZVector m_fittedPos
 Fitted vertex position.
 
ROOT::Math::PxPyPzEVector m_fitted4Vector
 4 momentum of the mother particle after the fit
 
TMatrixFSym m_fitted7Cov
 7x7 error matrix of the mother particle after the fit
 

Private Member Functions

TMatrixDSym ErrorMatrixMassToEnergy (const ROOT::Math::PxPyPzEVector &p4, const TMatrixDSym &MassErr)
 Convert the error matrix from P-M to P-E. More...
 
TMatrixDSym ErrorMatrixEnergyToMass (const ROOT::Math::PxPyPzEVector &p4, const TMatrixDSym &EnergyErr)
 Convert the error matrix from P-E to P-M. More...
 
IOIntercept::InterceptorScopeGuard< IOIntercept::OutputToLogMessagescaptureOutput ()
 Start capturing the output of rave and divert it to log messages. More...
 

Detailed Description

The RaveKinematicVertexFitter 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. RaveKinematicVertexFitter provides the getters to extract the results produced by Rave.

Definition at line 44 of file RaveKinematicVertexFitter.h.

Member Function Documentation

◆ addMother()

void addMother ( const Particle aMotherParticlePtr)

All daughters of the argument of this function will be used as input for the vertex fit.

Writes back the result directly to the mother particle

Definition at line 105 of file RaveKinematicVertexFitter.cc.

106 {
107  vector<Particle*> daughters = aMotherParticlePtr->getDaughters();
108 
109  int nDaughters = daughters.size();
110  for (int i = 0; i not_eq nDaughters; ++i) {
111  addTrack(daughters[i]);
112  }
113 
114  //store input pointer so fit results can be written to the mother particle after the fit
115  auto* tmp = const_cast<Particle*>(aMotherParticlePtr);
116  m_motherParticlePtr = tmp;
117 
118 }
Class to store reconstructed particles.
Definition: Particle.h:75
std::vector< Belle2::Particle * > getDaughters() const
Returns a vector of pointers to daughter particles.
Definition: Particle.cc:641
void addTrack(const Particle *aParticlePtr)
add a track (in the format of a Belle2::Particle) to set of tracks that should be fitted to a vertex
Particle * m_motherParticlePtr
pointer to the mother particle who's daughters will be used in the fit.

◆ captureOutput()

Start capturing the output of rave and divert it to log messages.

Capturing will finish as soon as the returned object goes out of scope

Definition at line 46 of file RaveKinematicVertexFitter.cc.

◆ ErrorMatrixEnergyToMass()

TMatrixDSym ErrorMatrixEnergyToMass ( const ROOT::Math::PxPyPzEVector &  p4,
const TMatrixDSym &  EnergyErr 
)
private

Convert the error matrix from P-E to P-M.

It Requires an input error matrix in the form X,P,E

Definition at line 483 of file RaveKinematicVertexFitter.cc.

◆ ErrorMatrixMassToEnergy()

TMatrixDSym ErrorMatrixMassToEnergy ( const ROOT::Math::PxPyPzEVector &  p4,
const TMatrixDSym &  MassErr 
)
private

Convert the error matrix from P-M to P-E.

It Requires an input error matrix in the form X,P,M

Definition at line 453 of file RaveKinematicVertexFitter.cc.

◆ fit()

int fit ( )

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

The return value is 1 if a vertex is successfully found. Return value 0 means the fit was not successful. -1 means not enough tracks were added

Definition at line 129 of file RaveKinematicVertexFitter.cc.

◆ getCov()

TMatrixDSym getCov ( )

get the covariance matrix (7x7).


Definition at line 431 of file RaveKinematicVertexFitter.cc.

◆ getNdf()

double getNdf ( )

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


Definition at line 421 of file RaveKinematicVertexFitter.cc.

◆ getPos()

ROOT::Math::XYZVector getPos ( )

get the position of the fitted vertex.


Definition at line 411 of file RaveKinematicVertexFitter.cc.

◆ getPValue()

double getPValue ( )

get the p value of the fitted vertex.


Definition at line 416 of file RaveKinematicVertexFitter.cc.

◆ getVertexErrorMatrix()

TMatrixDSym getVertexErrorMatrix ( )

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


Definition at line 436 of file RaveKinematicVertexFitter.cc.

◆ setMother()

void setMother ( const Particle aMotherParticlePtr)

Set Mother particle for Vertex/momentum update.

Not to be used with addMother

Definition at line 121 of file RaveKinematicVertexFitter.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 85 of file RaveKinematicVertexFitter.h.

86  {
87  if (beamSpot == true) {
88  if (RaveSetup::getRawInstance()->m_useBeamSpot == false) {
89  B2FATAL("Beam spot information cannot be used because the beam spot position and covariance was not set in RaveSetup");
90  }
91  m_useBeamSpot = true;
92  } else {
93  m_useBeamSpot = false;
94  }
95  }
bool m_useBeamSpot
flag determines if the beam spot will be used or not.
static RaveSetup * getRawInstance()
Same as getInstance(), but no check if the instance is initialised.
Definition: RaveSetup.cc:27

Member Data Documentation

◆ m_motherParticlePtr

Particle* m_motherParticlePtr
protected

pointer to the mother particle who's daughters will be used in the fit.

the fit result will be written back to the mother particle

Definition at line 135 of file RaveKinematicVertexFitter.h.

◆ 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 132 of file RaveKinematicVertexFitter.h.


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