Belle II Software  release-08-01-10
CDCRobustSZFitter Class Reference

Utility class implementing robust versions of linear sz trajectory line fits. More...

#include <CDCRobustSZFitter.h>

Public Member Functions

CDCTrajectorySZ fitUsingSimplifiedTheilSen (const CDCSZObservations &szObservations) const
 Fit a linear sz trajectory to the reconstructed stereo segment. More...
 
CDCTrajectorySZ fitTheilSen (const CDCSZObservations &szObservations) const
 Implements the original Theil-Sen line fit algorithm. More...
 
CDCTrajectorySZ fitWeightedTheilSen (const CDCSZObservations &szObservations) const
 Implements the weighted Theil-Sen line fit algorithm. More...
 

Private Member Functions

double getMedianZ0 (const CDCSZObservations &szObservations, double tanLambda) const
 Compute the median z0 intercept from the given observations and an estimated slope.
 

Detailed Description

Utility class implementing robust versions of linear sz trajectory line fits.

Definition at line 20 of file CDCRobustSZFitter.h.

Member Function Documentation

◆ fitTheilSen()

CDCTrajectorySZ fitTheilSen ( const CDCSZObservations szObservations) const

Implements the original Theil-Sen line fit algorithm.

Does not estimate the covariances of the fit parameters.

Definition at line 57 of file CDCRobustSZFitter.cc.

58 {
59  std::vector<double> tanLambdas;
60  tanLambdas.reserve(szObservations.size() * (szObservations.size() - 1) / 2);
61  for (unsigned int i = 0; i < szObservations.size(); i++) {
62  for (unsigned int j = i + 1; j < szObservations.size(); j++) {
63  double s1 = szObservations.getS(i);
64  double s2 = szObservations.getS(j);
65  if (s1 == s2) continue;
66  double z1 = szObservations.getZ(i);
67  double z2 = szObservations.getZ(j);
68  tanLambdas.push_back((z2 - z1) / (s2 - s1));
69  }
70  }
71 
72  const double tanLambda = median(std::move(tanLambdas));
73  const double z0 = getMedianZ0(szObservations, tanLambda);
74 
75  CDCTrajectorySZ trajectorySZ(tanLambda, z0);
76  trajectorySZ.setNDF(szObservations.size());
77  return trajectorySZ;
78 }
double getMedianZ0(const CDCSZObservations &szObservations, double tanLambda) const
Compute the median z0 intercept from the given observations and an estimated slope.
double getZ(int iObservation) const
Getter for the z value of the observation at the given index.
std::size_t size() const
Returns the number of observations stored.
double getS(int iObservation) const
Getter for the arc length value of the observation at the given index.
Linear trajectory in sz space.

◆ fitUsingSimplifiedTheilSen()

CDCTrajectorySZ fitUsingSimplifiedTheilSen ( const CDCSZObservations szObservations) const

Fit a linear sz trajectory to the reconstructed stereo segment.

It uses the normal fitting algorithm but does so multiple times: In every iteration, one hit is excluded from the observation set and the rest is fitted. In the end, the mean over the fitting parameters is built and returned.

Does not estimate the covariances of the fit parameters.

TODO:

  • Use the median.
  • Use RANSAC instead of Theil-Sen.
  • Think about the parameters better.

Definition at line 22 of file CDCRobustSZFitter.cc.

◆ fitWeightedTheilSen()

CDCTrajectorySZ fitWeightedTheilSen ( const CDCSZObservations szObservations) const

Implements the weighted Theil-Sen line fit algorithm.

Does not estimate the covariances of the fit parameters.

Definition at line 80 of file CDCRobustSZFitter.cc.


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