Belle II Software development
ExtendedRiemannsMethod Class Reference

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

#include <ExtendedRiemannsMethod.h>

Inheritance diagram for ExtendedRiemannsMethod:
CDCFitter2D< Belle2::TrackFindingCDC::ExtendedRiemannsMethod > CDCRiemannFitter

Public Member Functions

 ExtendedRiemannsMethod ()
 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.
 
bool isOriginConstrained () const
 Getter for the indicator that curves through the origin should be fitted by this fitter.
 
void setLineConstrained (bool constrained=true)
 Indicator if this fitter is setup to fit lines.
 
void setOriginConstrained (bool constrained=true)
 Indicator if this fitter is setup to fit curves through the origin.
 

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.
 
bool m_originConstrained
 Memory for the flag indicating that curves through the origin shall be fitter.
 

Detailed Description

Class implementing the Riemann fit for two dimensional trajectory circle.

Definition at line 24 of file ExtendedRiemannsMethod.h.

Constructor & Destructor Documentation

◆ ExtendedRiemannsMethod()

Constructor setting the default constraints.

Definition at line 31 of file ExtendedRiemannsMethod.cc.

32 : m_lineConstrained(false)
33 , m_originConstrained(false)
34{
35}
bool m_originConstrained
Memory for the flag indicating that curves through the origin shall be fitter.
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 297 of file ExtendedRiemannsMethod.cc.

298{
299 using namespace NParabolicParameterIndices;
300
301 // Matrix of weighted sums
302 Eigen::Matrix< double, 5, 5 > s = getWXYRLSumMatrix(observations2D);
303
304 // The same as above without drift lengths
305 Eigen::Matrix<double, 4, 4> sNoL = s.block<4, 4>(0, 0);
306
307 // Determine NDF : Circle fit eats up to 3 degrees of freedom depending on the constraints
308 size_t ndf = observations2D.size() - 1;
309
310 if (not isOriginConstrained()) {
311 --ndf;
312 }
313
314 if (not isLineConstrained()) {
315 --ndf;
316 }
317
318 // Parameters to be fitted
319 UncertainPerigeeCircle resultCircle;
320 double chi2 = 0;
321
322 size_t nObservationsWithDriftRadius = observations2D.getNObservationsWithDriftRadius();
323 if (nObservationsWithDriftRadius > 0) {
324 resultCircle = UncertainPerigeeCircle(::fit(s, isLineConstrained(), isOriginConstrained()));
325 chi2 = calcChi2(resultCircle, s);
326 } else {
327 if (not isOriginConstrained()) {
328 // Alternative implementation for comparison
329
330 // Matrix of averages
331 Eigen::Matrix< double, 4, 4> aNoL = sNoL / sNoL(iW);
332
333 // Measurement means
334 Eigen::Matrix< double, 4, 1> meansNoL = aNoL.row(iW);
335
336 // Covariance matrix
337 Eigen::Matrix< double, 4, 4> cNoL = aNoL - meansNoL * meansNoL.transpose();
338
339 resultCircle = UncertainPerigeeCircle(fitSeperateOffset(meansNoL, cNoL, isLineConstrained()));
340
341 } else {
342 resultCircle = UncertainPerigeeCircle(::fit(sNoL, isLineConstrained(), isOriginConstrained()));
343 }
344
345 chi2 = calcChi2(resultCircle, sNoL);
346 }
347
348 // Covariance calculation does not need the drift lengths, which is why we do not forward them.
349 PerigeePrecision perigeePrecision =
350 calcPrecision(resultCircle, sNoL, isLineConstrained(), isOriginConstrained());
351
352 // Use in pivoting in case the matrix is not full rank as it is for the constrained cases
353 PerigeeCovariance perigeeCovariance = PerigeeUtil::covarianceFromPrecision(perigeePrecision);
354
355 resultCircle.setNDF(ndf);
356 resultCircle.setChi2(chi2);
357 resultCircle.setPerigeeCovariance(perigeeCovariance);
358 return resultCircle;
359}
std::size_t size() const
Returns the number of observations stored.
std::size_t getNObservationsWithDriftRadius() const
Returns the number of observations having a drift radius radius.
bool isLineConstrained() const
Getter for the indicator that lines should be fitted by this fitter.
bool isOriginConstrained() const
Getter for the indicator that curves through the origin 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 42 of file ExtendedRiemannsMethod.h.

43 {
44 return m_lineConstrained;
45 }

◆ isOriginConstrained()

bool isOriginConstrained ( ) const
inline

Getter for the indicator that curves through the origin should be fitted by this fitter.

Definition at line 48 of file ExtendedRiemannsMethod.h.

49 {
50 return m_originConstrained;
51 }

◆ setLineConstrained()

void setLineConstrained ( bool constrained = true)
inline

Indicator if this fitter is setup to fit lines.

Definition at line 54 of file ExtendedRiemannsMethod.h.

55 {
56 m_lineConstrained = constrained;
57 }

◆ setOriginConstrained()

void setOriginConstrained ( bool constrained = true)
inline

Indicator if this fitter is setup to fit curves through the origin.

Definition at line 60 of file ExtendedRiemannsMethod.h.

61 {
62 m_originConstrained = constrained;
63 }

◆ 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 37 of file ExtendedRiemannsMethod.cc.

39{
40 size_t nObservations = observations2D.size();
41 trajectory2D.clear();
42 if (not nObservations) return;
43
44 ROOT::Math::XYVector origin = ROOT::Math::XYVector(0.0, 0.0);
45 ROOT::Math::XYVector centralPoint = observations2D.getCentralPoint();
46
47 const ROOT::Math::XYVector& ref = isOriginConstrained() ? origin : centralPoint;
48 observations2D.passiveMoveBy(ref);
49
50 UncertainPerigeeCircle perigeeCircle = fitInternal(observations2D);
51
52 double frontX = observations2D.getX(0);
53 double frontY = observations2D.getY(0);
54 ROOT::Math::XYVector frontPos(frontX, frontY);
55
56 double backX = observations2D.getX(nObservations - 1);
57 double backY = observations2D.getY(nObservations - 1);
58 ROOT::Math::XYVector backPos(backX, backY);
59
60 ROOT::Math::XYVector overPos(0, 0);
61 double totalPerps = (perigeeCircle->arcLengthBetween(frontPos, overPos) +
62 perigeeCircle->arcLengthBetween(overPos, backPos));
63
64 if (totalPerps < 0) {
65 perigeeCircle.reverse();
66 }
67
68 trajectory2D = CDCTrajectory2D(ref, perigeeCircle);
69}
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.
void passiveMoveBy(const ROOT::Math::XYVector &origin)
Moves all observations passively such that the given vector becomes to origin of the new coordinate s...
ROOT::Math::XYVector getCentralPoint() const
Extracts the observation center that is at the index in the middle.
TrackingUtilities::UncertainPerigeeCircle fitInternal(CDCObservations2D &observations2D) const
Internal method doing the heavy work.
double arcLengthBetween(const ROOT::Math::XYVector &from, const ROOT::Math::XYVector &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 67 of file ExtendedRiemannsMethod.h.

◆ m_originConstrained

bool m_originConstrained
private

Memory for the flag indicating that curves through the origin shall be fitter.

Definition at line 70 of file ExtendedRiemannsMethod.h.


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