Belle II Software light-2406-ragdoll
KalmanCalculator.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/VertexFitting/TreeFitter/EigenStackConfig.h>
12
13#include <analysis/VertexFitting/TreeFitter/FitParams.h>
14#include <analysis/VertexFitting/TreeFitter/ErrCode.h>
15
16// inverse() needs this, in the other classes we get away with just Eigen/Core
17#include <Eigen/Dense>
18
19
20namespace TreeFitter {
21
24 public:
25
28 int sizeRes,
29 int sizeState
30 );
31
33 void updateState(FitParams& fitparams);
34
36 void updateState(FitParams& fitparams, FitParams& oldState);
37
39 void updateCovariance(FitParams& fitparams);
40
42 double getChiSquare() const { return m_chisq;}
43
46 const Eigen::Matrix < double, -1, 1, 0, 7, 1 > & residuals,
47 const Eigen::Matrix < double, -1, -1, 0, 7, MAX_MATRIX_SIZE > & G,
48 const FitParams& fitparams,
49 const Eigen::Matrix < double, -1, -1, 0, 7, 7 > * V = 0,
50 double weight = 1);
51
53 double getConstraintDim() const { return m_constrDim; }
54
55 private:
58
60 double m_chisq;
61
74 Eigen::Matrix < double, -1, 1, 0, 7, 1 > m_res;
75
77 Eigen::Matrix < double, -1, -1, 0, 7, MAX_MATRIX_SIZE > m_G;
78
80 Eigen::Matrix < double, -1, -1, 0, 7, 7 > m_R;
81
83 Eigen::Matrix < double, -1, -1, 0, 7, 7 > m_Rinverse;
84
86 Eigen::Matrix < double, -1, -1, 0, MAX_MATRIX_SIZE, 7 > m_K;
87
89 Eigen::Matrix < double, -1, -1, 0, MAX_MATRIX_SIZE, 7 > m_CGt;
90
91 };
92}
abstract errorocode be aware that the default is success
Definition: ErrCode.h:14
Class to store and manage fitparams (statevector)
Definition: FitParams.h:20
does the calculation of the gain matrix, updates the cov and fitpars
void updateState(FitParams &fitparams)
update statevector
ErrCode calculateGainMatrix(const Eigen::Matrix< double, -1, 1, 0, 7, 1 > &residuals, const Eigen::Matrix< double, -1, -1, 0, 7, MAX_MATRIX_SIZE > &G, const FitParams &fitparams, const Eigen::Matrix< double, -1, -1, 0, 7, 7 > *V=0, double weight=1)
init the kalman machienery
Eigen::Matrix< double, -1, -1, 0, 7, 7 > m_Rinverse
R inverse.
double getConstraintDim() const
get dimension of the constraint
Eigen::Matrix< double, -1, -1, 0, 7, 7 > m_R
R residual covariance.
Eigen::Matrix< double, -1, -1, 0, 7, MAX_MATRIX_SIZE > m_G
G former H, transforms covraince of {residuals}<->{x,p,E}.
Eigen::Matrix< double, -1, 1, 0, 7, 1 > m_res
we know the max sizes of the matrices we assume the tree is smaller than MAX_MATRIX_SIZE parameters a...
void updateCovariance(FitParams &fitparams)
update the statevectors covariance
Eigen::Matrix< double, -1, -1, 0, MAX_MATRIX_SIZE, 7 > m_K
K kalman gain matrix.
double getChiSquare() const
get chi2 of this iteration
int m_constrDim
dimension of the constraint
Eigen::Matrix< double, -1, -1, 0, MAX_MATRIX_SIZE, 7 > m_CGt
C times G^t