Belle II Software light-2406-ragdoll
RaveKinematicVertexFitter.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#include <mdst/dataobjects/TrackFitResult.h>
15//std
16#include <string>
17
18//root
19#include <TMatrixFSym.h>
20#include <Math/Vector3D.h>
21#include <Math/Vector4D.h>
22//rave
23#include <rave/Vertex.h>
24#include <rave/Track.h>
25#include <rave/KinematicTree.h>
26
27// for intercepting rave output
28#include <framework/utilities/IOIntercept.h>
29
30#include <iostream>
31
32namespace Belle2 {
38 namespace analysis {
45 public:
48
49 //RaveKinematicVertexFitter(std::string howToInterfaceRave);
52
54 void addTrack(const Particle* aParticlePtr);
55
57 void addMother(const Particle* aMotherParticlePtr);
58
60 void setMother(const Particle* aMotherParticlePtr);
61
64 int fit();
65
67 ROOT::Math::XYZVector getPos() ;
68
70 double getPValue();
71
73 double getNdf();
74
76 double getChi2() ;
77
79 TMatrixDSym getCov();
80
82 TMatrixDSym getVertexErrorMatrix();
83
85 void useBeamSpot(bool beamSpot = true)
86 {
87 if (beamSpot == true) {
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 }
96
99
101 void updateMother();
102
104 void updateDaughters();
105
108 {
109 m_inputParticles.clear();
110 m_motherParticlePtr = nullptr;
111 }
112
114 void setMassConstFit(bool isConstFit = true);
115
117 void setVertFit(bool isVertFit = true);
118
120 void Print() const
121 {
122 B2INFO("useBeamSpot: " << m_useBeamSpot);
123 B2INFO("number of rave::Tracks: " << m_inputParticles.size());
124 }
125
126
127
128
129 protected:
130
133
136
138 std::string m_raveAlgorithm;
139
141 rave::KinematicTree m_fittedResult;
142
144 std::vector<rave::Track> m_raveTracks;
145
147 std::vector < rave::Vertex > m_raveVertices;
148
150 std::vector< rave::KinematicParticle > m_inputParticles;
152 rave::KinematicParticle m_fittedParticle;
153
155 std::vector<Particle*> m_belleDaughters;
156
168 ROOT::Math::XYZVector m_fittedPos;
170 ROOT::Math::PxPyPzEVector m_fitted4Vector;
172 TMatrixFSym m_fitted7Cov;
173
174
175 private:
176
178 TMatrixDSym ErrorMatrixMassToEnergy(const ROOT::Math::PxPyPzEVector& p4, const TMatrixDSym& MassErr);
179
181 TMatrixDSym ErrorMatrixEnergyToMass(const ROOT::Math::PxPyPzEVector& p4, const TMatrixDSym& EnergyErr);
182
187 };
188 }
189
191}
192
Simple RAII guard for output interceptor.
Definition: IOIntercept.h:301
Class to store reconstructed particles.
Definition: Particle.h:75
The RaveKinematicVertexFitter 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...
std::string m_raveAlgorithm
Algorithm used by rave (kalman, avr, ...)
TMatrixDSym ErrorMatrixEnergyToMass(const ROOT::Math::PxPyPzEVector &p4, const TMatrixDSym &EnergyErr)
Convert the error matrix from P-E to P-M.
IOIntercept::InterceptorScopeGuard< IOIntercept::OutputToLogMessages > captureOutput()
Start capturing the output of rave and divert it to log messages.
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
TMatrixDSym getCov()
get the covariance matrix (7x7).
rave::KinematicParticle m_fittedParticle
Particle fit output.
bool m_useBeamSpot
flag determines if the beam spot will be used or not.
void addMother(const Particle *aMotherParticlePtr)
All daughters of the argument of this function will be used as input for the vertex fit.
ROOT::Math::XYZVector getPos()
get the position of the fitted vertex.
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
bool m_massConstFit
flag determines if the mass fit is performed
TMatrixDSym ErrorMatrixMassToEnergy(const ROOT::Math::PxPyPzEVector &p4, const TMatrixDSym &MassErr)
Convert the error matrix from P-M to P-E.
void setMother(const Particle *aMotherParticlePtr)
Set Mother particle for Vertex/momentum update.
RaveKinematicVertexFitter()
The default constructor checks if RaveSetup was initialized and will set the attributes of RaveKinema...
rave::KinematicTree m_fittedResult
the output of the kinematic fit
int fit()
do the kinematic vertex fit with all tracks previously added with the addTrack or addMother function.
Particle * m_motherParticlePtr
pointer to the mother particle who's daughters will be used in the fit.
void setVertFit(bool isVertFit=true)
Set vertex fit: set false in case of mass fit only.
std::vector< rave::Vertex > m_raveVertices
holds the fitted vertices after fit() was called in the format used by Rave
void setMassConstFit(bool isConstFit=true)
Set mass constrained fit
Particle * getMother()
returns a pointer to the mother particle
void clearTracks()
Delete all information of previously added tracks and fitted results.
double getPValue()
get the p value of the fitted vertex.
TMatrixDSym getVertexErrorMatrix()
get the covariance matrix (3x3) of the of the fitted vertex position.
double getChi2()
get the χ² of the fitted vertex.
std::vector< rave::KinematicParticle > m_inputParticles
input particles for vertex fit in rave format
double getNdf()
get the number of degrees of freedom (NDF) of the fitted vertex.
bool m_vertFit
flag determines if the vertex fit is performed
void updateDaughters()
update the Daughters particles
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
ROOT::Math::XYZVector m_fittedPos
Fitted vertex position.
static RaveSetup * getRawInstance()
Same as getInstance(), but no check if the instance is initialised.
Definition: RaveSetup.cc:27
Abstract base class for different kinds of events.
Definition: ClusterUtils.h:24