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 ROOT::Math::XYVector &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 information 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 ROOT::Math::XYZVector &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 35 of file UncertainHelix.h.

Constructor & Destructor Documentation

◆ UncertainHelix() [1/6]

UncertainHelix ( )
inline

Default constructor for ROOT compatibility.

Definition at line 39 of file UncertainHelix.h.

40 {
41 }

◆ 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 45 of file UncertainHelix.h.

53 : m_helix(curvature, phi0, impact, tanLambda, z0)
54 , m_helixCovariance(helixCovariance)
55 , m_chi2(chi2)
56 , m_ndf(ndf)
57 {
58 }

◆ 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 61 of file UncertainHelix.h.

65 : m_helix(parameters)
66 , m_helixCovariance(helixCovariance)
67 , m_chi2(chi2)
68 , m_ndf(ndf)
69 {
70 }

◆ UncertainHelix() [4/6]

UncertainHelix ( const double curvature,
const ROOT::Math::XYVector & 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 74 of file UncertainHelix.h.

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

◆ 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 90 of file UncertainHelix.h.

94 : m_helix(helix)
95 , m_helixCovariance(helixCovariance)
96 , m_chi2(chi2)
97 , m_ndf(ndf)
98 {
99 }

◆ 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 102 of file UncertainHelix.h.

104 : m_helix(uncertainPerigeeCircle, uncertainSZLine)
105 , m_helixCovariance(HelixUtil::stackBlocks(uncertainPerigeeCircle.perigeeCovariance(),
106 uncertainSZLine.szCovariance()))
107 , m_chi2(uncertainPerigeeCircle.chi2() + uncertainSZLine.chi2())
108 , m_ndf(uncertainPerigeeCircle.ndf() + uncertainSZLine.ndf())
109 {
110 }

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 loc_chi2 = HelixUtil::average(fromPar, fromCov, toPar, toCov, avgPar, avgCov);
36
37 // Calculating 5 parameters from 10 input parameters. 5 NDF remaining.
38 size_t loc_ndf = 5;
39
40 return UncertainHelix(avgPar, avgCov, loc_chi2, loc_ndf);
41}
UncertainHelix()
Default constructor initialising all members to zero.
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 162 of file UncertainHelix.h.

165 {
166 return average(perigeeCircle, ambiguityMatrix, helix);
167 }

◆ 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 incorporated
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}
double chi2() const
Getter 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.
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 264 of file UncertainHelix.h.

265 {
266 return m_chi2;
267 }

◆ covariance()

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

Getter for individual elements of the covariance matrix.

Definition at line 252 of file UncertainHelix.h.

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

◆ helix()

const Helix & helix ( ) const
inline

Getter for the underlying helix.

Definition at line 212 of file UncertainHelix.h.

213 {
214 return m_helix;
215 }

◆ helixCovariance()

const HelixCovariance & helixCovariance ( ) const
inline

Getter for the whole covariance matrix of the perigee parameters.

Definition at line 246 of file UncertainHelix.h.

247 {
248 return m_helixCovariance;
249 }

◆ helixParameters()

HelixParameters helixParameters ( ) const
inline

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

Definition at line 218 of file UncertainHelix.h.

219 {
220 return m_helix.helixParameters();
221 }

◆ invalidate()

void invalidate ( )
inline

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

Definition at line 288 of file UncertainHelix.h.

289 {
290 m_helix.invalidate();
291 m_helixCovariance = HelixUtil::identity();
292 m_chi2 = 0.0;
293 m_ndf = 0;
294 }

◆ ndf()

std::size_t ndf ( ) const
inline

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

Definition at line 276 of file UncertainHelix.h.

277 {
278 return m_ndf;
279 }

◆ operator const Helix &()

operator const Helix & ( ) const
inline

Downcast to the "super" class.

Definition at line 206 of file UncertainHelix.h.

207 {
208 return m_helix;
209 }

◆ 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 information 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 accessible by normal . method calls

Definition at line 200 of file UncertainHelix.h.

201 {
202 return &m_helix;
203 }

◆ passiveMoveBy()

void passiveMoveBy ( const ROOT::Math::XYZVector & 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 316 of file UncertainHelix.h.

317 {
318 // Move the covariance matrix first to have access to the original parameters
319 HelixJacobian jacobian = m_helix.passiveMoveByJacobian(by);
320 HelixUtil::transport(jacobian, m_helixCovariance);
321 m_helix.passiveMoveBy(by);
322 }

◆ reverse()

void reverse ( )
inline

Flips the orientation of the circle in place.

Definition at line 298 of file UncertainHelix.h.

299 {
300 m_helix.reverse();
301 HelixUtil::reverse(m_helixCovariance);
302 }

◆ reversed()

UncertainHelix reversed ( ) const
inline

Returns a copy of the circle with opposite orientation.

Definition at line 305 of file UncertainHelix.h.

306 {
307 return UncertainHelix(m_helix.reversed(),
308 HelixUtil::reversed(m_helixCovariance),
309 chi2(),
310 ndf());
311 }

◆ setChi2()

void setChi2 ( const double chi2)
inline

Setter for the chi square value of the helix fit.

Definition at line 270 of file UncertainHelix.h.

271 {
272 m_chi2 = chi2;
273 }

◆ setHelixCovariance()

void setHelixCovariance ( const HelixCovariance & helixCovariance)
inline

Setter for the whole covariance matrix of the perigee parameters.

Definition at line 240 of file UncertainHelix.h.

241 {
242 m_helixCovariance = helixCovariance;
243 }

◆ setNDF()

void setNDF ( std::size_t ndf)
inline

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

Definition at line 282 of file UncertainHelix.h.

283 {
284 m_ndf = ndf;
285 }

◆ 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 328 of file UncertainHelix.h.

329 {
330 double arcLength2D = m_helix.shiftPeriod(nPeriods);
331 SZJacobian szJacobian = m_helix.szLine().passiveMoveByJacobian(ROOT::Math::XYVector(arcLength2D, 0));
332 PerigeeJacobian perigeeJacobian = PerigeeUtil::identity();
333 HelixJacobian jacobian = HelixUtil::stackBlocks(perigeeJacobian, szJacobian);
334 HelixUtil::transport(jacobian, m_helixCovariance);
335 return arcLength2D;
336 }

◆ uncertainCircleXY()

UncertainPerigeeCircle uncertainCircleXY ( ) const
inline

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

Definition at line 226 of file UncertainHelix.h.

227 {
228 return UncertainPerigeeCircle(helix().circleXY(),
229 HelixUtil::getPerigeeCovariance(helixCovariance()));
230 }

◆ uncertainSZLine()

UncertainSZLine uncertainSZLine ( ) const
inline

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

Definition at line 234 of file UncertainHelix.h.

235 {
236 return UncertainSZLine(helix().szLine(), HelixUtil::getSZCovariance(helixCovariance()));
237 }

◆ variance()

double variance ( const EHelixParameter & i) const
inline

Getter for individual diagonal elements of the covariance matrix.

Definition at line 258 of file UncertainHelix.h.

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

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 346 of file UncertainHelix.h.

◆ m_helix

Helix m_helix
private

Memory for the underlying helix.

Definition at line 340 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 343 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 349 of file UncertainHelix.h.


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