Belle II Software development
SZLine.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/SZParameters.h>
11#include <tracking/trackFindingCDC/geometry/Vector2D.h>
12
13namespace Belle2 {
18 namespace TrackFindingCDC {
19
26 class SZLine {
27
28 public:
31 : m_tanLambda(NAN)
32 , m_z0(NAN)
33 {
34 }
35
37 SZLine(double tanLambda, double z0)
39 , m_z0(z0)
40 {
41 }
42
47 {
48 }
49
50 public:
52 double tanLambda() const
53 {
54 return m_tanLambda;
55 }
56
58 double slope() const
59 {
60 return m_tanLambda;
61 }
62
64 double inverseSlope() const
65 {
66 return 1 / tanLambda();
67 }
68
70 double theta() const
71 {
72 return m_tanLambda;
73 }
74
77 {
79 }
80
82 double z0() const
83 {
84 return m_z0;
85 }
86
88 double intercept() const
89 {
90 return m_z0;
91 }
92
94 void setZ0(double z0)
95 {
96 m_z0 = z0;
97 }
98
101 {
102 using namespace NSZParameterIndices;
103 SZParameters result;
104 result(c_TanL) = tanLambda();
105 result(c_Z0) = z0();
106 return result;
107 }
108
110 double zero() const
111 {
112 return -intercept() / slope();
113 }
114
116 double map(double s) const
117 {
118 return tanLambda() * s + z0();
119 }
120
122 double operator()(double s) const
123 {
124 return map(s);
125 }
126
128 double inverseMap(double z) const
129 {
130 return (z - z0()) / tanLambda();
131 }
132
133 public:
136 {
137 setZ0(NAN);
138 setTanLambda(NAN);
139 }
140
142 bool isInvalid() const
143 {
144 return not std::isfinite(tanLambda()) or not std::isfinite(z0());
145 }
146
148 void reverse()
149 {
151 }
152
155 {
156 return SZLine(-tanLambda(), z0());
157 }
158
159 public:
165 double distance(const Vector2D& szPoint) const
166 {
167 return distance(szPoint.first(), szPoint.second());
168 }
169
175 double distance(double s, double z) const
176 {
177 return (map(s) - z) / hypot2(1, tanLambda());
178 }
179
181 Vector2D intersection(const SZLine& szLine) const;
182
184 void passiveMoveBy(const Vector2D& bySZ)
185 {
186 passiveMoveBy(bySZ.first(), bySZ.second());
187 }
188
190 void passiveMoveBy(double s, double z)
191 {
192 m_z0 = map(s) - z;
193 }
194
196 SZLine passiveMovedBy(const Vector2D& bySZ) const
197 {
198 return passiveMovedBy(bySZ.first(), bySZ.second());
199 }
200
202 SZLine passiveMovedBy(double s, double z) const
203 {
204 return SZLine(tanLambda(), map(s) - z);
205 }
206
209 {
210 using namespace NSZParameterIndices;
211 SZJacobian result = SZUtil::identity();
212 result(c_Z0, c_TanL) = bySZ.first();
213 return result;
214 }
215
216 private:
219
221 double m_z0;
222
223 };
224 }
226}
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
double m_tanLambda
Memory for the tan lambda parameter.
Definition: SZLine.h:218
SZLine passiveMovedBy(double s, double z) const
Return a line passively move by the given s and z coordinates as a copy.
Definition: SZLine.h:202
double z0() const
Getter for the z0 parameter.
Definition: SZLine.h:82
void setZ0(double z0)
Getter for the z0 parameter.
Definition: SZLine.h:94
double zero() const
Returns the the two dimensional arc length s where the z coordinate approaches zero.
Definition: SZLine.h:110
SZParameters szParameters() const
Getter for the sz parameters.
Definition: SZLine.h:100
bool isInvalid() const
Indicates if the line parameters do not represent a valid line.
Definition: SZLine.h:142
void reverse()
Reverse the arc length direction in place.
Definition: SZLine.h:148
double slope() const
Getter for the slope in the sz space which is equivalent to tan lambda.
Definition: SZLine.h:58
Vector2D intersection(const SZLine &szLine) const
Calculates the intersection point of two line. Infinity for parallels.
Definition: SZLine.cc:14
double distance(double s, double z) const
Calculates the signed distance of the point given by its to coordinates to the line.
Definition: SZLine.h:175
double intercept() const
Getter for the intercept in the sz space which is equivalent to z0.
Definition: SZLine.h:88
void setTanLambda(double tanLambda)
Getter for the tan lambda parameter.
Definition: SZLine.h:76
double inverseSlope() const
Returns the slope over the second coordinate.
Definition: SZLine.h:64
double tanLambda() const
Getter for the tan lambda parameter.
Definition: SZLine.h:52
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)
Passively move the coordinate system in place by the given sz vector.
Definition: SZLine.h:184
SZLine()
Default constructor for ROOT compatibility.
Definition: SZLine.h:30
SZLine(double tanLambda, double z0)
Constructor from slope and intercept in the sz space.
Definition: SZLine.h:37
double map(double s) const
Maps the two dimensional arc length s to z.
Definition: SZLine.h:116
double inverseMap(double z) const
Maps the z coordinate to the two dimensional arc length s.
Definition: SZLine.h:128
double distance(const Vector2D &szPoint) const
Calculates the signed distance of the point to the line.
Definition: SZLine.h:165
void passiveMoveBy(double s, double z)
Passively move the coordinate system in place by the given s and z coordinates.
Definition: SZLine.h:190
double m_z0
Memory for the z0 parameter.
Definition: SZLine.h:221
SZLine passiveMovedBy(const Vector2D &bySZ) const
Return a line passively move by the given vector as a copy.
Definition: SZLine.h:196
SZLine(const SZParameters &szParameters)
Constructor from the sz parameters.
Definition: SZLine.h:44
double operator()(double s) const
Maps the two dimensional arc length s to z.
Definition: SZLine.h:122
double theta() const
Getter for the theta dip angle.
Definition: SZLine.h:70
SZLine reversed() const
Returns a copy of the line with reversed the arc length direction.
Definition: SZLine.h:154
A two dimensional vector which is equipped with functions for correct handling of orientation relate...
Definition: Vector2D.h:32
double second() const
Getter for the second coordinate.
Definition: Vector2D.h:639
double first() const
Getter for the first coordinate.
Definition: Vector2D.h:629
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.