Belle II Software  release-05-01-25
UncertainSZLine.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2014 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Oliver Frost *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #pragma once
11 
12 #include <tracking/trackFindingCDC/geometry/SZLine.h>
13 
14 #include <tracking/trackFindingCDC/geometry/SZParameters.h>
15 
16 #include <cstddef>
17 #include <iosfwd>
18 
19 namespace Belle2 {
25  namespace TrackFindingCDC {
26  class Vector2D;
27 
30  class UncertainSZLine {
31 
32  public:
35  {
36  }
37 
40  UncertainSZLine(const double tanLambda,
41  const double z0,
43  const double chi2 = 0.0,
44  const size_t ndf = 0)
45  : m_szLine(tanLambda, z0)
47  , m_chi2(chi2)
49  {
50  }
51 
56  const double chi2 = 0.0,
57  const size_t ndf = 0)
60  , m_chi2(chi2)
61  , m_ndf(ndf)
62  {
63  }
64 
67  explicit UncertainSZLine(const SZLine& szLine,
69  const double chi2 = 0.0,
70  const size_t ndf = 0)
71  : m_szLine(szLine)
73  , m_chi2(chi2)
74  , m_ndf(ndf)
75  {
76  }
77 
87  const SZLine* operator->() const
88  {
89  return &m_szLine;
90  }
91 
93  operator const SZLine& () const
94  {
95  return m_szLine;
96  }
97 
99  const SZLine& szLine() const
100  {
101  return m_szLine;
102  }
103 
105  SZParameters szParameters() const
106  {
108  }
109 
110  public:
113  {
115  }
116 
118  const SZCovariance& szCovariance() const
119  {
121  }
122 
124  double covariance(const ESZParameter& iRow, const ESZParameter& iCol) const
125  {
126  return szCovariance()(iRow, iCol);
127  }
128 
130  double variance(const ESZParameter& i) const
131  {
132  return szCovariance()(i, i);
133  }
134 
136  double chi2() const
137  {
138  return m_chi2;
139  }
140 
142  void setChi2(const double chi2)
143  {
145  }
146 
148  std::size_t ndf() const
149  {
150  return m_ndf;
151  }
152 
154  void setNDF(std::size_t ndf)
155  {
157  }
158 
160  void invalidate()
161  {
164  m_chi2 = 0.0;
165  m_ndf = 0;
166  }
167 
168  public:
170  void reverse()
171  {
172  m_szLine.reverse();
174  }
175 
177  UncertainSZLine reversed() const
178  {
180  }
181 
182  public:
185  void passiveMoveBy(const Vector2D& bySZ)
186  {
187  // Move the covariance matrix first to have access to the original parameters
188  SZJacobian jacobian = m_szLine.passiveMoveByJacobian(bySZ);
190  m_szLine.passiveMoveBy(bySZ);
191  }
192 
199  {
200  SZJacobian jacobian = m_szLine.passiveMoveByJacobian(bySZ);
201  return SZUtil::transported(jacobian, szCovariance());
202  }
203 
204  private:
207 
210 
212  double m_chi2 = 0.0;
213 
215  size_t m_ndf = 0;
216  };
217 
219  std::ostream& operator<<(std::ostream& output, const UncertainSZLine& uncertainSZLine);
220  }
222 }
Belle2::operator<<
std::ostream & operator<<(std::ostream &output, const IntervalOfValidity &iov)
Definition: IntervalOfValidity.cc:196
Belle2::TrackFindingCDC::UncertainSZLine::passiveMoveBy
void passiveMoveBy(const Vector2D &bySZ)
Moves the coordinate system by the vector by and calculates the new sz line and its covariance matrix...
Definition: UncertainSZLine.h:193
Belle2::TrackFindingCDC::Vector2D
A two dimensional vector which is equipped with functions for correct handeling of orientation relat...
Definition: Vector2D.h:37
Belle2::TrackFindingCDC::UncertainParametersUtil< SZUtil, ESZParameter >::transport
static void transport(const JacobianMatrix &jacobian, CovarianceMatrix &cov)
Transport the covariance matrix inplace with the given jacobian matrix.
Definition: UncertainParameters.icc.h:34
Belle2::TrackFindingCDC::UncertainSZLine
A line in sz where s is the transverse travel distance as seen in the xy projection with uncertaintie...
Definition: UncertainSZLine.h:38
Belle2::TrackFindingCDC::UncertainSZLine::setNDF
void setNDF(std::size_t ndf)
Setter for the number of degrees of freediom used in the line fit.
Definition: UncertainSZLine.h:162
Belle2::TrackFindingCDC::SZLine::invalidate
void invalidate()
Sets the parameters to a invalid representation.
Definition: SZLine.h:145
Belle2::TrackFindingCDC::UncertainSZLine::ndf
std::size_t ndf() const
Getter for the number of degrees of freediom used in the line fit.
Definition: UncertainSZLine.h:156
Belle2::TrackFindingCDC::UncertainSZLine::chi2
double chi2() const
Getter for the chi square value of the line fit.
Definition: UncertainSZLine.h:144
Belle2::TrackFindingCDC::NSZParameterIndices::ESZParameter
ESZParameter
Enumeration to address the individual sz parameters in a vector or matrix.
Definition: SZParameters.h:34
Belle2::TrackFindingCDC::UncertainSZLine::m_szLine
SZLine m_szLine
Memory for the underlying line.
Definition: UncertainSZLine.h:214
Belle2::TrackFindingCDC::SZLine
A line in the sz space.
Definition: SZLine.h:36
Belle2::TrackFindingCDC::SZLine::szParameters
SZParameters szParameters() const
Getter for the sz parameters.
Definition: SZLine.h:110
Belle2::TrackFindingCDC::UncertainSZLine::variance
double variance(const ESZParameter &i) const
Getter for individual diagonal elements of the covariance matrix.
Definition: UncertainSZLine.h:138
Belle2::TrackFindingCDC::UncertainParametersUtil< SZUtil, ESZParameter >::identity
static CovarianceMatrix identity()
Returns an identity matrix.
Definition: UncertainParameters.icc.h:65
Belle2::TrackFindingCDC::UncertainSZLine::passiveMovedCovarianceBy
SZCovariance passiveMovedCovarianceBy(const Vector2D &bySZ) const
Calculates the jacobian matrix that is needed for the translation of the parameter covariance for a p...
Definition: UncertainSZLine.h:206
Belle2::TrackFindingCDC::UncertainSZLine::reverse
void reverse()
Reverses the direction of flight represented by this sz line.
Definition: UncertainSZLine.h:178
Belle2::TrackFindingCDC::UncertainSZLine::covariance
double covariance(const ESZParameter &iRow, const ESZParameter &iCol) const
Getter for individual elements of the covariance matrix.
Definition: UncertainSZLine.h:132
Belle2::TrackFindingCDC::UncertainSZLine::setChi2
void setChi2(const double chi2)
Setter for the chi square value of the line fit.
Definition: UncertainSZLine.h:150
Belle2::TrackFindingCDC::UncertainSZLine::m_ndf
size_t m_ndf
Memory for the number of degrees of freedim of the fit of this line.
Definition: UncertainSZLine.h:223
Belle2::TrackFindingCDC::UncertainSZLine::m_szCovariance
SZCovariance m_szCovariance
Memory for the 2x2 covariance matrix of sz slope (aka tan lambda) and z0.
Definition: UncertainSZLine.h:217
Belle2::TrackFindingCDC::UncertainParametersUtil< SZUtil, ESZParameter >::transported
static CovarianceMatrix transported(const JacobianMatrix &jacobian, const CovarianceMatrix &cov)
Return a copy of the covariance matrix transported with the given jacobian matrix.
Definition: UncertainParameters.icc.h:41
Belle2::TrackFindingCDC::UncertainSZLine::invalidate
void invalidate()
Sets all line parameters to zero including the covariance matrix.
Definition: UncertainSZLine.h:168
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TrackFindingCDC::UncertainSZLine::UncertainSZLine
UncertainSZLine()
Default constructor for ROOT compatibility.
Definition: UncertainSZLine.h:42
Belle2::TrackFindingCDC::SZLine::passiveMoveByJacobian
SZJacobian passiveMoveByJacobian(const Vector2D &bySZ) const
Computes the Jacobi matrix for a move of the coordinate system by the given vector.
Definition: SZLine.h:218
Belle2::TrackFindingCDC::SZLine::reversed
SZLine reversed() const
Returns a copy of the line with reversed the arc length direction.
Definition: SZLine.h:164
Belle2::TrackFindingCDC::UncertainSZLine::szParameters
SZParameters szParameters() const
Getter for the sz parameters in the order defined by ESZParameter.h.
Definition: UncertainSZLine.h:113
Belle2::TrackFindingCDC::UncertainSZLine::setSZCovariance
void setSZCovariance(const SZCovariance &szCovariance)
Setter for the whole covariance matrix of the sz line parameters.
Definition: UncertainSZLine.h:120
Belle2::TrackFindingCDC::UncertainSZLine::m_chi2
double m_chi2
Memory for the chi square value of the fit of this line.
Definition: UncertainSZLine.h:220
Belle2::TrackFindingCDC::UncertainSZLine::szCovariance
const SZCovariance & szCovariance() const
Getter for the whole covariance matrix of the sz line parameters.
Definition: UncertainSZLine.h:126
Belle2::TrackFindingCDC::PlainMatrix
A matrix implementation to be used as an interface typ through out the track finder.
Definition: PlainMatrix.h:50
Belle2::TrackFindingCDC::UncertainSZLine::szLine
const SZLine & szLine() const
Getter for the underlying sz line.
Definition: UncertainSZLine.h:107
Belle2::TrackFindingCDC::SZLine::reverse
void reverse()
Reverse the arc length direction in place.
Definition: SZLine.h:158
Belle2::TrackFindingCDC::UncertainParametersUtil< SZUtil, ESZParameter >::reversed
static CovarianceMatrix reversed(const CovarianceMatrix &cov)
Return a copy of the reversed covariance matrix.
Definition: UncertainParameters.icc.h:59
Belle2::TrackFindingCDC::UncertainSZLine::operator->
const SZLine * operator->() const
Access to the constant interface of the underlying parameter line Allows the user of this "super" cla...
Definition: UncertainSZLine.h:95
Belle2::TrackFindingCDC::UncertainParametersUtil< SZUtil, ESZParameter >::reverse
static void reverse(CovarianceMatrix &cov)
Reverse the covariance matrix inplace.
Definition: UncertainParameters.icc.h:53
Belle2::TrackFindingCDC::UncertainSZLine::reversed
UncertainSZLine reversed() const
Returns a copy of the line corresponding to the reverse direction of travel.
Definition: UncertainSZLine.h:185
Belle2::TrackFindingCDC::SZLine::passiveMoveBy
void passiveMoveBy(const Vector2D &bySZ)
Passivelly move the coordinate system in place by the given sz vector.
Definition: SZLine.h:194