Belle II Software  release-08-01-10
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 
17 namespace Belle2 {
23  namespace TrackFindingCDC {
24  class Vector2D;
25 
29 
30  public:
33  {
34  }
35 
38  UncertainSZLine(const double tanLambda,
39  const double z0,
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 
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,
67  const double chi2 = 0.0,
68  const size_t ndf = 0)
69  : m_szLine(szLine)
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 
104  {
105  return m_szLine.szParameters();
106  }
107 
108  public:
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 
158  void invalidate()
159  {
162  m_chi2 = 0.0;
163  m_ndf = 0;
164  }
165 
166  public:
168  void reverse()
169  {
170  m_szLine.reverse();
172  }
173 
176  {
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 
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 matrix implementation to be used as an interface typ through out the track finder.
Definition: PlainMatrix.h:40
A line in the sz space.
Definition: SZLine.h:26
SZParameters szParameters() const
Getter for the sz parameters.
Definition: SZLine.h:100
void reverse()
Reverse the arc length direction in place.
Definition: SZLine.h:148
SZJacobian passiveMoveByJacobian(const Vector2D &bySZ) const
Computes the Jacobi matrix for a move of the coordinate system by the given vector.
Definition: SZLine.h:208
void invalidate()
Sets the parameters to a invalid representation.
Definition: SZLine.h:135
void passiveMoveBy(const Vector2D &bySZ)
Passivelly move the coordinate system in place by the given sz vector.
Definition: SZLine.h:184
SZLine reversed() const
Returns a copy of the line with reversed the arc length direction.
Definition: SZLine.h:154
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.
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.
const SZLine & szLine() const
Getter for the underlying sz line.
const SZLine * operator->() const
Access to the constant interface of the underlying parameter line Allows the user of this "super" cla...
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...
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 SZCovariance & szCovariance() const
Getter for the whole covariance matrix of the sz line parameters.
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)
ESZParameter
Enumeration to address the individual sz parameters in a vector or matrix.
Definition: SZParameters.h:24
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.