Belle II Software  release-08-01-10
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 CDCFacet &facet, int nSteps=100)
 Fits a proper line to facet and returns the chi2.
 
static UncertainParameterLine2D fit (const CDCFacet &fromFacet, const CDCFacet &toFacet, int nSteps=100)
 Fit a line the positions xyl and the weights. More...
 
static UncertainParameterLine2D fit (Matrix< double, 3, 3 > xyl, Matrix< double, 3, 1 > w, int nSteps=100)
 Fit a line the positions xyl and the weights. More...
 

Detailed Description

Utility class to fit hit triplet and relations of them.

Definition at line 22 of file FacetFitter.h.

Member Function Documentation

◆ fit() [1/2]

UncertainParameterLine2D fit ( const CDCFacet fromFacet,
const 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 208 of file FacetFitter.cc.

211 {
212  // Observations matrix
213  Matrix<double, 6, 3> xyl = Matrix<double, 6, 3>::Zero();
214 
215  // Weight matrix
216  Matrix<double, 6, 1> w = Matrix<double, 6, 1>::Zero();
217 
218  const Vector2D support = Vector2D::average(fromFacet.getMiddleWireHit().getRefPos2D(),
219  toFacet.getMiddleWireHit().getRefPos2D());
220  {
221  const CDCRLWireHit& startRLWireHit = fromFacet.getStartRLWireHit();
222  const CDCRLWireHit& middleRLWireHit = fromFacet.getMiddleRLWireHit();
223  const CDCRLWireHit& endRLWireHit = fromFacet.getEndRLWireHit();
224 
225  const double startDriftLengthVar = startRLWireHit.getRefDriftLengthVariance();
226  const Vector2D startWirePos2D = startRLWireHit.getWireHit().getRefPos2D();
227  xyl(0, 0) = startWirePos2D.x() - support.x();
228  xyl(0, 1) = startWirePos2D.y() - support.y();
229  xyl(0, 2) = startRLWireHit.getSignedRefDriftLength();
230  w(0) = 1.0 / startDriftLengthVar;
231 
232  const double middleDriftLengthVar = middleRLWireHit.getRefDriftLengthVariance();
233  const Vector2D middleWirePos2D = middleRLWireHit.getWireHit().getRefPos2D();
234  xyl(1, 0) = middleWirePos2D.x() - support.x();
235  xyl(1, 1) = middleWirePos2D.y() - support.y();
236  xyl(1, 2) = middleRLWireHit.getSignedRefDriftLength();
237  w(1) = 1.0 / middleDriftLengthVar;
238 
239  const double endDriftLengthVar = endRLWireHit.getRefDriftLengthVariance();
240  const Vector2D endWirePos2D = endRLWireHit.getWireHit().getRefPos2D();
241  xyl(2, 0) = endWirePos2D.x() - support.x();
242  xyl(2, 1) = endWirePos2D.y() - support.y();
243  xyl(2, 2) = endRLWireHit.getSignedRefDriftLength();
244  w(2) = 1.0 / endDriftLengthVar;
245  }
246 
247  {
248  const CDCRLWireHit& startRLWireHit = toFacet.getStartRLWireHit();
249  const CDCRLWireHit& middleRLWireHit = toFacet.getMiddleRLWireHit();
250  const CDCRLWireHit& endRLWireHit = toFacet.getEndRLWireHit();
251 
252  const double startDriftLengthVar = startRLWireHit.getRefDriftLengthVariance();
253  const Vector2D startWirePos2D = startRLWireHit.getWireHit().getRefPos2D();
254  xyl(3, 0) = startWirePos2D.x() - support.x();
255  xyl(3, 1) = startWirePos2D.y() - support.y();
256  xyl(3, 2) = startRLWireHit.getSignedRefDriftLength();
257  w(3) = 1.0 / startDriftLengthVar;
258 
259  const double middleDriftLengthVar = middleRLWireHit.getRefDriftLengthVariance();
260  const Vector2D middleWirePos2D = middleRLWireHit.getWireHit().getRefPos2D();
261  xyl(4, 0) = middleWirePos2D.x() - support.x();
262  xyl(4, 1) = middleWirePos2D.y() - support.y();
263  xyl(4, 2) = middleRLWireHit.getSignedRefDriftLength();
264  w(4) = 1.0 / middleDriftLengthVar;
265 
266  const double endDriftLengthVar = endRLWireHit.getRefDriftLengthVariance();
267  const Vector2D endWirePos2D = endRLWireHit.getWireHit().getRefPos2D();
268  xyl(5, 0) = endWirePos2D.x() - support.x();
269  xyl(5, 1) = endWirePos2D.y() - support.y();
270  xyl(5, 2) = endRLWireHit.getSignedRefDriftLength();
271  w(5) = 1.0 / endDriftLengthVar;
272  }
273 
274  UncertainParameterLine2D fitLine{ ::fit(std::move(xyl), std::move(w), nSteps) };
275  fitLine.passiveMoveBy(-support);
276  return fitLine;
277 }
CDCRLWireHit & getEndRLWireHit()
Getter for the third oriented wire hit.
CDCRLWireHit & getMiddleRLWireHit()
Getter for the second oriented wire hit.
CDCRLWireHit & getStartRLWireHit()
Getter for the first oriented wire hit.
const CDCWireHit & getMiddleWireHit() const
Getter for the hit wire of the second oriented wire hit.
Class representing an oriented hit wire including a hypotheses whether the causing track passes left ...
Definition: CDCRLWireHit.h:41
double getRefDriftLengthVariance() const
Getter for the variance of the drift length at the reference position of the wire.
Definition: CDCRLWireHit.h:222
double getSignedRefDriftLength() const
Getter for the drift length at the reference position of the wire.
Definition: CDCRLWireHit.h:216
const CDCWireHit & getWireHit() const
Getter for the wire hit associated with the oriented hit.
Definition: CDCRLWireHit.h:192
const Vector2D & getRefPos2D() const
The two dimensional reference position (z=0) of the underlying wire.
Definition: CDCWireHit.cc:212
static double fit(const CDCFacet &facet, int nSteps=100)
Fits a proper line to facet and returns the chi2.
Definition: FacetFitter.cc:166
static PlainMatrix< T, M, N > Zero()
Construct a matrix initialized with zeros.
Definition: PlainMatrix.h:67
A parameter line including including an line covariance matrix which is interpreted as located in the...
A two dimensional vector which is equipped with functions for correct handeling of orientation relat...
Definition: Vector2D.h:35
static Vector2D average(const Vector2D &one, const Vector2D &two)
Constructs the average of two vectors.
Definition: Vector2D.h:93
double x() const
Getter for the x coordinate.
Definition: Vector2D.h:607
double y() const
Getter for the y coordinate.
Definition: Vector2D.h:617

◆ fit() [2/2]

UncertainParameterLine2D fit ( Matrix< double, 3, 3 >  xyl,
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 280 of file FacetFitter.cc.


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