Belle II Software  release-05-02-19
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 30 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 59 of file CDCRobustSZFitter.cc.

60 {
61  std::vector<double> tanLambdas;
62  tanLambdas.reserve(szObservations.size() * (szObservations.size() - 1) / 2);
63  for (unsigned int i = 0; i < szObservations.size(); i++) {
64  for (unsigned int j = i + 1; j < szObservations.size(); j++) {
65  double s1 = szObservations.getS(i);
66  double s2 = szObservations.getS(j);
67  if (s1 == s2) continue;
68  double z1 = szObservations.getZ(i);
69  double z2 = szObservations.getZ(j);
70  tanLambdas.push_back((z2 - z1) / (s2 - s1));
71  }
72  }
73 
74  const double tanLambda = median(std::move(tanLambdas));
75  const double z0 = getMedianZ0(szObservations, tanLambda);
76 
77  CDCTrajectorySZ trajectorySZ(tanLambda, z0);
78  trajectorySZ.setNDF(szObservations.size());
79  return trajectorySZ;
80 }

◆ 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 24 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 82 of file CDCRobustSZFitter.cc.


The documentation for this class was generated from the following files:
Belle2::TrackFindingCDC::CDCRobustSZFitter::getMedianZ0
double getMedianZ0(const CDCSZObservations &szObservations, double tanLambda) const
Compute the median z0 intercept from the given observations and an estimated slope.
Definition: CDCRobustSZFitter.cc:117