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

31 : m_lineConstrained(false)
32 , m_originConstrained(false)
33{
34}
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 296 of file ExtendedRiemannsMethod.cc.

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

38{
39 size_t nObservations = observations2D.size();
40 trajectory2D.clear();
41 if (not nObservations) return;
42
43 Vector2D origin = Vector2D(0.0, 0.0);
44 Vector2D centralPoint = observations2D.getCentralPoint();
45
46 const Vector2D& ref = isOriginConstrained() ? origin : centralPoint;
47 observations2D.passiveMoveBy(ref);
48
49 UncertainPerigeeCircle perigeeCircle = fitInternal(observations2D);
50
51 double frontX = observations2D.getX(0);
52 double frontY = observations2D.getY(0);
53 Vector2D frontPos(frontX, frontY);
54
55 double backX = observations2D.getX(nObservations - 1);
56 double backY = observations2D.getY(nObservations - 1);
57 Vector2D backPos(backX, backY);
58
59 Vector2D overPos(0, 0);
60 double totalPerps = (perigeeCircle->arcLengthBetween(frontPos, overPos) +
61 perigeeCircle->arcLengthBetween(overPos, backPos));
62
63 if (totalPerps < 0) {
64 perigeeCircle.reverse();
65 }
66
67 trajectory2D = CDCTrajectory2D(ref, perigeeCircle);
68}
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 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: