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 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.
 
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.
 

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/3]

double fit ( const CDCFacet facet,
int  nSteps = 100 
)
static

Fits a proper line to facet and returns the chi2.

Definition at line 166 of file FacetFitter.cc.

167{
168 // Measurement matrix
169 Matrix<double, 3, 3> xyl = Matrix<double, 3, 3>::Zero();
170
171 // Weight matrix
172 Matrix<double, 3, 1> w = Matrix<double, 3, 1>::Zero();
173
174 const CDCRLWireHit& startRLWireHit = facet.getStartRLWireHit();
175 const CDCRLWireHit& middleRLWireHit = facet.getMiddleRLWireHit();
176 const CDCRLWireHit& endRLWireHit = facet.getEndRLWireHit();
177
178 const Vector2D support = middleRLWireHit.getWireHit().getRefPos2D();
179
180 const double startDriftLengthVar = startRLWireHit.getRefDriftLengthVariance();
181 const Vector2D startWirePos2D = startRLWireHit.getWireHit().getRefPos2D();
182 xyl(0, 0) = startWirePos2D.x() - support.x();
183 xyl(0, 1) = startWirePos2D.y() - support.y();
184 xyl(0, 2) = startRLWireHit.getSignedRefDriftLength();
185 w(0) = 1.0 / startDriftLengthVar;
186
187 const double middleDriftLengthVar = middleRLWireHit.getRefDriftLengthVariance();
188 const Vector2D middleWirePos2D = middleRLWireHit.getWireHit().getRefPos2D();
189 xyl(1, 0) = middleWirePos2D.x() - support.x();
190 xyl(1, 1) = middleWirePos2D.y() - support.y();
191 xyl(1, 2) = middleRLWireHit.getSignedRefDriftLength();
192 w(1) = 1.0 / middleDriftLengthVar;
193
194 const double endDriftLengthVar = endRLWireHit.getRefDriftLengthVariance();
195 const Vector2D endWirePos2D = endRLWireHit.getWireHit().getRefPos2D();
196 xyl(2, 0) = endWirePos2D.x() - support.x();
197 xyl(2, 1) = endWirePos2D.y() - support.y();
198 xyl(2, 2) = endRLWireHit.getSignedRefDriftLength();
199 w(2) = 1.0 / endDriftLengthVar;
200
201 UncertainParameterLine2D fitLine{ ::fit(std::move(xyl), std::move(w), nSteps) };
202 fitLine.passiveMoveBy(-support);
203 facet.setFitLine(fitLine);
204 return fitLine.chi2();
205}
void setFitLine(const UncertainParameterLine2D &fitLine) const
Setter for the contained line fit information.
Definition: CDCFacet.h:67
CDCRLWireHit & getStartRLWireHit()
Getter for the first oriented wire hit.
CDCRLWireHit & getEndRLWireHit()
Getter for the third oriented wire hit.
CDCRLWireHit & getMiddleRLWireHit()
Getter for the second oriented wire hit.
Class representing an oriented hit wire including a hypotheses whether the causing track passes left ...
Definition: CDCRLWireHit.h:41
const CDCWireHit & getWireHit() const
Getter for the wire hit associated with the oriented hit.
Definition: CDCRLWireHit.h:192
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 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 handling of orientation relate...
Definition: Vector2D.h:32
double x() const
Getter for the x coordinate.
Definition: Vector2D.h:595
double y() const
Getter for the y coordinate.
Definition: Vector2D.h:605

◆ fit() [2/3]

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}
const CDCWireHit & getMiddleWireHit() const
Getter for the hit wire of the second oriented wire hit.
static Vector2D average(const Vector2D &one, const Vector2D &two)
Constructs the average of two vectors.
Definition: Vector2D.h:84

◆ fit() [3/3]

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.

283{
284 return ::fit(std::move(xyl), std::move(w), nSteps);
285}

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