10#include <analysis/VertexFitting/TreeFitter/FitParams.h>
11#include <analysis/VertexFitting/TreeFitter/ParticleBase.h>
12#include <analysis/VertexFitting/TreeFitter/Constraint.h>
13#include <analysis/VertexFitting/TreeFitter/KalmanCalculator.h>
40 bool finished(
false) ;
42 double accumulated_chi2 = 0;
43 while (!finished && !status.failure()) {
48 if (!status.failure()) {
58 if (!status.failure()) {
64 double dchisqconverged = 0.001 ;
66 double dchisq = newchisq - chisq;
67 bool diverging = iter > 0 && dchisq > 0;
68 bool converged = std::abs(dchisq) < dchisqconverged;
69 finished = ++iter >=
m_maxNIter || diverging || converged;
71 accumulated_chi2 += newchisq;
77 fitpar.
addChiSquare(accumulated_chi2, number_of_constraints);
103 if (!status.failure()) {
112 if (!status.failure()) {
126 std::string rc =
"unknown constraint!";
128 case beamspot: rc =
"beamspot";
break;
129 case beamenergy: rc =
"beamenergy";
break;
130 case beam: rc =
"beam";
break;
131 case origin: rc =
"origin";
break;
132 case composite: rc =
"composite";
break;
133 case resonance: rc =
"resonance";
break;
134 case track: rc =
"track";
break;
135 case photon: rc =
"photon";
break;
136 case klong: rc =
"klong";
break;
137 case kinematic: rc =
"kinematic";
break;
138 case geometric: rc =
"geometric";
break;
139 case mass: rc =
"mass";
break;
140 case massEnergy: rc =
"massEnergy";
break;
141 case lifetime: rc =
"lifetime";
break;
142 case merged: rc =
"merged";
break;
143 case conversion: rc =
"conversion";
break;
144 case helix: rc =
"helix";
break;
class to manage the order of constraints and their filtering
Type m_type
type of constraint
std::string name() const
get name of constraint
int m_depth
chi2 coming from the constraint
unsigned int m_dim
dimension of constraint
int m_maxNIter
maximum number of iterations for non-linear constraints
virtual ErrCode filterWithReference(FitParams &fitpar, const FitParams &oldState)
filter this constraint
bool operator<(const Constraint &rhs) const
operator used to sort the constraints
const ParticleBase * m_node
particle behind the constraint
virtual ErrCode filter(FitParams &fitpar)
filter this constraint
virtual ErrCode project(const FitParams &fitpar, Projection &p) const
call the constraints projection function
abstract errorocode be aware that the default is success
Class to store and manage fitparams (statevector)
Eigen::Matrix< double, -1, 1, 0, MAX_MATRIX_SIZE, 1 > & getStateVector()
getter for the fit parameters/statevector
void addChiSquare(double chisq, int nconstraints)
increment global chi2
int getDimensionOfState() const
get the states dimension
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
double getConstraintDim() const
get dimension of the constraint
void updateCovariance(FitParams &fitparams)
update the statevectors covariance
double getChiSquare() const
get chi2 of this iteration
virtual ErrCode projectConstraint(Constraint::Type, const FitParams &, Projection &) const
project constraint.
class to store the projected residuals and the corresponding jacobian as well as the covariance matri...