Belle II Software development
UncertainParameterLine2D.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#pragma once
9
10#include <tracking/trackingUtilities/geometry/LineParameters.h>
11#include <tracking/trackingUtilities/geometry/ParameterLine2D.h>
12
13#include <Math/Vector2D.h>
14
15#include <cstddef>
16
17namespace Belle2 {
22 namespace TrackingUtilities {
23
27
28 public:
33
35 explicit UncertainParameterLine2D(const ParameterLine2D& parameterLine2D,
36 const LineCovariance& lineCovariance = LineUtil::identity(),
37 const double chi2 = 0.0,
38 const size_t ndf = 0)
39 : m_parameterLine2D(parameterLine2D)
41 , m_chi2(chi2)
42 , m_ndf(ndf)
43 {
44 }
45
56 {
57 return &m_parameterLine2D;
58 }
59
61 operator ParameterLine2D() const
62 {
63 return m_parameterLine2D;
64 }
65
66 public:
68 LineParameters lineParameters() const
69 {
70 using namespace NLineParameterIndices;
71 LineParameters result;
72 result(c_Phi0) = m_parameterLine2D.tangential().Phi();
73 result(c_I) = 0;
74 return result;
75 }
76
78 void setLineCovariance(const LineCovariance& lineCovariance)
79 {
81 }
82
84 const LineCovariance& lineCovariance() const
85 {
86 return m_lineCovariance;
87 }
88
90 double covariance(const ELineParameter& iRow, const ELineParameter& iCol) const
91 {
92 return lineCovariance()(iRow, iCol);
93 }
94
96 double variance(const ELineParameter& i) const
97 {
98 return lineCovariance()(i, i);
99 }
100
102 double chi2() const
103 {
104 return m_chi2;
105 }
106
108 void setChi2(const double chi2)
109 {
110 m_chi2 = chi2;
111 }
112
114 std::size_t ndf() const
115 {
116 return m_ndf;
117 }
118
120 void setNDF(std::size_t ndf)
121 {
122 m_ndf = ndf;
123 }
124
127 {
128 m_parameterLine2D.invalidate();
130 m_chi2 = 0.0;
131 m_ndf = 0;
132 }
133
134 public:
136 void reverse()
137 {
138 m_parameterLine2D.reverse();
140 }
141
150
151 public:
157 void passiveMoveBy(const ROOT::Math::XYVector& by)
158 {
159 m_parameterLine2D.passiveMoveBy(by);
160 }
161
163 LineJacobian moveSupportByJacobian(double byAt) const
164 {
165 using namespace NLineParameterIndices;
166 LineJacobian result = LineUtil::identity();
167 result(c_I, c_Phi0) = -byAt * m_parameterLine2D.tangential().R();
168 return result;
169 }
170
173 void moveSupportBy(double byAt)
174 {
175 // Move the covariance matrix first to have access to the original parameters
176 LineJacobian jacobian = moveSupportByJacobian(byAt);
178 m_parameterLine2D.passiveMoveAtBy(byAt);
179 }
180
182 LineCovariance movedSupportCovarianceBy(double byAt) const
183 {
184 LineJacobian jacobian = moveSupportByJacobian(byAt);
185 return LineUtil::transported(jacobian, lineCovariance());
186 }
187
188 private:
191
195
197 double m_chi2 = 0.0;
198
200 size_t m_ndf = 0;
201
202 };
203
204 }
206}
A line with a support point and tangential vector.
double variance(const ELineParameter &i) const
Getter for individual diagonal elements of the covariance matrix.
UncertainParameterLine2D(const ParameterLine2D &parameterLine2D, const LineCovariance &lineCovariance=LineUtil::identity(), const double chi2=0.0, const size_t ndf=0)
Attaching a covariance matrix to a parameter line.
const LineCovariance & lineCovariance() const
Getter for the whole covariance matrix of the line parameters.
void reverse()
Reverses the direction of flight represented by this line.
UncertainParameterLine2D reversed() const
Returns a copy of the line corresponding to the reverse direction of travel.
LineCovariance movedSupportCovarianceBy(double byAt) const
Getter for the covariance as if he coordinate system was moved by the given vector.
void setLineCovariance(const LineCovariance &lineCovariance)
Setter for the whole covariance matrix of the line parameters.
UncertainParameterLine2D()
Default constructor for ROOT compatibility.
ParameterLine2D m_parameterLine2D
Memory for the underlying parameter line.
LineCovariance m_lineCovariance
Memory for the 2x2 covariance matrix of the line phi0 and impact parameter relative to the support po...
double m_chi2
Memory for the chi square value of the fit of this line.
void invalidate()
Sets all line parameters to zero including the covariance matrix.
void passiveMoveBy(const ROOT::Math::XYVector &by)
Moves the coordinate system by the vector by.
void moveSupportBy(double byAt)
Moves the coordinate system by the vector by and calculates the new line and its covariance matrix.
double chi2() const
Getter for the chi square value of the line fit.
void setNDF(std::size_t ndf)
Setter for the number of degrees of freediom used in the line fit.
size_t m_ndf
Memory for the number of degrees of freedim of the fit of this line.
LineJacobian moveSupportByJacobian(double byAt) const
Computes the Jacobi matrix for a move of the coordinate system by the given vector.
void setChi2(const double chi2)
Setter for the chi square value of the line fit.
double covariance(const ELineParameter &iRow, const ELineParameter &iCol) const
Getter for individual elements of the covariance matrix.
std::size_t ndf() const
Getter for the number of degrees of freediom used in the line fit.
LineParameters lineParameters() const
Getter for the three perigee parameters in the order defined by EPerigeeParameter....
const ParameterLine2D * operator->() const
Access to the constant interface of the underlying parameter line Allows the user of this "super" cla...
Namespace to hide the contained enum constants.
Abstract base class for different kinds of events.
static CovarianceMatrix transported(const JacobianMatrix &jacobian, const CovarianceMatrix &cov)
static void transport(const JacobianMatrix &jacobian, CovarianceMatrix &cov)