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/trackFindingCDC/geometry/LineParameters.h>
11#include <tracking/trackFindingCDC/geometry/ParameterLine2D.h>
12#include <tracking/trackFindingCDC/geometry/Vector2D.h>
13#include <cstddef>
14
15namespace Belle2 {
20 namespace TrackFindingCDC {
21
25
26 public:
29 {
30 }
31
33 explicit UncertainParameterLine2D(const ParameterLine2D& parameterLine2D,
35 const double chi2 = 0.0,
36 const size_t ndf = 0)
37 : m_parameterLine2D(parameterLine2D)
39 , m_chi2(chi2)
40 , m_ndf(ndf)
41 {
42 }
43
54 {
55 return &m_parameterLine2D;
56 }
57
59 operator ParameterLine2D() const
60 {
61 return m_parameterLine2D;
62 }
63
64 public:
67 {
68 using namespace NLineParameterIndices;
69 LineParameters result;
70 result(c_Phi0) = m_parameterLine2D.tangential().phi();
71 result(c_I) = 0;
72 return result;
73 }
74
77 {
79 }
80
83 {
84 return m_lineCovariance;
85 }
86
88 double covariance(const ELineParameter& iRow, const ELineParameter& iCol) const
89 {
90 return lineCovariance()(iRow, iCol);
91 }
92
94 double variance(const ELineParameter& i) const
95 {
96 return lineCovariance()(i, i);
97 }
98
100 double chi2() const
101 {
102 return m_chi2;
103 }
104
106 void setChi2(const double chi2)
107 {
108 m_chi2 = chi2;
109 }
110
112 std::size_t ndf() const
113 {
114 return m_ndf;
115 }
116
118 void setNDF(std::size_t ndf)
119 {
120 m_ndf = ndf;
121 }
122
125 {
128 m_chi2 = 0.0;
129 m_ndf = 0;
130 }
131
132 public:
134 void reverse()
135 {
138 }
139
142 {
145 m_chi2,
146 m_ndf);
147 }
148
149 public:
155 void passiveMoveBy(const Vector2D& by)
156 {
158 }
159
162 {
163 using namespace NLineParameterIndices;
165 result(c_I, c_Phi0) = -byAt * m_parameterLine2D.tangential().norm();
166 return result;
167 }
168
171 void moveSupportBy(double byAt)
172 {
173 // Move the covariance matrix first to have access to the original parameters
174 LineJacobian jacobian = moveSupportByJacobian(byAt);
177 }
178
181 {
182 LineJacobian jacobian = moveSupportByJacobian(byAt);
183 return LineUtil::transported(jacobian, lineCovariance());
184 }
185
186 private:
189
193
195 double m_chi2 = 0.0;
196
198 size_t m_ndf = 0;
199
200 };
201
202 }
204}
A line with a support point and tangential vector.
void reverse()
Reverses the tangential vector inplace.
void passiveMoveBy(const Vector2D &by)
Moves the coordinate system in the given direction in place.
void passiveMoveAtBy(const double delta)
Moves the support point by the given amount of the parameter in the forward direction.
void invalidate()
Clear all information from the line.
ParameterLine2D reversed() const
Makes a copy line which has the opposite tangential vector but same support point.
const Vector2D & tangential() const
Gives the tangential vector of the line.
A matrix implementation to be used as an interface typ through out the track finder.
Definition: PlainMatrix.h:40
A parameter line including including an line covariance matrix which is interpreted as located in the...
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.
void passiveMoveBy(const Vector2D &by)
Moves the coordinate system by the vector by.
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 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...
A two dimensional vector which is equipped with functions for correct handeling of orientation relat...
Definition: Vector2D.h:32
double phi() const
Gives the azimuth angle being the angle to the x axes ( range -M_PI to M_PI )
Definition: Vector2D.h:569
double norm() const
Calculates the length of the vector.
Definition: Vector2D.h:175
ELineParameter
Enumeration to address the individual helix parameters in a vector or matrix.
Abstract base class for different kinds of events.
static CovarianceMatrix transported(const JacobianMatrix &jacobian, const CovarianceMatrix &cov)
Return a copy of the covariance matrix transported with the given jacobian matrix.
static void transport(const JacobianMatrix &jacobian, CovarianceMatrix &cov)
Transport the covariance matrix inplace with the given jacobian matrix.
static void reverse(CovarianceMatrix &cov)
Reverse the covariance matrix inplace.
static CovarianceMatrix reversed(const CovarianceMatrix &cov)
Return a copy of the reversed covariance matrix.