Belle II Software development
UncertainSZLine.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/SZLine.h>
11
12#include <tracking/trackFindingCDC/geometry/SZParameters.h>
13
14#include <cstddef>
15#include <iosfwd>
16
17namespace Belle2 {
22
23 namespace TrackFindingCDC {
24 class Vector2D;
25
29
30 public:
33 {
34 }
35
38 UncertainSZLine(const double tanLambda,
39 const double z0,
40 const SZCovariance& szCovariance = SZUtil::identity(),
41 const double chi2 = 0.0,
42 const size_t ndf = 0)
43 : m_szLine(tanLambda, z0)
45 , m_chi2(chi2)
46 , m_ndf(ndf)
47 {
48 }
49
52 explicit UncertainSZLine(const SZParameters szParameters,
53 const SZCovariance& szCovariance = SZUtil::identity(),
54 const double chi2 = 0.0,
55 const size_t ndf = 0)
58 , m_chi2(chi2)
59 , m_ndf(ndf)
60 {
61 }
62
65 explicit UncertainSZLine(const SZLine& szLine,
66 const SZCovariance& szCovariance = SZUtil::identity(),
67 const double chi2 = 0.0,
68 const size_t ndf = 0)
71 , m_chi2(chi2)
72 , m_ndf(ndf)
73 {
74 }
75
85 const SZLine* operator->() const
86 {
87 return &m_szLine;
88 }
89
91 operator const SZLine& () const
92 {
93 return m_szLine;
94 }
95
97 const SZLine& szLine() const
98 {
99 return m_szLine;
100 }
101
103 SZParameters szParameters() const
104 {
105 return m_szLine.szParameters();
106 }
107
108 public:
110 void setSZCovariance(const SZCovariance& szCovariance)
111 {
113 }
114
116 const SZCovariance& szCovariance() const
117 {
118 return m_szCovariance;
119 }
120
122 double covariance(const ESZParameter& iRow, const ESZParameter& iCol) const
123 {
124 return szCovariance()(iRow, iCol);
125 }
126
128 double variance(const ESZParameter& i) const
129 {
130 return szCovariance()(i, i);
131 }
132
134 double chi2() const
135 {
136 return m_chi2;
137 }
138
140 void setChi2(const double chi2)
141 {
142 m_chi2 = chi2;
143 }
144
146 std::size_t ndf() const
147 {
148 return m_ndf;
149 }
150
152 void setNDF(std::size_t ndf)
153 {
154 m_ndf = ndf;
155 }
156
159 {
160 m_szLine.invalidate();
162 m_chi2 = 0.0;
163 m_ndf = 0;
164 }
165
166 public:
168 void reverse()
169 {
170 m_szLine.reverse();
172 }
173
176 {
177 return UncertainSZLine(m_szLine.reversed(), SZUtil::reversed(szCovariance()), chi2(), ndf());
178 }
179
180 public:
183 void passiveMoveBy(const Vector2D& bySZ)
184 {
185 // Move the covariance matrix first to have access to the original parameters
186 SZJacobian jacobian = m_szLine.passiveMoveByJacobian(bySZ);
188 m_szLine.passiveMoveBy(bySZ);
189 }
190
196 SZCovariance passiveMovedCovarianceBy(const Vector2D& bySZ) const
197 {
198 SZJacobian jacobian = m_szLine.passiveMoveByJacobian(bySZ);
199 return SZUtil::transported(jacobian, szCovariance());
200 }
201
202 private:
205
208
210 double m_chi2 = 0.0;
211
213 size_t m_ndf = 0;
214 };
215
217 std::ostream& operator<<(std::ostream& output, const UncertainSZLine& uncertainSZLine);
218 }
220}
A line in the sz space.
Definition SZLine.h:26
A line in sz where s is the transverse travel distance as seen in the xy projection with uncertaintie...
void setSZCovariance(const SZCovariance &szCovariance)
Setter for the whole covariance matrix of the sz line parameters.
SZCovariance m_szCovariance
Memory for the 2x2 covariance matrix of sz slope (aka tan lambda) and z0.
UncertainSZLine(const SZLine &szLine, const SZCovariance &szCovariance=SZUtil::identity(), const double chi2=0.0, const size_t ndf=0)
Augments a plain two dimensional line with a covariance matrix.
const SZLine * operator->() const
Access to the constant interface of the underlying parameter line Allows the user of this "super" cla...
double variance(const ESZParameter &i) const
Getter for individual diagonal elements of the covariance matrix.
SZParameters szParameters() const
Getter for the sz parameters in the order defined by ESZParameter.h.
void reverse()
Reverses the direction of flight represented by this sz line.
SZCovariance passiveMovedCovarianceBy(const Vector2D &bySZ) const
Calculates the jacobian matrix that is needed for the translation of the parameter covariance for a p...
UncertainSZLine(const double tanLambda, const double z0, const SZCovariance &szCovariance=SZUtil::identity(), const double chi2=0.0, const size_t ndf=0)
Composes an uncertain sz line from the perigee parameters and a 2x2 covariance matrix.
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 Vector2D &bySZ)
Moves the coordinate system by the vector by and calculates the new sz line and its covariance 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.
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.
UncertainSZLine(const SZParameters szParameters, const SZCovariance &szCovariance=SZUtil::identity(), const double chi2=0.0, const size_t ndf=0)
Composes an uncertain sz line from the perigee parameters and a 2x2 covariance matrix.
SZLine m_szLine
Memory for the underlying line.
void setChi2(const double chi2)
Setter for the chi square value of the line fit.
UncertainSZLine reversed() const
Returns a copy of the line corresponding to the reverse direction of travel.
double covariance(const ESZParameter &iRow, const ESZParameter &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.
UncertainSZLine()
Default constructor for ROOT compatibility.
const SZLine & szLine() const
Getter for the underlying sz line.
A two dimensional vector which is equipped with functions for correct handling of orientation relate...
Definition Vector2D.h:32
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)