Belle II Software development
UncertainHelix Class Reference

A general helix class including a covariance matrix. More...

#include <UncertainHelix.h>

Public Member Functions

 UncertainHelix ()
 Default constructor for ROOT compatibility.
 
 UncertainHelix (const double curvature, const double phi0, const double impact, const double tanLambda, const double z0, const HelixCovariance &helixCovariance=HelixUtil::identity(), const double chi2=0.0, std::size_t ndf=0)
 Composes an uncertain perigee circle from the perigee parameters and a 3x3 covariance matrix.
 
 UncertainHelix (const HelixParameters &parameters, const HelixCovariance &helixCovariance=HelixUtil::identity(), const double chi2=0.0, std::size_t ndf=0)
 Constructor taking all stored parameters.
 
 UncertainHelix (const double curvature, const Vector2D &phi0Vec, const double impact, const double tanLambda, const double z0, const HelixCovariance &helixCovariance=HelixUtil::identity(), const double chi2=0.0, std::size_t ndf=0)
 Composes an uncertain perigee circle from the perigee parameters and a 3x3 covariance matrix.
 
 UncertainHelix (const Helix &helix, const HelixCovariance &helixCovariance=HelixUtil::identity(), const double chi2=0.0, std::size_t ndf=0)
 Augments a plain helix with a covariance matrix. Covariance defaults to zero.
 
 UncertainHelix (const UncertainPerigeeCircle &uncertainPerigeeCircle, const UncertainSZLine &uncertainSZLine)
 Augments a plain helix with a covariance matrix. Covariance defaults to zero.
 
const Helixoperator-> () const
 Access to the constant interface of the underlying parameter line Allows the user of this "super" class to use the getters and other methods to get inforamation about the line but disallows mutation of internal state.
 
 operator const Helix & () const
 Downcast to the "super" class.
 
const Helixhelix () const
 Getter for the underlying helix.
 
HelixParameters helixParameters () const
 Getter for the perigee parameters in the order defined by EPerigeeParameter.h.
 
UncertainPerigeeCircle uncertainCircleXY () const
 Projects the helix into the xy plain carrying over the relevant parts of the convariance matrix.
 
UncertainSZLine uncertainSZLine () const
 Reduces the helix to an sz line carrying over the relevant parts of the convariance matrix.
 
void setHelixCovariance (const HelixCovariance &helixCovariance)
 Setter for the whole covariance matrix of the perigee parameters.
 
const HelixCovariancehelixCovariance () const
 Getter for the whole covariance matrix of the perigee parameters.
 
double covariance (const EHelixParameter &iRow, const EHelixParameter &iCol) const
 Getter for individual elements of the covariance matrix.
 
double variance (const EHelixParameter &i) const
 Getter for individual diagonal elements of the covariance matrix.
 
double chi2 () const
 Getter for the chi square value of the helix fit.
 
void setChi2 (const double chi2)
 Setter for the chi square value of the helix fit.
 
std::size_t ndf () const
 Getter for the number of degrees of freediom used in the helix fit.
 
void setNDF (std::size_t ndf)
 Setter for the number of degrees of freediom used in the helix fit.
 
void invalidate ()
 Sets all circle parameters to zero and the covariance matrix to something noninformative.
 
void reverse ()
 Flips the orientation of the circle in place.
 
UncertainHelix reversed () const
 Returns a copy of the circle with opposite orientation.
 
void passiveMoveBy (const Vector3D &by)
 Moves the coordinate system by the vector by and calculates the new perigee and its covariance matrix.
 
double shiftPeriod (int nPeriods)
 Adjust the arclength measure to start n periods later.
 

Static Public Member Functions

static UncertainHelix average (const UncertainHelix &fromHelix, const UncertainHelix &toHelix)
 Construct the averages of the two given helices by properly considering their covariance matrix.
 
static UncertainHelix average (const UncertainPerigeeCircle &fromPerigeeCircle, const PerigeeHelixAmbiguity &fromAmbiguity, const UncertainPerigeeCircle &toPerigeeCircle, const PerigeeHelixAmbiguity &toAmbiguity, const SZParameters &szParameters)
 Construct the average helix including its covariance matrix from two different stereo angle projections.
 
