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)
 Fits a proper line to 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 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 24 of file FacetFitter.h.

Member Function Documentation

◆ fit() [1/3]

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

Fits a proper line to facet and returns the chi2.

Definition at line 167 of file FacetFitter.cc.

168{
169 // Measurement matrix
170 Matrix<double, 3, 3> xyl = Matrix<double, 3, 3>::Zero();
171
172 // Weight matrix
173 Matrix<double, 3, 1> w = Matrix<double, 3, 1>::Zero();
174
175 const CDCRLWireHit& startRLWireHit = facet.getStartRLWireHit();
176 const CDCRLWireHit& middleRLWireHit = facet.getMiddleRLWireHit();
177 const CDCRLWireHit& endRLWireHit = facet.getEndRLWireHit();
178
179 const Vector2D support = middleRLWireHit.getWireHit().getRefPos2D();
180
181 const double startDriftLengthVar = startRLWireHit.getRefDriftLengthVariance();
182 const Vector2D startWirePos2D = startRLWireHit.getWireHit().getRefPos2D();
183 xyl(0, 0) = startWirePos2D.x() - support.x();
184 xyl(0, 1) = startWirePos2D.y() - support.y();
185 xyl(0, 2) = startRLWireHit.getSignedRefDriftLength();
186 w(0) = 1.0 / startDriftLengthVar;
187
188 const double middleDriftLengthVar = middleRLWireHit.getRefDriftLengthVariance();
189 const Vector2D middleWirePos2D = middleRLWireHit.getWireHit().getRefPos2D();
190 xyl(1, 0) = middleWirePos2D.x() - support.x();
191 xyl(1, 1) = middleWirePos2D.y() - support.y();
192 xyl(1, 2) = middleRLWireHit.getSignedRefDriftLength();
193 w(1) = 1.0 / middleDriftLengthVar;
194
195 const double endDriftLengthVar = endRLWireHit.getRefDriftLengthVariance();
196 const Vector2D endWirePos2D = endRLWireHit.getWireHit().getRefPos2D();
197 xyl(2, 0) = endWirePos2D.x() - support.x();
198 xyl(2, 1) = endWirePos2D.y() - support.y();
199 xyl(2, 2) = endRLWireHit.getSignedRefDriftLength();
200 w(2) = 1.0 / endDriftLengthVar;
201
202 UncertainParameterLine2D fitLine{ ::fit(std::move(xyl), std::move(w), nSteps) };
203 fitLine.passiveMoveBy(-support);
204 facet.setFitLine(fitLine);
205 return fitLine.chi2();
206}
static double fit(const TrackingUtilities::CDCFacet &facet, int nSteps=100)
Fits a proper line to facet and returns the chi2.
const CDCWireHit & getWireHit() const
Getter for the wire hit associated with the oriented hit.
double getRefDriftLengthVariance() const
Getter for the variance of the drift length at the reference position of the wire.
double getSignedRefDriftLength() const
Getter for the drift length at the reference position of the wire.
const ROOT::Math::XYVector & getRefPos2D() const
The two dimensional reference position (z=0) of the underlying wire.
static PlainMatrix< T, M, N > Zero()
Construct a matrix initialized with zeros.
Definition PlainMatrix.h:67
double x() const
Getter for the x coordinate.
Definition Vector2D.h:626
double y() const
Getter for the y coordinate.
Definition Vector2D.h:641

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

