Belle II Software development
UncertainPerigeeCircle.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/PerigeeCircle.h>
11#include <tracking/trackingUtilities/geometry/PerigeeParameters.h>
12
13#include <Math/Vector2D.h>
14
15#include <cstddef>
16#include <iosfwd>
17
18namespace Belle2 {
23
24 namespace TrackingUtilities {
26
31
32 public:
37
43 UncertainPerigeeCircle(const double curvature,
44 const double phi0Vec,
45 const double impact,
46 const PerigeeCovariance& perigeeCovariance = PerigeeUtil::identity(),
47 const double chi2 = 0.0,
48 std::size_t ndf = 0)
49 : m_perigeeCircle(curvature, phi0Vec, impact)
51 , m_chi2(chi2)
52 , m_ndf(ndf)
53 {
54 }
55
61 UncertainPerigeeCircle(const double curvature,
62 const ROOT::Math::XYVector& phi0,
63 const double impact,
64 const PerigeeCovariance& perigeeCovariance = PerigeeUtil::identity(),
65 const double chi2 = 0.0,
66 std::size_t ndf = 0)
67 : m_perigeeCircle(curvature, phi0, impact)
69 , m_chi2(chi2)
70 , m_ndf(ndf)
71 {
72 }
73
76 const PerigeeCovariance& perigeeCovariance = PerigeeUtil::identity(),
77 const double chi2 = 0.0,
78 std::size_t ndf = 0)
81 , m_chi2(chi2)
82 , m_ndf(ndf)
83 {
84 }
85
87 explicit UncertainPerigeeCircle(const GeneralizedCircle& generalizedCircle,
88 const PerigeeCovariance& perigeeCovariance = PerigeeUtil::identity(),
89 const double chi2 = 0.0,
90 std::size_t ndf = 0)
91 : m_perigeeCircle(generalizedCircle)
93 , m_chi2(chi2)
94 , m_ndf(ndf)
95 {
96 }
97
100 const PerigeeParameters& parameters,
101 const PerigeeCovariance& perigeeCovariance = PerigeeUtil::identity(),
102 const double chi2 = 0.0,
103 std::size_t ndf = 0)
104 : m_perigeeCircle(parameters)
106 , m_chi2(chi2)
107 , m_ndf(ndf)
108 {
109 }
110
113 static UncertainPerigeeCircle average(const UncertainPerigeeCircle& fromPerigeeCircle,
114 const UncertainPerigeeCircle& toPerigeeCircle);
115
116 public:
127 {
128 return &m_perigeeCircle;
129 }
130
132 operator const PerigeeCircle& () const
133 {
134 return m_perigeeCircle;
135 }
136
139 {
140 return m_perigeeCircle;
141 }
142
144 PerigeeParameters perigeeParameters() const
145 {
146 return m_perigeeCircle.perigeeParameters();
147 }
148
149 public:
151 void setPerigeeCovariance(const PerigeeCovariance& perigeeCovariance)
152 {
154 }
155
157 const PerigeeCovariance& perigeeCovariance() const
158 {
159 return m_perigeeCovariance;
160 }
161
163 double covariance(const EPerigeeParameter& iRow, const EPerigeeParameter& iCol) const
164 {
165 return perigeeCovariance()(iRow, iCol);
166 }
167
169 double variance(const EPerigeeParameter& i) const
170 {
171 return perigeeCovariance()(i, i);
172 }
173
175 double chi2() const
176 {
177 return m_chi2;
178 }
179
181 void setChi2(const double chi2)
182 {
183 m_chi2 = chi2;
184 }
185
187 std::size_t ndf() const
188 {
189 return m_ndf;
190 }
191
193 void setNDF(std::size_t ndf)
194 {
195 m_ndf = ndf;
196 }
197
200 {
201 m_perigeeCircle.invalidate();
203 m_chi2 = 0.0;
204 }
205
206 public:
208 void reverse()
209 {
210 m_perigeeCircle.reverse();
212 }
213
222
223 public:
229 void passiveMoveBy(const ROOT::Math::XYVector& by)
230 {
231 // Move the covariance matrix first to have access to the original parameters
232 PerigeeJacobian jacobian = m_perigeeCircle.passiveMoveByJacobian(by);
234 m_perigeeCircle.passiveMoveBy(by);
235 }
236
242 PerigeeCovariance passiveMovedCovarianceBy(const ROOT::Math::XYVector& by) const
243 {
244 PerigeeJacobian jacobian = m_perigeeCircle.passiveMoveByJacobian(by);
246 }
247
248 private:
251
254
256 double m_chi2 = 0.0;
257
259 size_t m_ndf = 0.0;
260
261 };
262
264 std::ostream& operator<<(std::ostream& output, const UncertainPerigeeCircle& circle);
265 }
267}
Extension of the generalized circle also caching the perigee coordinates.
Adds an uncertainty matrix to the circle in perigee parameterisation.
UncertainPerigeeCircle(const double curvature, const ROOT::Math::XYVector &phi0, const double impact, const PerigeeCovariance &perigeeCovariance=PerigeeUtil::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.
const PerigeeCircle & perigeeCircle() const
Getter for the underlying circle.
UncertainPerigeeCircle()
Default constructor for ROOT compatibility.
double covariance(const EPerigeeParameter &iRow, const EPerigeeParameter &iCol) const
Getter for individual elements of the covariance matrix.
UncertainPerigeeCircle(const GeneralizedCircle &generalizedCircle, const PerigeeCovariance &perigeeCovariance=PerigeeUtil::identity(), const double chi2=0.0, std::size_t ndf=0)
Augments a plain perigee circle with a covariance matrix. Covariance defaults to zero.
void reverse()
Flips the orientation of the circle in place.
double variance(const EPerigeeParameter &i) const
Getter for individual diagonal elements of the covariance matrix.
double m_chi2
Memory for the chi square value of the fit of this circle.
void invalidate()
Sets all circle parameters to zero including the covariance matrix.
UncertainPerigeeCircle(const PerigeeParameters &parameters, const PerigeeCovariance &perigeeCovariance=PerigeeUtil::identity(), const double chi2=0.0, std::size_t ndf=0)
Constructor taking all stored parameters as a SVector.
PerigeeParameters perigeeParameters() const
Getter for the perigee parameters in the order defined by EPerigeeParameter.h.
void passiveMoveBy(const ROOT::Math::XYVector &by)
Moves the coordinate system by the vector by and calculates the new perigee and its covariance matrix...
UncertainPerigeeCircle(const double curvature, const double phi0Vec, const double impact, const PerigeeCovariance &perigeeCovariance=PerigeeUtil::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.
void setPerigeeCovariance(const PerigeeCovariance &perigeeCovariance)
Setter for the whole covariance matrix of the perigee parameters.
PerigeeCovariance m_perigeeCovariance
Memory for the 3x3 covariance matrix of the perigee parameters.
double chi2() const
Getter for the chi square value of the circle fit.
void setNDF(std::size_t ndf)
Setter for the number of degrees of freediom used in the circle fit.
size_t m_ndf
Memory for the number of degrees of freedim of the fit of this circle.
UncertainPerigeeCircle reversed() const
Returns a copy of the circle with opposite orientation.
UncertainPerigeeCircle(const PerigeeCircle &perigeeCircle, const PerigeeCovariance &perigeeCovariance=PerigeeUtil::identity(), const double chi2=0.0, std::size_t ndf=0)
Augments a plain perigee circle with a covariance matrix. Covariance defaults to zero.
void setChi2(const double chi2)
Setter for the chi square value of the circle fit.
const PerigeeCovariance & perigeeCovariance() const
Getter for the whole covariance matrix of the perigee parameters.
PerigeeCovariance passiveMovedCovarianceBy(const ROOT::Math::XYVector &by) const
Calculates the jacobian matrix that is needed for the translation of the parameter covariance for a p...
std::size_t ndf() const
Getter for the number of degrees of freediom used in the circle fit.
static UncertainPerigeeCircle average(const UncertainPerigeeCircle &fromPerigeeCircle, const UncertainPerigeeCircle &toPerigeeCircle)
Average the parameters of the two given perigee circles properly considering their covariance matrix.
PerigeeCircle m_perigeeCircle
Memory for the underlying circle.
const PerigeeCircle * operator->() const
Access to the constant interface of the underlying parameter line Allows the user of this "super" cla...
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)