static UncertainHelix average (const UncertainHelix &helix, const UncertainPerigeeCircle &perigeeCircle, const PerigeeHelixAmbiguity &ambiguityMatrix)
 Construct the average helix including its covariance matrix incoorporating additional information from a stereo projection.
 
static UncertainHelix average (const UncertainPerigeeCircle &fromPerigeeCircle, const PerigeeHelixAmbiguity &fromAmbiguity, const UncertainHelix &toHelix)
 Construct the average helix including its covariance matrix incoorporating additional information from a stereo projection.
 

Private Attributes

Helix m_helix
 Memory for the underlying helix.
 
HelixCovariance m_helixCovariance = HelixUtil::identity()
 Memory for the 5x5 covariance matrix of the helix parameters.
 
double m_chi2 = 0.0
 Memory for the chi square value of the fit of this helix.
 
size_t m_ndf = 0.0
 Memory for the number of degrees of freedom of the fit of this helix.
 

Detailed Description

A general helix class including a covariance matrix.

Definition at line 34 of file UncertainHelix.h.

Constructor & Destructor Documentation

◆ UncertainHelix() [1/6]

UncertainHelix ( )
inline

Default constructor for ROOT compatibility.

Definition at line 38 of file UncertainHelix.h.

39 {
40 }

◆ UncertainHelix() [2/6]

UncertainHelix ( const double  curvature,
const double  phi0,
const double  impact,
const double  tanLambda,
const double  z0,
const HelixCovariance helixCovariance = HelixUtil::identity(),
const double  chi2 = 0.0,
std::size_t  ndf = 0 
)
inline

Composes an uncertain perigee circle from the perigee parameters and a 3x3 covariance matrix.

Definition at line 44 of file UncertainHelix.h.

52 : m_helix(curvature, phi0, impact, tanLambda, z0)
54 , m_chi2(chi2)
55 , m_ndf(ndf)
56 {
57 }
const HelixCovariance & helixCovariance() const
Getter for the whole covariance matrix of the perigee parameters.
HelixCovariance m_helixCovariance
Memory for the 5x5 covariance matrix of the helix parameters.
double m_chi2
Memory for the chi square value of the fit of this helix.
double chi2() const
Getter for the chi square value of the helix fit.
size_t m_ndf
Memory for the number of degrees of freedom of the fit of this helix.
Helix m_helix
Memory for the underlying helix.
std::size_t ndf() const
Getter for the number of degrees of freediom used in the helix fit.

◆ UncertainHelix() [3/6]

UncertainHelix ( const HelixParameters parameters,
const HelixCovariance helixCovariance = HelixUtil::identity(),
const double  chi2 = 0.0,
std::size_t  ndf = 0 
)
inlineexplicit

Constructor taking all stored parameters.

Definition at line 60 of file UncertainHelix.h.

64 : m_helix(parameters)
66 , m_chi2(chi2)
67 , m_ndf(ndf)
68 {
69 }

◆ UncertainHelix() [4/6]

UncertainHelix ( const double  curvature,
const Vector2D phi0Vec,
const double  impact,
const double  tanLambda,
const double  z0,
const HelixCovariance helixCovariance = HelixUtil::identity(),
const double  chi2 = 0.0,
std::size_t  ndf = 0 
)
inline

Composes an uncertain perigee circle from the perigee parameters and a 3x3 covariance matrix.

Definition at line 73 of file UncertainHelix.h.

81 : m_helix(curvature, phi0Vec, impact, tanLambda, z0)
83 , m_chi2(chi2)
84 , m_ndf(ndf)
85 {
86 }

◆ UncertainHelix() [5/6]

UncertainHelix ( const Helix helix,
const HelixCovariance helixCovariance = HelixUtil::identity(),
const double  chi2 = 0.0,
std::size_t  ndf = 0 
)
inlineexplicit

