Belle II Software development
FitManager.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * External Contributor: Wouter Hulsbergen *
5 * *
6 * See git log for contributors and copyright holders. *
7 * This file is licensed under LGPL-3.0, see LICENSE.md. *
8 **************************************************************************/
9#pragma once
10
11#include <analysis/dataobjects/Particle.h>
12#include <analysis/VertexFitting/TreeFitter/ErrCode.h>
13#include <analysis/VertexFitting/TreeFitter/ConstraintConfiguration.h>
14
15namespace TreeFitter {
16 class DecayChain;
17 class FitParams;
18 class ParticleBase;
19 class ConstraintConfiguration;
20
22 class FitManager {
23 public:
24
26 enum VertexStatus { Success = 0, NonConverged, BadInput, Failed, UnFitted };
27
30 m_chiSquare(-1), m_prec(0.01), m_updateDaugthers(false), m_ndf(0),
32 {}
33
36 const ConstraintConfiguration& config,
37 double prec = 0.01,
38 bool updateDaughters = false
39 );
40
42 FitManager(const FitManager& other) = delete;
43
45 FitManager& operator=(const FitManager& other) = delete;
46
49
51 bool fit();
52
54 bool updateCand(Belle2::Particle& particle, const bool isTreeHead) const;
55
57 void updateCand(const ParticleBase& pb, Belle2::Particle& cand, const bool isTreeHead) const;
58
60 void updateTree(Belle2::Particle& particle, const bool isTreeHead) const;
61
63 void getCovFromPB(const ParticleBase* pb, TMatrixFSym& returncov) const;
64
66 std::tuple<double, double> getLifeTime(Belle2::Particle& cand) const;
67
69 std::tuple<double, double> getDecayLength(const ParticleBase* pb) const;
70
72 std::tuple<double, double> getDecayLength(const ParticleBase* pb, const FitParams& fitparams) const;
73
75 std::tuple<double, double> getDecayLength(Belle2::Particle& cand) const;
76
79
80 private:
83
86
89
92
94 double m_prec;
95
98
101
103 int m_ndf;
104
107
110 };
111}
Class to store reconstructed particles.
Definition: Particle.h:76
constraint configuration class
this class does a lot of stuff: Build decaytree structure allowing to index particles and handle the ...
Definition: DecayChain.h:23
abstract errorocode be aware that the default is success
Definition: ErrCode.h:14
const ConstraintConfiguration m_config
config container
Definition: FitManager.h:109
DecayChain * m_decaychain
the decay tree
Definition: FitManager.h:85
FitManager()
constructor
Definition: FitManager.h:29
FitManager & operator=(const FitManager &other)=delete
use default assignment op
Belle2::Particle * particle()
getter for the head of the tree
Definition: FitManager.h:78
ErrCode m_errCode
errorcode
Definition: FitManager.h:97
void getCovFromPB(const ParticleBase *pb, TMatrixFSym &returncov) const
extract cov from particle base
Definition: FitManager.cc:125
void updateTree(Belle2::Particle &particle, const bool isTreeHead) const
update the Belle2::Particles with the fit results
Definition: FitManager.cc:281
FitParams * m_fitparams
parameters to be fitted
Definition: FitManager.h:106
const bool m_updateDaugthers
if this is set all daughters will be updated otherwise only the head of the tree
Definition: FitManager.h:100
~FitManager()
destructor does stuff
Definition: FitManager.cc:43
int m_ndf
number of degrees of freedom for this topology
Definition: FitManager.h:103
double m_prec
precision that is needed for status:converged (delta chi2)
Definition: FitManager.h:94
bool fit()
main fit function that uses the kalman filter
Definition: FitManager.cc:49
int m_status
status of the current iteration
Definition: FitManager.h:88
FitManager(const FitManager &other)=delete
use default copy constructor
Belle2::Particle * m_particle
head of the tree
Definition: FitManager.h:82
double m_chiSquare
chi2 of the current iteration
Definition: FitManager.h:91
VertexStatus
status flag of the fit-itereation (the step in the newton method)
Definition: FitManager.h:26
std::tuple< double, double > getLifeTime(Belle2::Particle &cand) const
get lifetime
Definition: FitManager.cc:295
std::tuple< double, double > getDecayLength(const ParticleBase *pb) const
get decay length
Definition: FitManager.cc:341
bool updateCand(Belle2::Particle &particle, const bool isTreeHead) const
update particles parameters with the fit results
Definition: FitManager.cc:192
Class to store and manage fitparams (statevector)
Definition: FitParams.h:20
base class for all particles
Definition: ParticleBase.h:25