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 (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

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 21 of file ExtendedRiemannsMethod.h.

Constructor & Destructor Documentation

◆ ExtendedRiemannsMethod()

Constructor setting the default constraints.

Definition at line 28 of file ExtendedRiemannsMethod.cc.

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

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

◆ isLineConstrained()

bool isLineConstrained ( ) const
inline

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

Definition at line 39 of file ExtendedRiemannsMethod.h.

40 {
41 return m_lineConstrained;
42 }

◆ isOriginConstrained()

bool isOriginConstrained ( ) const
inline

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

Definition at line 45 of file ExtendedRiemannsMethod.h.

46 {
48 }

◆ setLineConstrained()

void setLineConstrained ( bool  constrained = true)
inline

Indicator if this fitter is setup to fit lines.

Definition at line 51 of file ExtendedRiemannsMethod.h.

52 {
53 m_lineConstrained = constrained;
54 }

◆ setOriginConstrained()

void setOriginConstrained ( bool  constrained = true)
inline

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

Definition at line 57 of file ExtendedRiemannsMethod.h.

58 {
59 m_originConstrained = constrained;
60 }

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

36{
37 size_t nObservations = observations2D.size();
38 trajectory2D.clear();
39 if (not nObservations) return;
40
41 Vector2D origin = Vector2D(0.0, 0.0);
42 Vector2D centralPoint = observations2D.getCentralPoint();
43
44 const Vector2D& ref = isOriginConstrained() ? origin : centralPoint;
45 observations2D.passiveMoveBy(ref);
46
47 UncertainPerigeeCircle perigeeCircle = fitInternal(observations2D);
48
49 double frontX = observations2D.getX(0);
50 double frontY = observations2D.getY(0);
51 Vector2D frontPos(frontX, frontY);
52
53 double backX = observations2D.getX(nObservations - 1);
54 double backY = observations2D.getY(nObservations - 1);
55 Vector2D backPos(backX, backY);
56
57 Vector2D overPos(0, 0);
58 double totalPerps = (perigeeCircle->arcLengthBetween(frontPos, overPos) +
59 perigeeCircle->arcLengthBetween(overPos, backPos));
60
61 if (totalPerps < 0) {
62 perigeeCircle.reverse();
63 }
64
65 trajectory2D = CDCTrajectory2D(ref, perigeeCircle);
66}
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...
Particle trajectory as it is seen in xy projection represented as a circle.
void clear()
Clears all information from this trajectory.
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 handling of orientation relate...
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 64 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 67 of file ExtendedRiemannsMethod.h.


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