Augments a plain helix with a covariance matrix. Covariance defaults to zero.

Definition at line 89 of file UncertainHelix.h.

93 : m_helix(helix)
95 , m_chi2(chi2)
96 , m_ndf(ndf)
97 {
98 }
const Helix & helix() const
Getter for the underlying helix.

◆ UncertainHelix() [6/6]

UncertainHelix ( const UncertainPerigeeCircle uncertainPerigeeCircle,
const UncertainSZLine uncertainSZLine 
)
inline

Augments a plain helix with a covariance matrix. Covariance defaults to zero.

Definition at line 101 of file UncertainHelix.h.

103 : m_helix(uncertainPerigeeCircle, uncertainSZLine)
104 , m_helixCovariance(HelixUtil::stackBlocks(uncertainPerigeeCircle.perigeeCovariance(),
106 , m_chi2(uncertainPerigeeCircle.chi2() + uncertainSZLine.chi2())
107 , m_ndf(uncertainPerigeeCircle.ndf() + uncertainSZLine.ndf())
108 {
109 }
UncertainSZLine uncertainSZLine() const
Reduces the helix to an sz line carrying over the relevant parts of the convariance matrix.
const SZCovariance & szCovariance() const
Getter for the whole covariance matrix of the sz line parameters.
double chi2() const
Getter for the chi square value of the line fit.
std::size_t ndf() const
Getter for the number of degrees of freediom used in the line fit.
static HelixUtil::CovarianceMatrix stackBlocks(const PerigeeUtil::CovarianceMatrix &perigeeCov, const SZUtil::CovarianceMatrix &szCov)
Combine covariance matrices from the xy space and the sz space in their respective blocks.

Member Function Documentation

◆ average() [1/4]

UncertainHelix average ( const UncertainHelix fromHelix,
const UncertainHelix toHelix 
)
static

Construct the averages of the two given helices by properly considering their covariance matrix.

Definition at line 23 of file UncertainHelix.cc.

25{
26 HelixParameters fromPar = fromHelix.helixParameters();
27 HelixCovariance fromCov = fromHelix.helixCovariance();
28
29 HelixParameters toPar = toHelix.helixParameters();
30 HelixCovariance toCov = toHelix.helixCovariance();
31
32 HelixParameters avgPar;
33 HelixCovariance avgCov;
34
35 double chi2 = HelixUtil::average(fromPar, fromCov, toPar, toCov, avgPar, avgCov);
36
37 // Calculating 5 parameters from 10 input parameters. 5 NDF remaining.
38 size_t ndf = 5;
39
40 return UncertainHelix(avgPar, avgCov, chi2, ndf);
41}
A matrix implementation to be used as an interface typ through out the track finder.
Definition: PlainMatrix.h:40
UncertainHelix()
Default constructor for ROOT compatibility.
static double average(const HelixUtil::ParameterVector &fromPar, const HelixUtil::CovarianceMatrix &fromCov, const HelixUtil::ParameterVector &toPar, const HelixUtil::CovarianceMatrix &toCov, HelixUtil::ParameterVector &avgPar, HelixUtil::CovarianceMatrix &avgCov)
Calculates the weighted average between two helix parameter sets with their respective covariance mat...

◆ average() [2/4]

static UncertainHelix average ( const UncertainHelix helix,
const UncertainPerigeeCircle perigeeCircle,
const PerigeeHelixAmbiguity ambiguityMatrix 
)
inlinestatic

Construct the average helix including its covariance matrix incoorporating additional information from a stereo projection.

The averaging in the higher dimensional helix parameter space from the lower dimensional projectsions is accomplished by considering the ambiguity matrix of the projection.

Both circle and helix parameters and their covariance matrix are considered to be passed on the same origin. The circle is considered to be fitted in the sz space defined by the given helix.

Parameters
helixSecond perigee circle
perigeeCirclePerigee circle to be incoorporated
ambiguityMatrixAmbiguity matrix of the perigee parameters with respect to the helix parameters

Definition at line 161 of file UncertainHelix.h.

164 {
165 return average(perigeeCircle, ambiguityMatrix, helix);
166 }
static UncertainHelix average(const UncertainHelix &fromHelix, const UncertainHelix &toHelix)
Construct the averages of the two given helices by properly considering their covariance matrix.

◆ average() [3/4]

UncertainHelix average ( const UncertainPerigeeCircle fromPerigeeCircle,
const PerigeeHelixAmbiguity fromAmbiguity,
const UncertainHelix toHelix 
)
static

Construct the average helix including its covariance matrix incoorporating additional information from a stereo projection.

The averaging in the higher dimensional helix parameter space from the lower dimensional projectsions is accomplished by considering the ambiguity matrix of the projection.

Both circle and helix parameters and their covariance matrix are considered to be passed on the same origin. The circle is considered to be fitted in the sz space defined by the given helix.

Parameters
fromPerigeeCirclePerigee circle to be incoorporated
fromAmbiguityAmbiguity matrix of the perigee parameters with respect to the helix parameters
toHelixSecond perigee circle

Definition at line 43 of file UncertainHelix.cc.

46{
47 PerigeeParameters fromPar = fromPerigeeCircle.perigeeParameters();
48 PerigeeCovariance fromCov = fromPerigeeCircle.perigeeCovariance();
49
50 HelixParameters toPar = toHelix.helixParameters();
51 HelixCovariance toCov = toHelix.helixCovariance();
52
53 HelixParameters avgPar;
54 HelixCovariance avgCov;
55
56 double chi2 = HelixUtil::average(fromPar, fromCov, fromAmbiguity, toPar, toCov, avgPar, avgCov);
57
58 // Calculating 5 parameters from 8 input parameters. 3 NDF remaining.
59 size_t ndf = 3;
60
61 return UncertainHelix(avgPar, avgCov, chi2, ndf);
62}
PerigeeParameters perigeeParameters() const
Getter for the perigee parameters in the order defined by EPerigeeParameter.h.
const PerigeeCovariance & perigeeCovariance() const
Getter for the whole covariance matrix of the perigee parameters.

◆ average() [4/4]

UncertainHelix average ( const UncertainPerigeeCircle fromPerigeeCircle,
const PerigeeHelixAmbiguity fromAmbiguity,
const UncertainPerigeeCircle toPerigeeCircle,
const PerigeeHelixAmbiguity toAmbiguity,
const SZParameters szParameters 
)
static

Construct the average helix including its covariance matrix from two different stereo angle projections.

The averaging in the higher dimensional helix parameter space from the lower dimensional projections is accomplished by considering the ambiguity matrix of the projections. The average only succeeds when the projections are not parallel two each other which is generally the case for two different super layers of different stereo kind.

Both circle and helix parameters and their covariance matrix are considered to be passed on the same origin.

Parameters
fromPerigeeCircleFirst perigee circle
fromAmbiguityAmbiguity matrix of the first perigee parameters with respect to the helix parameters
toPerigeeCircleSecond perigee circle
toAmbiguityAmbiguity matrix of the second perigee parameters with respect to the helix parameters
szParametersReference sz parameters where the perigee circles have been fitted.

Definition at line 64 of file UncertainHelix.cc.

69{
70 const PerigeeParameters& fromPar = fromPerigeeCircle.perigeeParameters();
71 const PerigeeCovariance& fromCov = fromPerigeeCircle.perigeeCovariance();
72
73 const PerigeeParameters& toPar = toPerigeeCircle.perigeeParameters();
74 const PerigeeCovariance& toCov = toPerigeeCircle.perigeeCovariance();
75
76 HelixParameters avgPar;
77 HelixCovariance avgCov;
78
79 double chi2 = HelixUtil::average(fromPar,
80 fromCov,
81 fromAmbiguity,
82 toPar,
83 toCov,
84 toAmbiguity,
85 szParameters,
86 avgPar,
87 avgCov);
88
89 // Calculating 5 parameters from 6 input parameters. 1 NDF remaining.
90 size_t ndf = 1;
91
92 return UncertainHelix(avgPar, avgCov, chi2, ndf);
93}

◆ chi2()

double chi2 ( ) const
inline

Getter for the chi square value of the helix fit.

Definition at line 263 of file UncertainHelix.h.

264 {
265 return m_chi2;
266 }

◆ covariance()

double covariance ( const EHelixParameter iRow,
const EHelixParameter iCol 
) const
inline

Getter for individual elements of the covariance matrix.

Definition at line 251 of file UncertainHelix.h.

252 {
253 return helixCovariance()(iRow, iCol);
254 }

◆ helix()

const Helix & helix ( ) const
inline

Getter for the underlying helix.

Definition at line 211 of file UncertainHelix.h.

212 {
213 return m_helix;
214 }

◆ helixCovariance()

const HelixCovariance & helixCovariance ( ) const
inline

Getter for the whole covariance matrix of the perigee parameters.

Definition at line 245 of file UncertainHelix.h.

246 {
247 return m_helixCovariance;
248 }

◆ helixParameters()

HelixParameters helixParameters ( ) const
inline

Getter for the perigee parameters in the order defined by EPerigeeParameter.h.

Definition at line 217 of file UncertainHelix.h.

218 {
219 return m_helix.helixParameters();
220 }
HelixParameters helixParameters() const
Getter for the five helix parameters in the order defined by EHelixParameter.h.
Definition: Helix.h:307

◆ invalidate()

void invalidate ( )
inline

Sets all circle parameters to zero and the covariance matrix to something noninformative.

Definition at line 287 of file UncertainHelix.h.

288 {
291 m_chi2 = 0.0;
292 m_ndf = 0;
293 }
void invalidate()
Sets all circle parameters to zero.
Definition: Helix.h:67

◆ ndf()

std::size_t ndf ( ) const
inline

Getter for the number of degrees of freediom used in the helix fit.

Definition at line 275 of file UncertainHelix.h.

276 {
277 return m_ndf;
278 }

◆ operator const Helix &()

operator const Helix & ( ) const
inline

Downcast to the "super" class.

Definition at line 205 of file UncertainHelix.h.

206 {
207 return m_helix;
208 }

◆ operator->()

const Helix * operator-> ( ) const
inline

Access to the constant interface of the underlying parameter line Allows the user of this "super" class to use the getters and other methods to get inforamation about the line but disallows mutation of internal state.

This ensures that the parameters are not changed without proper adjustment to the covariance matrix in this class, which can be achieved by the more limited set of methods in this class accessable by normal . method calls

Definition at line 199 of file UncertainHelix.h.

200 {
201 return &m_helix;
202 }

◆ passiveMoveBy()

void passiveMoveBy ( const Vector3D by)
inline

Moves the coordinate system by the vector by and calculates the new perigee and its covariance matrix.

Change is inplace.

Definition at line 315 of file UncertainHelix.h.

316 {
317 // Move the covariance matrix first to have access to the original parameters
318 HelixJacobian jacobian = m_helix.passiveMoveByJacobian(by);
321 }
double passiveMoveBy(const Vector3D &by)
Moves the coordinates system by the given vector.
Definition: Helix.h:147
HelixJacobian passiveMoveByJacobian(const Vector3D &by) const
Computes the Jacobi matrix for a move of the coordinate system by the given vector.
Definition: Helix.cc:90
static void transport(const JacobianMatrix &jacobian, CovarianceMatrix &cov)
Transport the covariance matrix inplace with the given jacobian matrix.

◆ reverse()

void reverse ( )
inline

Flips the orientation of the circle in place.

Definition at line 297 of file UncertainHelix.h.

298 {
301 }
void reverse()
Flips the travel direction of the helix in place, pivot point is unchanged.
Definition: Helix.h:80
static void reverse(CovarianceMatrix &cov)
Reverse the covariance matrix inplace.

◆ reversed()

UncertainHelix reversed ( ) const
inline

Returns a copy of the circle with opposite orientation.

Definition at line 304 of file UncertainHelix.h.

305 {
308 chi2(),
309 ndf());
310 }
Helix reversed() const
Returns a copy of the helix with flips the travel direction, pivot point is the same.
Definition: Helix.h:87
static CovarianceMatrix reversed(const CovarianceMatrix &cov)
Return a copy of the reversed covariance matrix.

◆ setChi2()

void setChi2 ( const double  chi2)
inline

Setter for the chi square value of the helix fit.

Definition at line 269 of file UncertainHelix.h.

270 {
271 m_chi2 = chi2;
272 }

◆ setHelixCovariance()

void setHelixCovariance ( const HelixCovariance helixCovariance)
inline

Setter for the whole covariance matrix of the perigee parameters.

Definition at line 239 of file UncertainHelix.h.

240 {
242 }

◆ setNDF()

void setNDF ( std::size_t  ndf)
inline

Setter for the number of degrees of freediom used in the helix fit.

Definition at line 281 of file UncertainHelix.h.

282 {
283 m_ndf = ndf;
284 }

◆ shiftPeriod()

double shiftPeriod ( int  nPeriods)
inline

Adjust the arclength measure to start n periods later.

Returns
The arc length needed to travel n periods.

Definition at line 327 of file UncertainHelix.h.

328 {
329 double arcLength2D = m_helix.shiftPeriod(nPeriods);
330 SZJacobian szJacobian = m_helix.szLine().passiveMoveByJacobian(Vector2D(arcLength2D, 0));
331 PerigeeJacobian perigeeJacobian = PerigeeUtil::identity();
332 HelixJacobian jacobian = HelixUtil::stackBlocks(perigeeJacobian, szJacobian);
334 return arcLength2D;
335 }
double shiftPeriod(int nPeriods)
Adjust the arclength measure to start n periods later.
Definition: Helix.h:165
const SZLine & szLine() const
Getter for the projection into xy space.
Definition: Helix.h:326
SZJacobian passiveMoveByJacobian(const Vector2D &bySZ) const
Computes the Jacobi matrix for a move of the coordinate system by the given vector.
Definition: SZLine.h:208

◆ uncertainCircleXY()

UncertainPerigeeCircle uncertainCircleXY ( ) const
inline

Projects the helix into the xy plain carrying over the relevant parts of the convariance matrix.

Definition at line 225 of file UncertainHelix.h.

226 {
227 return UncertainPerigeeCircle(helix().circleXY(),
229 }
static PerigeeUtil::CovarianceMatrix getPerigeeCovariance(const CovarianceMatrix &helixCov)
Get perigee covariance matrix related to the xy space.

◆ uncertainSZLine()

UncertainSZLine uncertainSZLine ( ) const
inline

Reduces the helix to an sz line carrying over the relevant parts of the convariance matrix.

Definition at line 233 of file UncertainHelix.h.

234 {
235 return UncertainSZLine(helix().szLine(), HelixUtil::getSZCovariance(helixCovariance()));
236 }
static SZUtil::CovarianceMatrix getSZCovariance(const CovarianceMatrix &helixCov)
Get sz covariance matrix.

◆ variance()

double variance ( const EHelixParameter i) const
inline

Getter for individual diagonal elements of the covariance matrix.

Definition at line 257 of file UncertainHelix.h.

258 {
259 return helixCovariance()(i, i);
260 }

Member Data Documentation

◆ m_chi2

double m_chi2 = 0.0
private

Memory for the chi square value of the fit of this helix.

Definition at line 345 of file UncertainHelix.h.

◆ m_helix

Helix m_helix
private

Memory for the underlying helix.

Definition at line 339 of file UncertainHelix.h.

◆ m_helixCovariance

HelixCovariance m_helixCovariance = HelixUtil::identity()
private

Memory for the 5x5 covariance matrix of the helix parameters.

Definition at line 342 of file UncertainHelix.h.

◆ m_ndf

size_t m_ndf = 0.0
private

Memory for the number of degrees of freedom of the fit of this helix.

Definition at line 348 of file UncertainHelix.h.


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