Belle II Software  release-08-01-10
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/trackFindingCDC/geometry/PerigeeCircle.h>
11 #include <tracking/trackFindingCDC/geometry/PerigeeParameters.h>
12 
13 #include <cstddef>
14 #include <iosfwd>
15 
16 namespace Belle2 {
22  namespace TrackFindingCDC {
23  class GeneralizedCircle;
24  class Vector2D;
25 
30 
31  public:
34  {
35  }
36 
42  UncertainPerigeeCircle(const double curvature,
43  const double phi0Vec,
44  const double impact,
46  const double chi2 = 0.0,
47  std::size_t ndf = 0)
48  : m_perigeeCircle(curvature, phi0Vec, impact)
50  , m_chi2(chi2)
51  , m_ndf(ndf)
52  {
53  }
54 
60  UncertainPerigeeCircle(const double curvature,
61  const Vector2D& phi0,
62  const double impact,
64  const double chi2 = 0.0,
65  std::size_t ndf = 0)
66  : m_perigeeCircle(curvature, phi0, impact)
68  , m_chi2(chi2)
69  , m_ndf(ndf)
70  {
71  }
72 
76  const double chi2 = 0.0,
77  std::size_t ndf = 0)
80  , m_chi2(chi2)
81  , m_ndf(ndf)
82  {
83  }
84 
86  explicit UncertainPerigeeCircle(const GeneralizedCircle& generalizedCircle,
88  const double chi2 = 0.0,
89  std::size_t ndf = 0)
90  : m_perigeeCircle(generalizedCircle)
92  , m_chi2(chi2)
93  , m_ndf(ndf)
94  {
95  }
96 
99  const PerigeeParameters& parameters,
101  const double chi2 = 0.0,
102  std::size_t ndf = 0)
103  : m_perigeeCircle(parameters)
105  , m_chi2(chi2)
106  , m_ndf(ndf)
107  {
108  }
109 
112  static UncertainPerigeeCircle average(const UncertainPerigeeCircle& fromPerigeeCircle,
113  const UncertainPerigeeCircle& toPerigeeCircle);
114 
115  public:
125  const PerigeeCircle* operator->() const
126  {
127  return &m_perigeeCircle;
128  }
129 
131  operator const PerigeeCircle& () const
132  {
133  return m_perigeeCircle;
134  }
135 
138  {
139  return m_perigeeCircle;
140  }
141 
144  {
146  }
147 
148  public:
151  {
153  }
154 
157  {
158  return m_perigeeCovariance;
159  }
160 
162  double covariance(const EPerigeeParameter& iRow, const EPerigeeParameter& iCol) const
163  {
164  return perigeeCovariance()(iRow, iCol);
165  }
166 
168  double variance(const EPerigeeParameter& i) const
169  {
170  return perigeeCovariance()(i, i);
171  }
172 
174  double chi2() const
175  {
176  return m_chi2;
177  }
178 
180  void setChi2(const double chi2)
181  {
182  m_chi2 = chi2;
183  }
184 
186  std::size_t ndf() const
187  {
188  return m_ndf;
189  }
190 
192  void setNDF(std::size_t ndf)
193  {
194  m_ndf = ndf;
195  }
196 
198  void invalidate()
199  {
202  m_chi2 = 0.0;
203  }
204 
205  public:
207  void reverse()
208  {
211  }
212 
215  {
218  chi2(),
219  ndf());
220  }
221 
222  public:
228  void passiveMoveBy(const Vector2D& by)
229  {
230  // Move the covariance matrix first to have access to the original parameters
234  }
235 
242  {
244  return PerigeeUtil::transported(jacobian, perigeeCovariance());
245  }
246 
247  private:
250 
253 
255  double m_chi2 = 0.0;
256 
258  size_t m_ndf = 0.0;
259 
260  };
261 
263  std::ostream& operator<<(std::ostream& output, const UncertainPerigeeCircle& circle);
264  }
266 }
Extension of the generalized circle also caching the perigee coordinates.
Definition: PerigeeCircle.h:36
PerigeeCircle reversed() const
Returns a copy of the circle with opposite orientation.
void reverse()
Flips the orientation of the circle in place.
void passiveMoveBy(const Vector2D &by)
Moves the coordinates system by the given vector. Updates perigee parameters in place.
void invalidate()
Sets all circle parameters to zero.
PerigeeParameters perigeeParameters() const
Getter for the three perigee parameters in the order defined by EPerigeeParameter....
PerigeeJacobian passiveMoveByJacobian(const Vector2D &by) const
Computes the Jacobi matrix for a move of the coordinate system by the given vector.
A matrix implementation to be used as an interface typ through out the track finder.
Definition: PlainMatrix.h:40
Adds an uncertainty matrix to the circle in perigee parameterisation.
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.
const PerigeeCircle * operator->() const
Access to the constant interface of the underlying parameter line Allows the user of this "super" cla...
void passiveMoveBy(const Vector2D &by)
Moves the coordinate system by the vector by and calculates the new perigee and its covariance matrix...
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.
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.
const PerigeeCovariance & perigeeCovariance() const
Getter for the whole 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.
PerigeeCovariance passiveMovedCovarianceBy(const Vector2D &by) const
Calculates the jacobian matrix that is needed for the translation of the parameter covariance for a p...
UncertainPerigeeCircle(const double curvature, const Vector2D &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.
void setChi2(const double chi2)
Setter for the chi square value of the circle fit.
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.
A two dimensional vector which is equipped with functions for correct handeling of orientation relat...
Definition: Vector2D.h:35
std::ostream & operator<<(std::ostream &output, const IntervalOfValidity &iov)
EPerigeeParameter
Enumeration to address the individual perigee 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.