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 (TrackingUtilities::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 indicator 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

TrackingUtilities::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 23 of file KarimakisMethod.h.

Constructor & Destructor Documentation

◆ KarimakisMethod()

Constructor setting the default constraints.

Definition at line 25 of file KarimakisMethod.cc.

26 : m_lineConstrained(false)
27{
28}
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 215 of file KarimakisMethod.cc.

216{
217 // Matrix of weighted sums
218 Eigen::Matrix< double, 4, 4> sNoL = getWXYRSumMatrix(observations2D);
219
220 // Matrix of averages
221 Eigen::Matrix<double, 4, 4> aNoL = sNoL / sNoL(iW);
222
223 // Measurement means
224 Eigen::Matrix<double, 4, 1> meansNoL = aNoL.row(iW);
225
226 // Covariance matrix
227 Eigen::Matrix<double, 4, 4> cNoL = aNoL - meansNoL * meansNoL.transpose();
228
229 // Determine NDF : Circle fit eats up to 3 degrees of freedom debpending on the constraints
230 size_t ndf = observations2D.size() - 2;
231
232 if (not isLineConstrained()) {
233 --ndf;
234 }
235
236 // Parameters to be fitted
237 UncertainPerigeeCircle resultCircle = fitKarimaki(sNoL(iW), meansNoL, cNoL, isLineConstrained());
238 double chi2 = calcChi2Karimaki(resultCircle, sNoL(iW), cNoL);
239
240 PerigeePrecision perigeePrecision = calcPrecisionKarimaki(resultCircle, sNoL, isLineConstrained());
241
242 // Use in pivotingin caset the matrix is not full rank as is for the constrained cases-
243 PerigeeCovariance perigeeCovariance = PerigeeUtil::covarianceFromPrecision(perigeePrecision);
244
245 resultCircle.setChi2(chi2);
246 resultCircle.setNDF(ndf);
247 resultCircle.setPerigeeCovariance(perigeeCovariance);
248 return resultCircle;
249}
std::size_t size() const
Returns the number of observations stored.
bool isLineConstrained() const
Getter for the indicator that lines should be fitted by this fitter.
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.

◆ isLineConstrained()

bool isLineConstrained ( ) const
inline

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

Definition at line 38 of file KarimakisMethod.h.

39 {
40 return m_lineConstrained;
41 }

◆ setLineConstrained()

void setLineConstrained ( bool constrained = true)
inline

Indicator if this fitter is setup to fit lines.

Definition at line 44 of file KarimakisMethod.h.

45 {
46 m_lineConstrained = constrained;
47 }

◆ update()

void update ( TrackingUtilities::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 30 of file KarimakisMethod.cc.

32{
33 size_t nObservations = observations2D.size();
34 trajectory2D.clear();
35 if (not nObservations) return;
36
37 Vector2D ref = observations2D.getCentralPoint();
38 observations2D.passiveMoveBy(ref);
39
40 UncertainPerigeeCircle perigeeCircle = fitInternal(observations2D);
41
42 double frontX = observations2D.getX(0);
43 double frontY = observations2D.getY(0);
44 Vector2D frontPos(frontX, frontY);
45
46 double backX = observations2D.getX(nObservations - 1);
47 double backY = observations2D.getY(nObservations - 1);
48 Vector2D backPos(backX, backY);
49
50 Vector2D overPos(0, 0);
51 double totalPerps = (perigeeCircle->arcLengthBetween(frontPos, overPos) +
52 perigeeCircle->arcLengthBetween(overPos, backPos));
53
54 if (totalPerps < 0) {
55 perigeeCircle.reverse();
56 }
57
58 trajectory2D.setLocalOrigin(ref);
59 trajectory2D.setLocalCircle(perigeeCircle);
60}
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.
TrackingUtilities::Vector2D getCentralPoint() const
Extracts the observation center that is at the index in the middle.
void passiveMoveBy(const TrackingUtilities::Vector2D &origin)
Moves all observations passively such that the given vector becomes to origin of the new coordinate s...
TrackingUtilities::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.

Member Data Documentation

◆ m_lineConstrained

bool m_lineConstrained
private

Memory for the flag indicating that lines should be fitted.

Definition at line 51 of file KarimakisMethod.h.


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