Belle II Software  release-05-02-19
SZLine.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2016 - 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/SZParameters.h>
13 #include <tracking/trackFindingCDC/geometry/Vector2D.h>
14 
15 namespace Belle2 {
20  namespace TrackFindingCDC {
21 
28  class SZLine {
29 
30  public:
32  SZLine()
33  : m_tanLambda(NAN)
34  , m_z0(NAN)
35  {
36  }
37 
39  SZLine(double tanLambda, double z0)
41  , m_z0(z0)
42  {
43  }
44 
46  explicit SZLine(const SZParameters& szParameters)
49  {
50  }
51 
52  public:
54  double tanLambda() const
55  {
56  return m_tanLambda;
57  }
58 
60  double slope() const
61  {
62  return m_tanLambda;
63  }
64 
66  double inverseSlope() const
67  {
68  return 1 / tanLambda();
69  }
70 
72  double theta() const
73  {
74  return m_tanLambda;
75  }
76 
78  void setTanLambda(double tanLambda)
79  {
81  }
82 
84  double z0() const
85  {
86  return m_z0;
87  }
88 
90  double intercept() const
91  {
92  return m_z0;
93  }
94 
96  void setZ0(double z0)
97  {
98  m_z0 = z0;
99  }
100 
102  SZParameters szParameters() const
103  {
104  using namespace NSZParameterIndices;
105  SZParameters result;
106  result(c_TanL) = tanLambda();
107  result(c_Z0) = z0();
108  return result;
109  }
110 
112  double zero() const
113  {
114  return -intercept() / slope();
115  }
116 
118  double map(double s) const
119  {
120  return tanLambda() * s + z0();
121  }
122 
124  double operator()(double s) const
125  {
126  return map(s);
127  }
128 
130  double inverseMap(double z) const
131  {
132  return (z - z0()) / tanLambda();
133  }
134 
135  public:
137  void invalidate()
138  {
139  setZ0(NAN);
140  setTanLambda(NAN);
141  }
142 
144  bool isInvalid() const
145  {
146  return not std::isfinite(tanLambda()) or not std::isfinite(z0());
147  }
148 
150  void reverse()
151  {
153  }
154 
156  SZLine reversed() const
157  {
158  return SZLine(-tanLambda(), z0());
159  }
160 
161  public:
167  double distance(const Vector2D& szPoint) const
168  {
169  return distance(szPoint.first(), szPoint.second());
170  }
171 
177  double distance(double s, double z) const
178  {
179  return (map(s) - z) / hypot2(1, tanLambda());
180  }
181 
183  Vector2D intersection(const SZLine& szLine) const;
184 
186  void passiveMoveBy(const Vector2D& bySZ)
187  {
188  passiveMoveBy(bySZ.first(), bySZ.second());
189  }
190 
192  void passiveMoveBy(double s, double z)
193  {
194  m_z0 = map(s) - z;
195  }
196 
198  SZLine passiveMovedBy(const Vector2D& bySZ) const
199  {
200  return passiveMovedBy(bySZ.first(), bySZ.second());
201  }
202 
204  SZLine passiveMovedBy(double s, double z) const
205  {
206  return SZLine(tanLambda(), map(s) - z);
207  }
208 
210  SZJacobian passiveMoveByJacobian(const Vector2D& bySZ) const
211  {
212  using namespace NSZParameterIndices;
213  SZJacobian result = SZUtil::identity();
214  result(c_Z0, c_TanL) = bySZ.first();
215  return result;
216  }
217 
218  private:
220  double m_tanLambda;
221 
223  double m_z0;
224 
225  };
226  }
228 }
Belle2::TrackFindingCDC::SZLine::theta
double theta() const
Getter for the theta dip angle.
Definition: SZLine.h:80
Belle2::TrackFindingCDC::SZLine::operator()
double operator()(double s) const
Maps the two dimensional arc length s to z.
Definition: SZLine.h:132
Belle2::TrackFindingCDC::SZLine::tanLambda
double tanLambda() const
Getter for the tan lambda parameter.
Definition: SZLine.h:62
Belle2::TrackFindingCDC::SZLine::SZLine
SZLine()
Default constructor for ROOT compatibility.
Definition: SZLine.h:40
Belle2::TrackFindingCDC::SZLine::inverseMap
double inverseMap(double z) const
Maps the z coordinate to the two dimensional arc length s.
Definition: SZLine.h:138
Belle2::TrackFindingCDC::SZLine::m_z0
double m_z0
Memory for the z0 parameter.
Definition: SZLine.h:231
Belle2::TrackFindingCDC::Vector2D
A two dimensional vector which is equipped with functions for correct handeling of orientation relat...
Definition: Vector2D.h:37
Belle2::TrackFindingCDC::SZLine::inverseSlope
double inverseSlope() const
Returns the slope over the second coordinate.
Definition: SZLine.h:74
Belle2::TrackFindingCDC::SZLine::invalidate
void invalidate()
Sets the parameters to a invalid representation.
Definition: SZLine.h:145
Belle2::TrackFindingCDC::SZLine::isInvalid
bool isInvalid() const
Indicates if the line parameters do not represent a valid line.
Definition: SZLine.h:152
Belle2::TrackFindingCDC::NSZParameterIndices::ESZParameter
ESZParameter
Enumeration to address the individual sz parameters in a vector or matrix.
Definition: SZParameters.h:34
Belle2::TrackFindingCDC::Vector2D::second
double second() const
Getter for the second coordinate.
Definition: Vector2D.h:653
Belle2::TrackFindingCDC::SZLine
A line in the sz space.
Definition: SZLine.h:36
Belle2::TrackFindingCDC::SZLine::zero
double zero() const
Returns the the two dimensional arc length s where the z coordinate approaches zero.
Definition: SZLine.h:120
Belle2::TrackFindingCDC::SZLine::szParameters
SZParameters szParameters() const
Getter for the sz parameters.
Definition: SZLine.h:110
Belle2::TrackFindingCDC::UncertainParametersUtil< SZUtil, ESZParameter >::identity
static CovarianceMatrix identity()
Returns an identity matrix.
Definition: UncertainParameters.icc.h:65
Belle2::TrackFindingCDC::SZLine::z0
double z0() const
Getter for the z0 parameter.
Definition: SZLine.h:92
Belle2::TrackFindingCDC::Vector2D::first
double first() const
Getter for the first coordinate.
Definition: Vector2D.h:643
Belle2::TrackFindingCDC::SZLine::intersection
Vector2D intersection(const SZLine &szLine) const
Calculates the intersection point of two line. Infinity for parallels.
Definition: SZLine.cc:16
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TrackFindingCDC::SZLine::m_tanLambda
double m_tanLambda
Memory for the tan lambda parameter.
Definition: SZLine.h:228
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::map
double map(double s) const
Maps the two dimensional arc length s to z.
Definition: SZLine.h:126
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::SZLine::distance
double distance(const Vector2D &szPoint) const
Calculates the signed distance of the point to the line.
Definition: SZLine.h:175
Belle2::TrackFindingCDC::SZLine::setZ0
void setZ0(double z0)
Getter for the z0 parameter.
Definition: SZLine.h:104
Belle2::TrackFindingCDC::SZLine::slope
double slope() const
Getter for the slope in the sz space which is equivalent to tan lambda.
Definition: SZLine.h:68
Belle2::TrackFindingCDC::SZLine::setTanLambda
void setTanLambda(double tanLambda)
Getter for the tan lambda parameter.
Definition: SZLine.h:86
Belle2::TrackFindingCDC::PlainMatrix
A matrix implementation to be used as an interface typ through out the track finder.
Definition: PlainMatrix.h:50
Belle2::TrackFindingCDC::SZLine::passiveMovedBy
SZLine passiveMovedBy(const Vector2D &bySZ) const
Return a line passivelly move by the given vector as a copy.
Definition: SZLine.h:206
Belle2::TrackFindingCDC::SZLine::reverse
void reverse()
Reverse the arc length direction in place.
Definition: SZLine.h:158
Belle2::TrackFindingCDC::SZLine::intercept
double intercept() const
Getter for the intercept in the sz space which is equivalent to z0.
Definition: SZLine.h:98
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