Belle II Software development
KarimakisMethod Class Reference

Class implementing the Karimaki fit for two dimensional trajectory circle. More...

#include <KarimakisMethod.h>

Inheritance diagram for KarimakisMethod:
CDCFitter2D< KarimakisMethod > CDCKarimakiFitter

Public Member Functions

 KarimakisMethod ()
 Constructor setting the default constraints.
 
void update (CDCTrajectory2D &trajectory2D, CDCObservations2D &observations2D) const
 Executes the fit and updates the trajectory parameters. This may render the information in the observation object.
 
bool isLineConstrained () const
 Getter for the indictor that lines should be fitted by this fitter.
 
void setLineConstrained (bool constrained=true)
 Indicator if this fitter is setup to fit lines.
 

Private Member Functions

UncertainPerigeeCircle fitInternal (CDCObservations2D &observations2D) const
 Internal method doing the heavy work.
 

Private Attributes

bool m_lineConstrained
 Memory for the flag indicating that lines should be fitted.
 

Detailed Description

Class implementing the Karimaki fit for two dimensional trajectory circle.

Definition at line 21 of file KarimakisMethod.h.

Constructor & Destructor Documentation

◆ KarimakisMethod()

Constructor setting the default constraints.

Definition at line 24 of file KarimakisMethod.cc.

25 : m_lineConstrained(false)
26{
27}
bool m_lineConstrained
Memory for the flag indicating that lines should be fitted.

Member Function Documentation

◆ fitInternal()

UncertainPerigeeCircle fitInternal ( CDCObservations2D observations2D) const
private

Internal method doing the heavy work.

Definition at line 214 of file KarimakisMethod.cc.

215{
216 // Matrix of weighted sums
217 Eigen::Matrix< double, 4, 4> sNoL = getWXYRSumMatrix(observations2D);
218
219 // Matrix of averages
220 Eigen::Matrix<double, 4, 4> aNoL = sNoL / sNoL(iW);
221
222 // Measurement means
223 Eigen::Matrix<double, 4, 1> meansNoL = aNoL.row(iW);
224
225 // Covariance matrix
226 Eigen::Matrix<double, 4, 4> cNoL = aNoL - meansNoL * meansNoL.transpose();
227
228 // Determine NDF : Circle fit eats up to 3 degrees of freedom debpending on the constraints
229 size_t ndf = observations2D.size() - 2;
230
231 if (not isLineConstrained()) {
232 --ndf;
233 }
234
235 // Parameters to be fitted
236 UncertainPerigeeCircle resultCircle = fitKarimaki(sNoL(iW), meansNoL, cNoL, isLineConstrained());
237 double chi2 = calcChi2Karimaki(resultCircle, sNoL(iW), cNoL);
238
239 PerigeePrecision perigeePrecision = calcPrecisionKarimaki(resultCircle, sNoL, isLineConstrained());
240
241 // Use in pivotingin caset the matrix is not full rank as is for the constrained cases-
242 PerigeeCovariance perigeeCovariance = PerigeeUtil::covarianceFromPrecision(perigeePrecision);
243
244 resultCircle.setChi2(chi2);
245 resultCircle.setNDF(ndf);
246 resultCircle.setPerigeeCovariance(perigeeCovariance);
247 return resultCircle;
248}
std::size_t size() const
Returns the number of observations stored.
bool isLineConstrained() const
Getter for the indictor that lines should be fitted by this fitter.
A matrix implementation to be used as an interface typ through out the track finder.
Definition: PlainMatrix.h:40
Adds an uncertainty matrix to the circle in perigee parameterisation.
void setPerigeeCovariance(const PerigeeCovariance &perigeeCovariance)
Setter for the whole covariance matrix of the perigee parameters.
void setNDF(std::size_t ndf)
Setter for the number of degrees of freediom used in the circle fit.
void setChi2(const double chi2)
Setter for the chi square value of the circle fit.
static CovarianceMatrix covarianceFromPrecision(const PrecisionMatrix &prec)
Convert the precision matrix to the corresponding covariance matrix.

◆ isLineConstrained()

bool isLineConstrained ( ) const
inline

Getter for the indictor that lines should be fitted by this fitter.

Definition at line 36 of file KarimakisMethod.h.

37 {
38 return m_lineConstrained;
39 }

◆ setLineConstrained()

void setLineConstrained ( bool  constrained = true)
inline

Indicator if this fitter is setup to fit lines.

Definition at line 42 of file KarimakisMethod.h.

43 {
44 m_lineConstrained = constrained;
45 }

◆ update()

void update ( CDCTrajectory2D trajectory2D,
CDCObservations2D observations2D 
) const

Executes the fit and updates the trajectory parameters. This may render the information in the observation object.

Definition at line 29 of file KarimakisMethod.cc.

31{
32 size_t nObservations = observations2D.size();
33 trajectory2D.clear();
34 if (not nObservations) return;
35
36 Vector2D ref = observations2D.getCentralPoint();
37 observations2D.passiveMoveBy(ref);
38
39 UncertainPerigeeCircle perigeeCircle = fitInternal(observations2D);
40
41 double frontX = observations2D.getX(0);
42 double frontY = observations2D.getY(0);
43 Vector2D frontPos(frontX, frontY);
44
45 double backX = observations2D.getX(nObservations - 1);
46 double backY = observations2D.getY(nObservations - 1);
47 Vector2D backPos(backX, backY);
48
49 Vector2D overPos(0, 0);
50 double totalPerps = (perigeeCircle->arcLengthBetween(frontPos, overPos) +
51 perigeeCircle->arcLengthBetween(overPos, backPos));
52
53 if (totalPerps < 0) {
54 perigeeCircle.reverse();
55 }
56
57 trajectory2D.setLocalOrigin(ref);
58 trajectory2D.setLocalCircle(perigeeCircle);
59}
double getX(int iObservation) const
Getter for the x value of the observation at the given index.
double getY(int iObservation) const
Getter for the y value of the observation at the given index.
Vector2D getCentralPoint() const
Extracts the observation center that is at the index in the middle.
void passiveMoveBy(const Vector2D &origin)
Moves all observations passively such that the given vector becomes to origin of the new coordinate s...
double setLocalOrigin(const Vector2D &localOrigin)
Setter for the origin of the local coordinate system.
void setLocalCircle(const UncertainPerigeeCircle &localPerigeeCircle)
Setter for the generalized circle that describes the trajectory.
void clear()
Clears all information from this trajectoy.
UncertainPerigeeCircle fitInternal(CDCObservations2D &observations2D) const
Internal method doing the heavy work.
double arcLengthBetween(const Vector2D &from, const Vector2D &to) const
Calculates the arc length between two points of closest approach on the circle.
void reverse()
Flips the orientation of the circle in place.
A two dimensional vector which is equipped with functions for correct handeling of orientation relat...
Definition: Vector2D.h:32

Member Data Documentation

◆ m_lineConstrained

bool m_lineConstrained
private

Memory for the flag indicating that lines should be fitted.

Definition at line 49 of file KarimakisMethod.h.


The documentation for this class was generated from the following files: