Belle II Software prerelease-11-00-00d
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 261 of file FacetFitter.cc.

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

357{
358 // Observations matrix
359 Matrix<double, 6, 3> xyl = Matrix<double, 6, 3>::Zero();
360
361 // Weight matrix
362 Matrix<double, 6, 1> w = Matrix<double, 6, 1>::Zero();
363
364 const Vector2D support = fillFacetPairObservations(fromFacet, toFacet, xyl, w);
365
366 UncertainParameterLine2D fitLine{ ::fit(std::move(xyl), std::move(w), nSteps) };
367 fitLine.passiveMoveBy(-support);
368 return fitLine;
369}
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 388 of file FacetFitter.cc.

391{
392 return ::fit(std::move(xyl), std::move(w), nSteps);
393}

◆ 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 371 of file FacetFitter.cc.

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

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