212{
213 // Observations matrix
214 Matrix<double, 6, 3> xyl = Matrix<double, 6, 3>::Zero();
215
216 // Weight matrix
217 Matrix<double, 6, 1> w = Matrix<double, 6, 1>::Zero();
218
219 const Vector2D support = Vector2D::average(fromFacet.getMiddleWireHit().getRefPos2D(),
220 toFacet.getMiddleWireHit().getRefPos2D());
221 {
222 const CDCRLWireHit& startRLWireHit = fromFacet.getStartRLWireHit();
223 const CDCRLWireHit& middleRLWireHit = fromFacet.getMiddleRLWireHit();
224 const CDCRLWireHit& endRLWireHit = fromFacet.getEndRLWireHit();
225
226 const double startDriftLengthVar = startRLWireHit.getRefDriftLengthVariance();
227 const Vector2D startWirePos2D = startRLWireHit.getWireHit().getRefPos2D();
228 xyl(0, 0) = startWirePos2D.x() - support.x();
229 xyl(0, 1) = startWirePos2D.y() - support.y();
230 xyl(0, 2) = startRLWireHit.getSignedRefDriftLength();
231 w(0) = 1.0 / startDriftLengthVar;
232
233 const double middleDriftLengthVar = middleRLWireHit.getRefDriftLengthVariance();
234 const Vector2D middleWirePos2D = middleRLWireHit.getWireHit().getRefPos2D();
235 xyl(1, 0) = middleWirePos2D.x() - support.x();
236 xyl(1, 1) = middleWirePos2D.y() - support.y();
237 xyl(1, 2) = middleRLWireHit.getSignedRefDriftLength();
238 w(1) = 1.0 / middleDriftLengthVar;
239
240 const double endDriftLengthVar = endRLWireHit.getRefDriftLengthVariance();
241 const Vector2D endWirePos2D = endRLWireHit.getWireHit().getRefPos2D();
242 xyl(2, 0) = endWirePos2D.x() - support.x();
243 xyl(2, 1) = endWirePos2D.y() - support.y();
244 xyl(2, 2) = endRLWireHit.getSignedRefDriftLength();
245 w(2) = 1.0 / endDriftLengthVar;
246 }
247
248 {
249 const CDCRLWireHit& startRLWireHit = toFacet.getStartRLWireHit();
250 const CDCRLWireHit& middleRLWireHit = toFacet.getMiddleRLWireHit();
251 const CDCRLWireHit& endRLWireHit = toFacet.getEndRLWireHit();
252
253 const double startDriftLengthVar = startRLWireHit.getRefDriftLengthVariance();
254 const Vector2D startWirePos2D = startRLWireHit.getWireHit().getRefPos2D();
255 xyl(3, 0) = startWirePos2D.x() - support.x();
256 xyl(3, 1) = startWirePos2D.y() - support.y();
257 xyl(3, 2) = startRLWireHit.getSignedRefDriftLength();
258 w(3) = 1.0 / startDriftLengthVar;
259
260 const double middleDriftLengthVar = middleRLWireHit.getRefDriftLengthVariance();
261 const Vector2D middleWirePos2D = middleRLWireHit.getWireHit().getRefPos2D();
262 xyl(4, 0) = middleWirePos2D.x() - support.x();
263 xyl(4, 1) = middleWirePos2D.y() - support.y();
264 xyl(4, 2) = middleRLWireHit.getSignedRefDriftLength();
265 w(4) = 1.0 / middleDriftLengthVar;
266
267 const double endDriftLengthVar = endRLWireHit.getRefDriftLengthVariance();
268 const Vector2D endWirePos2D = endRLWireHit.getWireHit().getRefPos2D();
269 xyl(5, 0) = endWirePos2D.x() - support.x();
270 xyl(5, 1) = endWirePos2D.y() - support.y();
271 xyl(5, 2) = endRLWireHit.getSignedRefDriftLength();
272 w(5) = 1.0 / endDriftLengthVar;
273 }
274
275 UncertainParameterLine2D fitLine{ ::fit(std::move(xyl), std::move(w), nSteps) };
276 fitLine.passiveMoveBy(-support);
277 return fitLine;
278}
static Vector2D average(const Vector2D &one, const Vector2D &two)
Constructs the average of two vectors.
Definition Vector2D.h:104

◆ fit() [3/3]

static TrackingUtilities::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

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