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>
15 namespace TreeFitter {
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 origin: rc =
"origin";
break;
131 case composite: rc =
"composite";
break;
132 case resonance: rc =
"resonance";
break;
133 case track: rc =
"track";
break;
134 case photon: rc =
"photon";
break;
135 case klong: rc =
"klong";
break;
136 case kinematic: rc =
"kinematic";
break;
137 case geometric: rc =
"geometric";
break;
138 case mass: rc =
"mass";
break;
139 case massEnergy: rc =
"massEnergy";
break;
140 case lifetime: rc =
"lifetime";
break;
141 case merged: rc =
"merged";
break;
142 case conversion: rc =
"conversion";
break;
143 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)
void addChiSquare(double chisq, int nconstraints)
increment global chi2
Eigen::Matrix< double, -1, 1, 0, MAX_MATRIX_SIZE, 1 > & getStateVector()
getter for the fit parameters/statevector
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
void updateCovariance(FitParams &fitparams)
update the statevectors covariance
double getChiSquare()
get chi2 of this iteration
double getConstraintDim()
get dimension of the constraint
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...