Belle II Software development
FacetFitter Class Reference

Utility class to fit hit triplet and relations of them. More...

#include <FacetFitter.h>

Static Public Member Functions

static double fit (const TrackingUtilities::CDCFacet &facet, int nSteps=100, double maxChi2=std::numeric_limits< double >::infinity())
 Fits a proper line to the facet and returns the chi2.
 
static TrackingUtilities::UncertainParameterLine2D fit (const TrackingUtilities::CDCFacet &fromFacet, const TrackingUtilities::CDCFacet &toFacet, int nSteps=100)
 Fit a line the positions xyl and the weights.
 
static double fitChi2 (const TrackingUtilities::CDCFacet &fromFacet, const TrackingUtilities::CDCFacet &toFacet)
 Calculate only the chi2 of a line fitted to the hits of the two facets.
 
static TrackingUtilities::UncertainParameterLine2D fit (TrackingUtilities::Matrix< double, 3, 3 > xyl, TrackingUtilities::Matrix< double, 3, 1 > w, int nSteps=100)
 Fit a line the positions xyl and the weights.
 

Detailed Description

Utility class to fit hit triplet and relations of them.

Definition at line 26 of file FacetFitter.h.

Member Function Documentation

◆ fit() [1/3]

double fit ( const TrackingUtilities::CDCFacet & facet,
int nSteps = 100,
double maxChi2 = std::numeric_limits<double>::infinity() )
static

Fits a proper line to the facet and returns the chi2.

The fitted line is committed to the facet only if its chi2 is at most maxChi2. With the default maxChi2 = infinity the line is always committed; passing a finite maxChi2 skips the construction of the line and its covariance matrix for facets that fail the cut anyway.

Definition at line 263 of file FacetFitter.cc.

264{
265 // Measurement matrix
266 Matrix<double, 3, 3> xyl = Matrix<double, 3, 3>::Zero();
267
268 // Weight matrix
269 Matrix<double, 3, 1> w = Matrix<double, 3, 1>::Zero();
270
271 const ROOT::Math::XYVector support = fillFacetObservations(facet, xyl, w);
272
273 LineFitPrecursor precursor = fitPrecursor(std::move(xyl), std::move(w), nSteps);
274
275 // Construct and commit the fit line only when it is wanted: always for an
276 // infinite maxChi2, otherwise only if the fit passes the cut. Skipping it for
277 // failing facets avoids building the line and its covariance matrix. A NaN chi2
278 // fails "chi2 <= maxChi2", so it is committed only in the unbounded case.
279 if (std::isinf(maxChi2) or precursor.chi2 <= maxChi2) {
280 const int ndf = 1;
281 UncertainParameterLine2D fitLine = lineFromPrecursor(precursor, ndf);
282 fitLine.passiveMoveBy(-support);
283 facet.setFitLine(fitLine);
284 }
285 return precursor.chi2;
286}
static PlainMatrix< T, M, N > Zero()
Construct a matrix initialized with zeros.
Definition PlainMatrix.h:67
void passiveMoveBy(const ROOT::Math::XYVector &by)
Moves the coordinate system by the vector by.

◆ fit() [2/3]

UncertainParameterLine2D fit ( const TrackingUtilities::CDCFacet & fromFacet,
const TrackingUtilities::CDCFacet & toFacet,
int nSteps = 100 )
static

Fit a line the positions xyl and the weights.

Parameters
fromFacetFirst facet from the pair of facets
toFacetSecond facet from the pair of facets
nStepsMaximal number of steps to be taken in the mimisation

Definition at line 358 of file FacetFitter.cc.

361{
362 // Observations matrix
363 Matrix<double, 6, 3> xyl = Matrix<double, 6, 3>::Zero();
364
365 // Weight matrix
366 Matrix<double, 6, 1> w = Matrix<double, 6, 1>::Zero();
367
368 const ROOT::Math::XYVector support = fillFacetPairObservations(fromFacet, toFacet, xyl, w);
369
370 UncertainParameterLine2D fitLine{ ::fit(std::move(xyl), std::move(w), nSteps) };
371 fitLine.passiveMoveBy(-support);
372 return fitLine;
373}
static double fit(const TrackingUtilities::CDCFacet &facet, int nSteps=100, double maxChi2=std::numeric_limits< double >::infinity())
Fits a proper line to the facet and returns the chi2.

◆ fit() [3/3]

UncertainParameterLine2D fit ( TrackingUtilities::Matrix< double, 3, 3 > xyl,
TrackingUtilities::Matrix< double, 3, 1 > w,
int nSteps = 100 )
static

Fit a line the positions xyl and the weights.

Fits a line to a number of observations with tunable acurracy versus execution speed. Special implementations for nSteps = 0 and nSteps=1 have been integrated. High nSteps use a general minimization method.

Parameters
xylA matrix of drift length observations
wAn array of weights corresponding to the observations
nStepsMaximal number of steps to be taken in the mimisation

Definition at line 392 of file FacetFitter.cc.

395{
396 return ::fit(std::move(xyl), std::move(w), nSteps);
397}

◆ fitChi2()

double fitChi2 ( const TrackingUtilities::CDCFacet & fromFacet,
const TrackingUtilities::CDCFacet & toFacet )
static

Calculate only the chi2 of a line fitted to the hits of the two facets.

Returns the same value as fit(fromFacet, toFacet, 0).chi2() but avoids the construction of the line and its covariance matrix.

Parameters
fromFacetFirst facet from the pair of facets
toFacetSecond facet from the pair of facets

Definition at line 375 of file FacetFitter.cc.

377{
378 // Observations matrix
379 Matrix<double, 6, 3> xyl = Matrix<double, 6, 3>::Zero();
380
381 // Weight matrix
382 Matrix<double, 6, 1> w = Matrix<double, 6, 1>::Zero();
383
384 fillFacetPairObservations(fromFacet, toFacet, xyl, w);
385
386 // The chi2 is invariant against the translation by the support point
387 constexpr const int nSteps = 0;
388 return fitPrecursor(std::move(xyl), std::move(w), nSteps).chi2;
389}

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