Belle II Software development
PerigeeCircle Class Reference

Extension of the generalized circle also caching the perigee coordinates. More...

#include <PerigeeCircle.h>

Public Member Functions

 PerigeeCircle ()
 Default constructor for ROOT compatibility.
 
 PerigeeCircle (double curvature, const Vector2D &phi0Vec, double impact)
 Constructor from the perigee parammeters.
 
 PerigeeCircle (double curvature, double phi0, double impact)
 Constructor from the perigee parammeters.
 
 PerigeeCircle (const PerigeeParameters &perigeeParameters)
 Constructor from the perigee parammeters.
 
 PerigeeCircle (const Line2D &n012)
 Constructor from a two dimensional line.
 
 PerigeeCircle (const GeneralizedCircle &n0123)
 Constructor promoting the generalized circle.
 
 PerigeeCircle (const Circle2D &circle)
 Constructor from a two dimensional circle in center / radius representation.
 
void invalidate ()
 Sets all circle parameters to zero.
 
bool isInvalid () const
 Indicates if all circle parameters are zero.
 
bool isValid () const
 Indicates if the combination of the circle parameters makes up a valid circle.
 
void reverse ()
 Flips the orientation of the circle in place.
 
PerigeeCircle reversed () const
 Returns a copy of the circle with opposite orientation.
 
void conformalTransform ()
 Transforms the generalized circle to conformal space inplace.
 
PerigeeCircle conformalTransformed () const
 Returns a copy of the circle in conformal space.
 
void passiveMoveBy (const Vector2D &by)
 Moves the coordinates system by the given vector. Updates perigee parameters in place.
 
PerigeeJacobian passiveMoveByJacobian (const Vector2D &by) const
 Computes the Jacobi matrix for a move of the coordinate system by the given vector.
 
void passiveMoveByJacobian (const Vector2D &by, PerigeeJacobian &jacobian) const
 Puts the Jacobi matrix for a move of the coordinate system by the given vector in the given matrix as an output argument.
 
Vector2D atArcLength (double arcLength) const
 Calculates the point, which lies at the give perpendicular travel distance (counted from the perigee)
 
double arcLengthTo (const Vector2D &point) const
 Calculates the arc length between the perigee and the given point.
 
double arcLengthBetween (const Vector2D &from, const Vector2D &to) const
 Calculates the arc length between two points of closest approach on the circle.
 
double arcLengthToCylindricalR (double cylindricalR) const
 Calculates the two dimensional arc length till the cylindrical radius is reached If the radius can not be reached return NAN.
 
std::pair< Vector2D, Vector2DatCylindricalR (double cylindricalR) const
 Calculates the two points with the given cylindrical radius on the generalised circle.
 
Vector2D atCylindricalRForwardOf (const Vector2D &startPoint, double cylindricalR) const
 Approach on the circle with the given cylindrical radius that lies in the forward direction of a start point.
 
EForwardBackward isForwardOrBackwardOf (const Vector2D &from, const Vector2D &to) const
 Indicates whether to given point lies in the forward direction from the perigee.
 
EForwardBackward isForwardOrBackward (const Vector2D &to) const
 Indicates whether to given point lies in the forward direction from the perigee.
 
Vector2D chooseNextForwardOf (const Vector2D &start, const Vector2D &end1, const Vector2D &end2) const
 Returns the one of two end point which is first reached from the given start if one stricly follows the forward direction of the circle.
 
Vector2D closest (const Vector2D &point) const
 Calculates the point of closest approach on the circle to the given point.
 
double distance (const Vector2D &point) const
 Getter for the proper signed distance of the point to the circle.
 
double distance (double fastDistance) const
 Helper function to translate the linearised distance to the proper distance.
 
double fastDistance (const Vector2D &point) const
 Getter for the linearised distance measure to a point.
 
double fastImpact () const
 Getter for the linearised distance to the origin.
 
double fastDistance (double distance) const
 Helper function to translate the proper distance to the linearized distance measure of the circle retaining the sign of the distance.
 
ERightLeft isRightOrLeft (const Vector2D &point) const
 Indicates if the point is on the right or left side of the circle.
 
bool isLine () const
 Indicates if the perigee parameters represent a line.
 
bool isCircle () const
 Indicates if the perigee parameters represent a closed circle.
 
ERotation orientation () const
 Getter for the orientation of the circle.
 
Vector2D gradient (const Vector2D &point) const
 Gradient of the distance field, hence indicates the direction of increasing distance.
 
Vector2D normal (const Vector2D &point) const
 Unit normal vector from the circle to the given point.
 
Vector2D tangential (const Vector2D &point) const
 Tangential vector to the circle near the given position.
 
const Vector2Dtangential () const
 Getter for the tangtial vector at the perigee.
 
Vector2D perigee () const
 Getter for the perigee point.
 
Vector2D center () const
 Getter for the center of the circle. If it was a line both components will be infinity.
 
Vector2D apogee () const
 Getter for the apogee of the circle. If it was a line both components will be infinity.
 
double minimalCylindricalR () const
 Gives the minimal cylindrical radius the circle reaches (unsigned)
 
double maximalCylindricalR () const
 Gives the maximal cylindrical radius the circle reaches.
 
double arcLengthPeriod () const
 Getter for the arc length for a full round of the circle.
 
double perimeter () const
 Gives the signed perimeter of the circle.
 
double radius () const
 Gives the signed radius of the circle. If it was a line this will be infinity.
 
double absRadius () const
 Gives the signed radius of the circle. If it was a line this will be infinity.
 
void setCenterAndRadius (const Vector2D &center, double absRadius, ERotation orientation=ERotation::c_CounterClockwise)
 Setter for the circle center and radius.
 
double n0 () const
 Getter for the generalised circle parameter n0.
 
Vector2D n12 () const
 Getter for the generalised circle parameters n1 and n2.
 
double n1 () const
 Getter for the generalised circle parameters n1.
 
double n2 () const
 Getter for the generalised circle parameters n2.
 
double n3 () const
 Getter for the generalised circle parameter n3.
 
void setN (double n0, double n1, double n2, double n3=0.0)
 Setter for four generalised circle parameters.
 
void setN (double n0, const Vector2D &n12, double n3=0.0)
 Setter for four generalised circle parameters.
 
void setN (const Line2D &n012)
 Setter for generalised circle parameters from a normal line.
 
void setN (const GeneralizedCircle &n0123)
 Setter for four generalised circle parameters.
 
double omega () const
 Getter for omega parameter of the common Belle2::Helix which is the wrong sign curvature.
 
double d0 () const
 Getter for d0 parameter of the common Belle2::Helix representation.
 
double curvature () const
 Getter for the signed curvature.
 
double phi0 () const
 Getter for the azimuth angle of the direction of flight at the perigee.
 
const Vector2Dphi0Vec () const
 Getter for the unit vector of the direction of flight at the perigee.
 
double impact () const
 Getter for the signed distance of the origin to the circle.
 
PerigeeParameters perigeeParameters () const
 Getter for the three perigee parameters in the order defined by EPerigeeParameter.h.
 
void setCurvature (double curvature)
 Setter for signed curvature.
 
void setPhi0 (double phi0)
 Sets the azimuth angle of the direction of flight at the perigee.
 
void setPhi0 (const Vector2D &phi0Vec)
 Sets the unit direction of flight at the perigee.
 
void setImpact (double impact)
 Sets the impact parameter of the circle.
 
void setPerigeeParameters (double curvature, const Vector2D &phi0Vec, double impact)
 Setter for the perigee parameters.
 
void setPerigeeParameters (double curvature, double phi0, double impact)
 Setter for the perigee parameters.
 

Static Public Member Functions

static PerigeeCircle fromN (double n0, double n1, double n2, double n3=0)
 Constructor with the four parameters of the generalized circle.
 
static PerigeeCircle fromN (double n0, const Vector2D &n12, double n3=0)
 Constructor with the four parameters of the generalized circle.
 
static PerigeeCircle fromCenterAndRadius (const Vector2D &center, double absRadius, ERotation orientation=ERotation::c_CounterClockwise)
 Constructor from center, radius and a optional orientation.
 

Private Member Functions

 PerigeeCircle (double curvature, double phi0, const Vector2D &phi0Vec, double impact)
 Constructor taking all stored parameters for internal use.
 
double arcLengthAtDeltaLength (double delta, double dr) const
 Helper method to calculate the arc length to a point at distance delta to the perigee and dr to circle.
 
double arcLengthAtSecantLength (double secantLength) const
 Helper method to calculate the arc length between to points on the circle from a given direct secant length.
 

Private Attributes

double m_curvature
 Memory for the signed curvature.
 
double m_phi0
 Memory for the azimuth angle of the direction of flight at the perigee.
 
Vector2D m_phi0Vec
 Cached unit direction of flight at the perigee.
 
double m_impact
 Memory for the signed impact parameter.
 

Detailed Description

Extension of the generalized circle also caching the perigee coordinates.

Definition at line 36 of file PerigeeCircle.h.

Constructor & Destructor Documentation

◆ PerigeeCircle() [1/8]

Default constructor for ROOT compatibility.

Definition at line 42 of file PerigeeCircle.cc.

43{
44 invalidate();
45}
void invalidate()
Sets all circle parameters to zero.

◆ PerigeeCircle() [2/8]

PerigeeCircle ( double  curvature,
const Vector2D phi0Vec,
double  impact 
)

Constructor from the perigee parammeters.

The direction of travel at the perigee is given as vector.

Definition at line 47 of file PerigeeCircle.cc.

49 , m_phi0(phi0Vec.phi())
52{
53}
double m_phi0
Memory for the azimuth angle of the direction of flight at the perigee.
double impact() const
Getter for the signed distance of the origin to the circle.
const Vector2D & phi0Vec() const
Getter for the unit vector of the direction of flight at the perigee.
double m_impact
Memory for the signed impact parameter.
Vector2D m_phi0Vec
Cached unit direction of flight at the perigee.
double m_curvature
Memory for the signed curvature.
double curvature() const
Getter for the signed curvature.
double phi() const
Gives the azimuth angle being the angle to the x axes ( range -M_PI to M_PI )
Definition: Vector2D.h:569

◆ PerigeeCircle() [3/8]

PerigeeCircle ( double  curvature,
double  phi0,
double  impact 
)

Constructor from the perigee parammeters.

The direction of travel at the perigee is given as azimuth angle

Definition at line 55 of file PerigeeCircle.cc.

57 , m_phi0(phi0)
60{
61}
double phi0() const
Getter for the azimuth angle of the direction of flight at the perigee.
static Vector2D Phi(const double phi)
Constucts a unit vector with azimuth angle equal to phi.
Definition: Vector2D.h:62

◆ PerigeeCircle() [4/8]

PerigeeCircle ( const PerigeeParameters perigeeParameters)
explicit

Constructor from the perigee parammeters.

Definition at line 63 of file PerigeeCircle.cc.

64 : PerigeeCircle(perigeeParameters(EPerigeeParameter::c_Curv),
65 perigeeParameters(EPerigeeParameter::c_Phi0),
66 perigeeParameters(EPerigeeParameter::c_I))
67{
68}
PerigeeParameters perigeeParameters() const
Getter for the three perigee parameters in the order defined by EPerigeeParameter....
PerigeeCircle()
Default constructor for ROOT compatibility.

◆ PerigeeCircle() [5/8]

PerigeeCircle ( double  curvature,
double  phi0,
const Vector2D phi0Vec,
double  impact 
)
private

Constructor taking all stored parameters for internal use.

Nothing to do here

Definition at line 70 of file PerigeeCircle.cc.

72 , m_phi0(phi0)
75{
77}

◆ PerigeeCircle() [6/8]

PerigeeCircle ( const Line2D n012)
explicit

Constructor from a two dimensional line.

Definition at line 79 of file PerigeeCircle.cc.

80{
81 setN(n012);
82}
void setN(double n0, double n1, double n2, double n3=0.0)
Setter for four generalised circle parameters.

◆ PerigeeCircle() [7/8]

PerigeeCircle ( const GeneralizedCircle n0123)
explicit

Constructor promoting the generalized circle.

Definition at line 84 of file PerigeeCircle.cc.

85{
86 setN(n0123);
87}

◆ PerigeeCircle() [8/8]

PerigeeCircle ( const Circle2D circle)
explicit

Constructor from a two dimensional circle in center / radius representation.

Definition at line 89 of file PerigeeCircle.cc.

90{
91 setCenterAndRadius(circle.center(), circle.absRadius(), circle.orientation());
92}
Vector2D center() const
Getter for the central point of the circle.
Definition: Circle2D.h:221
double absRadius() const
Getter for the absolute radius.
Definition: Circle2D.h:209
ERotation orientation() const
Indicates if the circle is to be interpreted counterclockwise or clockwise.
Definition: Circle2D.h:215
void setCenterAndRadius(const Vector2D &center, double absRadius, ERotation orientation=ERotation::c_CounterClockwise)
Setter for the circle center and radius.

Member Function Documentation

◆ absRadius()

double absRadius ( ) const
inline

Gives the signed radius of the circle. If it was a line this will be infinity.

Definition at line 340 of file PerigeeCircle.h.

341 {
342 return fabs(radius());
343 }
double radius() const
Gives the signed radius of the circle. If it was a line this will be infinity.

◆ apogee()

Vector2D apogee ( ) const
inline

Getter for the apogee of the circle. If it was a line both components will be infinity.

Definition at line 304 of file PerigeeCircle.h.

305 {
306 return phi0Vec().orthogonal() * (impact() + 2 * radius());
307 }
Vector2D orthogonal() const
Orthogonal vector to the counterclockwise direction.
Definition: Vector2D.h:289

◆ arcLengthAtDeltaLength()

double arcLengthAtDeltaLength ( double  delta,
double  dr 
) const
private

Helper method to calculate the arc length to a point at distance delta to the perigee and dr to circle.

Definition at line 266 of file PerigeeCircle.cc.

267{
268 const double secantLength = sqrt((delta + dr) * (delta - dr) / (1 + dr * curvature()));
269 const double arcLength = arcLengthAtSecantLength(secantLength);
270 return arcLength;
271}
double arcLengthAtSecantLength(double secantLength) const
Helper method to calculate the arc length between to points on the circle from a given direct secant ...
double sqrt(double a)
sqrt for double
Definition: beamHelpers.h:28

◆ arcLengthAtSecantLength()

double arcLengthAtSecantLength ( double  secantLength) const
private

Helper method to calculate the arc length between to points on the circle from a given direct secant length.

Definition at line 273 of file PerigeeCircle.cc.

274{
275 double x = secantLength * curvature() / 2.0;
276 double arcLengthFactor = asinc(x);
277 return secantLength * arcLengthFactor;
278}

◆ arcLengthBetween()

double arcLengthBetween ( const Vector2D from,
const Vector2D to 
) const

Calculates the arc length between two points of closest approach on the circle.

The arc length is signed positiv for travel in orientation direction. In the circle case the arc length is between -pi*radius and pi*radius, hence the discontinuity is on the far side of the circle relative to the given from point. The points are essentially first taken to their closest approach before we take the length on the curve. For the line case the length is the distance component parallel to the line.

Definition at line 244 of file PerigeeCircle.cc.

245{
246 EForwardBackward lengthSign = isForwardOrBackwardOf(from, to);
247 if (not NForwardBackward::isValid(lengthSign)) return NAN;
248 // Handling the rare case that from and to correspond to opposing points on the circle
249 if (lengthSign == EForwardBackward::c_Unknown) lengthSign = EForwardBackward::c_Forward;
250 Vector2D closestAtFrom = closest(from);
251 Vector2D closestAtTo = closest(to);
252 double secantLength = closestAtFrom.distance(closestAtTo);
253 return static_cast<double>(lengthSign) * arcLengthAtSecantLength(secantLength);
254}
EForwardBackward isForwardOrBackwardOf(const Vector2D &from, const Vector2D &to) const
Indicates whether to given point lies in the forward direction from the perigee.
Vector2D closest(const Vector2D &point) const
Calculates the point of closest approach on the circle to the given point.
A two dimensional vector which is equipped with functions for correct handeling of orientation relat...
Definition: Vector2D.h:32
double distance(const Vector2D &rhs=Vector2D(0.0, 0.0)) const
Calculates the distance of this point to the rhs.
Definition: Vector2D.h:204
bool isValid(EForwardBackward eForwardBackward)
Check whether the given enum instance is one of the valid values.
EForwardBackward
Enumeration to represent the distinct possibilities of the right left passage information.

◆ arcLengthPeriod()

double arcLengthPeriod ( ) const
inline

Getter for the arc length for a full round of the circle.

Definition at line 322 of file PerigeeCircle.h.

323 {
324 return std::fabs(perimeter());
325 }
double perimeter() const
Gives the signed perimeter of the circle.

◆ arcLengthTo()

double arcLengthTo ( const Vector2D point) const

Calculates the arc length between the perigee and the given point.

Definition at line 236 of file PerigeeCircle.cc.

237{
238 Vector2D closestToPoint = closest(point);
239 double secantLength = perigee().distance(closestToPoint);
240 double deltaParallel = phi0Vec().dot(point);
241 return copysign(arcLengthAtSecantLength(secantLength), deltaParallel);
242}
Vector2D perigee() const
Getter for the perigee point.
double dot(const Vector2D &rhs) const
Calculates the two dimensional dot product.
Definition: Vector2D.h:158

◆ arcLengthToCylindricalR()

double arcLengthToCylindricalR ( double  cylindricalR) const

Calculates the two dimensional arc length till the cylindrical radius is reached If the radius can not be reached return NAN.

Note that there are two solutions which have equivalent arc lengths with different sign Always return the positive solution.

Definition at line 256 of file PerigeeCircle.cc.

257{
258 // Slight trick here
259 // Since the sought point is on the helix we treat it as the perigee
260 // and the origin as the point to extrapolate to.
261 // We know the distance of the origin to the circle, which is just d0
262 // The direct distance from the origin to the imaginary perigee is just the given cylindricalR.
263 return arcLengthAtDeltaLength(cylindricalR, impact());
264}
double arcLengthAtDeltaLength(double delta, double dr) const
Helper method to calculate the arc length to a point at distance delta to the perigee and dr to circl...

◆ atArcLength()

Vector2D atArcLength ( double  arcLength) const

Calculates the point, which lies at the give perpendicular travel distance (counted from the perigee)

Definition at line 116 of file PerigeeCircle.cc.

117{
118 double chi = arcLength * curvature();
119 double chiHalf = chi / 2.0;
120
121 double atX = arcLength * sinc(chi);
122 double atY = arcLength * sinc(chiHalf) * sin(chiHalf) + impact();
123 return Vector2D::compose(phi0Vec(), atX, atY);
124}
static Vector2D compose(const Vector2D &coordinateVec, const double parallelCoor, const double orthoCoor)
Constructs a vector from a unit coordinate system vector and the coordinates in that system.
Definition: Vector2D.h:74

◆ atCylindricalR()

std::pair< Vector2D, Vector2D > atCylindricalR ( double  cylindricalR) const

Calculates the two points with the given cylindrical radius on the generalised circle.

Definition at line 280 of file PerigeeCircle.cc.

281{
282 const double u = (1 + curvature() * impact());
283 const double orthogonal = ((square(impact()) + square(cylindricalR)) * curvature() / 2.0 + impact()) / u;
284 const double parallel = sqrt(square(cylindricalR) - square(orthogonal));
285 Vector2D atCylindricalR1 = Vector2D::compose(phi0Vec(), -parallel, orthogonal);
286 Vector2D atCylindricalR2 = Vector2D::compose(phi0Vec(), parallel, orthogonal);
287 std::pair<Vector2D, Vector2D> result(atCylindricalR1, atCylindricalR2);
288 return result;
289}

◆ atCylindricalRForwardOf()

Vector2D atCylindricalRForwardOf ( const Vector2D startPoint,
double  cylindricalR 
) const

Approach on the circle with the given cylindrical radius that lies in the forward direction of a start point.

Calculates the point on the circle with cylindrical radius cylindricalR, which is closest following the circle in the direction of positive forward orientation This is particularly useful to extraplotate into a certain layer. In case no intersection with this cylindrical radius exists the function returns Vector2D(NAN,NAN)

Parameters
startPointStart point from which to follow in the circle in the forward direction
cylindricalRCylindrical radius of interest
Returns
Close point in forward direction with same cylindrical radius on the circle.

Definition at line 291 of file PerigeeCircle.cc.

293{
294 std::pair<Vector2D, Vector2D> candidatePoints = atCylindricalR(cylindricalR);
295 return chooseNextForwardOf(startPoint, candidatePoints.first, candidatePoints.second);
296}
Vector2D chooseNextForwardOf(const Vector2D &start, const Vector2D &end1, const Vector2D &end2) const
Returns the one of two end point which is first reached from the given start if one stricly follows t...
std::pair< Vector2D, Vector2D > atCylindricalR(double cylindricalR) const
Calculates the two points with the given cylindrical radius on the generalised circle.

◆ center()

Vector2D center ( ) const
inline

Getter for the center of the circle. If it was a line both components will be infinity.

Definition at line 298 of file PerigeeCircle.h.

299 {
300 return phi0Vec().orthogonal() * (impact() + radius());
301 }

◆ chooseNextForwardOf()

Vector2D chooseNextForwardOf ( const Vector2D start,
const Vector2D end1,
const Vector2D end2 
) const

Returns the one of two end point which is first reached from the given start if one stricly follows the forward direction of the circle.

If the generalized circle is truely a line none of the points might lie in the forward direction and Vector2D(NAN,NAN) is returned.

Parameters
startPoint to start the traversal
end1One possible end point
end2Other possible end point
Returns
end1 or end2 depending, which lies closer to start in the forward direction or Vector2D(NAN,NAN) if neither end1 nor end2 are reachable in the forward direction (line case only)

Definition at line 298 of file PerigeeCircle.cc.

301{
302 double arcLength1 = arcLengthBetween(start, end1);
303 double arcLength2 = arcLengthBetween(start, end2);
304 if (arcLength1 < 0) arcLength1 += arcLengthPeriod();
305 if (arcLength2 < 0) arcLength2 += arcLengthPeriod();
306 if (fmin(arcLength1, arcLength2) == arcLength1) {
307 return end1;
308 } else if (fmin(arcLength1, arcLength2) == arcLength2) {
309 return end2;
310 } else {
311 return Vector2D(NAN, NAN);
312 }
313}
double arcLengthBetween(const Vector2D &from, const Vector2D &to) const
Calculates the arc length between two points of closest approach on the circle.
double arcLengthPeriod() const
Getter for the arc length for a full round of the circle.

◆ closest()

Vector2D closest ( const Vector2D point) const

Calculates the point of closest approach on the circle to the given point.

Definition at line 315 of file PerigeeCircle.cc.

316{
317 return point - normal(point) * distance(point);
318}
Vector2D normal(const Vector2D &point) const
Unit normal vector from the circle to the given point.
double distance(const Vector2D &point) const
Getter for the proper signed distance of the point to the circle.

◆ conformalTransform()

void conformalTransform ( )

Transforms the generalized circle to conformal space inplace.

Applies the conformal map in the self-inverse from X = x / (x^2 + y^2) and Y = y / (x^2 +y^2) inplace It works most easily by the exchange of the circle parameters n0 <-> n3

Definition at line 139 of file PerigeeCircle.cc.

140{
141 double denominator = 2 + curvature() * impact();
142 std::swap(m_impact, m_curvature);
143 m_curvature *= denominator;
144 m_impact /= denominator;
145 // Also properly fixing the orientation to the opposite.
146 reverse();
147}
void reverse()
Flips the orientation of the circle in place.

◆ conformalTransformed()

PerigeeCircle conformalTransformed ( ) const

Returns a copy of the circle in conformal space.

Applies the conformal map in the self-inverse from X = x / (x^2 + y^2) and Y = y / (x^2 +y^2) and returns the result as a new circle It works most easily by the exchange of the circle parameters n0 <-> n3

Definition at line 149 of file PerigeeCircle.cc.

150{
151 double denominator = 2 + curvature() * impact();
152 // Properly fixing the orientation to the opposite by the minus signs
153 double newCurvature = -impact() * denominator;
154 double newPhi0 = AngleUtil::reversed(phi0());
155 Vector2D newPhi0Vec = -phi0Vec();
156 double newImpact = -curvature() / denominator;
157 return PerigeeCircle(newCurvature, newPhi0, newPhi0Vec, newImpact);
158}
static double reversed(const double angle)
Get the angle that point in the opposite direction.
Definition: Angle.h:54

◆ curvature()

double curvature ( ) const
inline

Getter for the signed curvature.

Definition at line 416 of file PerigeeCircle.h.

417 {
418 return m_curvature;
419 }

◆ d0()

double d0 ( ) const
inline

Getter for d0 parameter of the common Belle2::Helix representation.

Definition at line 410 of file PerigeeCircle.h.

411 {
412 return -impact();
413 }

◆ distance() [1/2]

double distance ( const Vector2D point) const
inline

Getter for the proper signed distance of the point to the circle.

Definition at line 210 of file PerigeeCircle.h.

211 {
212 return distance(fastDistance(point));
213 }
double fastDistance(const Vector2D &point) const
Getter for the linearised distance measure to a point.

◆ distance() [2/2]

double distance ( double  fastDistance) const

Helper function to translate the linearised distance to the proper distance.

Definition at line 320 of file PerigeeCircle.cc.

321{
322 double A = 2 * fastDistance;
323 double U = std::sqrt(1 + A * curvature());
324 return A / (1.0 + U);
325}

◆ fastDistance() [1/2]

double fastDistance ( const Vector2D point) const

Getter for the linearised distance measure to a point.

Gives a fast signed approximation of the distance to the circle. The absolute value of the fast distance is accurate up to first order of distance/circle radius, hence best used with big circles and small distances. The sign of the fast distance indicates if the point is to the right or to the left of the circle.

Definition at line 327 of file PerigeeCircle.cc.

328{
329 Vector2D delta = point - perigee();
330 double deltaOrthogonal = phi0Vec().cross(delta);
331 return -deltaOrthogonal + curvature() * delta.normSquared() / 2;
332}
double cross(const Vector2D &rhs) const
Calculated the two dimensional cross product.
Definition: Vector2D.h:163
double normSquared() const
Calculates .
Definition: Vector2D.h:169

◆ fastDistance() [2/2]

double fastDistance ( double  distance) const
inline

Helper function to translate the proper distance to the linearized distance measure of the circle retaining the sign of the distance.

Definition at line 238 of file PerigeeCircle.h.

239 {
240 return distance * (1.0 + distance * curvature() / 2);
241 }

◆ fastImpact()

double fastImpact ( ) const
inline

Getter for the linearised distance to the origin.

Definition at line 229 of file PerigeeCircle.h.

230 {
231 return fastDistance(impact());
232 }

◆ fromCenterAndRadius()

PerigeeCircle fromCenterAndRadius ( const Vector2D center,
double  absRadius,
ERotation  orientation = ERotation::c_CounterClockwise 
)
static

Constructor from center, radius and a optional orientation.

The center and radius alone do not carry any orientation. However the perigee parameterisation does. Therefore the constructor also excepts an orientated representation from them. If no orientation is given, it defaults to mathematical positiv counterclockwise.

Definition at line 109 of file PerigeeCircle.cc.

110{
111 PerigeeCircle circle;
113 return circle;
114}
Extension of the generalized circle also caching the perigee coordinates.
Definition: PerigeeCircle.h:36
Vector2D center() const
Getter for the center of the circle. If it was a line both components will be infinity.
double absRadius() const
Gives the signed radius of the circle. If it was a line this will be infinity.
ERotation orientation() const
Getter for the orientation of the circle.

◆ fromN() [1/2]

PerigeeCircle fromN ( double  n0,
const Vector2D n12,
double  n3 = 0 
)
static

Constructor with the four parameters of the generalized circle.

Definition at line 101 of file PerigeeCircle.cc.

102{
103 PerigeeCircle circle;
104 circle.setN(n0, n12, n3);
105 return circle;
106}
Vector2D n12() const
Getter for the generalised circle parameters n1 and n2.
double n3() const
Getter for the generalised circle parameter n3.
double n0() const
Getter for the generalised circle parameter n0.

◆ fromN() [2/2]

PerigeeCircle fromN ( double  n0,
double  n1,
double  n2,
double  n3 = 0 
)
static

Constructor with the four parameters of the generalized circle.

Definition at line 94 of file PerigeeCircle.cc.

95{
96 PerigeeCircle circle;
97 circle.setN(n0, n1, n2, n3);
98 return circle;
99}
double n1() const
Getter for the generalised circle parameters n1.
double n2() const
Getter for the generalised circle parameters n2.

◆ gradient()

Vector2D gradient ( const Vector2D point) const
inline

Gradient of the distance field, hence indicates the direction of increasing distance.

Definition at line 268 of file PerigeeCircle.h.

269 {
270 return (point - perigee()) * curvature() - phi0Vec().orthogonal();
271 }

◆ impact()

double impact ( ) const
inline

Getter for the signed distance of the origin to the circle.

Definition at line 434 of file PerigeeCircle.h.

435 {
436 return m_impact;
437 }

◆ invalidate()

void invalidate ( )

Sets all circle parameters to zero.

Definition at line 160 of file PerigeeCircle.cc.

161{
162 m_curvature = 0.0;
163 m_phi0 = NAN;
164 m_phi0Vec = Vector2D(0.0, 0.0);
165 m_impact = 0;
166}

◆ isCircle()

bool isCircle ( ) const
inline

Indicates if the perigee parameters represent a closed circle.

Definition at line 256 of file PerigeeCircle.h.

257 {
258 return curvature() != 0.0;
259 }

◆ isForwardOrBackward()

EForwardBackward isForwardOrBackward ( const Vector2D to) const
inline

Indicates whether to given point lies in the forward direction from the perigee.

Definition at line 186 of file PerigeeCircle.h.

187 {
189 }
const Vector2D & tangential() const
Getter for the tangtial vector at the perigee.
EForwardBackward isForwardOrBackwardOf(const Vector2D &rhs) const
Indicates if the given vector is more coaligned or reverse if you looked in the direction of this vec...
Definition: Vector2D.h:493

◆ isForwardOrBackwardOf()

EForwardBackward isForwardOrBackwardOf ( const Vector2D from,
const Vector2D to 
) const
inline

Indicates whether to given point lies in the forward direction from the perigee.

Definition at line 180 of file PerigeeCircle.h.

181 {
182 return tangential(from).isForwardOrBackwardOf(to - from);
183 }

◆ isInvalid()

bool isInvalid ( ) const

Indicates if all circle parameters are zero.

Definition at line 168 of file PerigeeCircle.cc.

169{
170 return (not std::isfinite(phi0()) or not std::isfinite(curvature()) or
171 not std::isfinite(impact()) or phi0Vec().isNull());
172}

◆ isLine()

bool isLine ( ) const
inline

Indicates if the perigee parameters represent a line.

Definition at line 250 of file PerigeeCircle.h.

251 {
252 return curvature() == 0.0;
253 }

◆ isRightOrLeft()

ERightLeft isRightOrLeft ( const Vector2D point) const
inline

Indicates if the point is on the right or left side of the circle.

Definition at line 244 of file PerigeeCircle.h.

245 {
246 return static_cast<ERightLeft>(sign(fastDistance(point)));
247 }
ERightLeft
Enumeration to represent the distinct possibilities of the right left passage.
Definition: ERightLeft.h:25

◆ isValid()

bool isValid ( ) const
inline

Indicates if the combination of the circle parameters makes up a valid circle.

Definition at line 94 of file PerigeeCircle.h.

95 {
96 return not isInvalid();
97 }
bool isInvalid() const
Indicates if all circle parameters are zero.

◆ maximalCylindricalR()

double maximalCylindricalR ( ) const
inline

Gives the maximal cylindrical radius the circle reaches.

Definition at line 316 of file PerigeeCircle.h.

317 {
318 return fabs(impact() + 2 * radius());
319 }

◆ minimalCylindricalR()

double minimalCylindricalR ( ) const
inline

Gives the minimal cylindrical radius the circle reaches (unsigned)

Definition at line 310 of file PerigeeCircle.h.

311 {
312 return fabs(impact());
313 }

◆ n0()

double n0 ( ) const
inline

Getter for the generalised circle parameter n0.

Definition at line 351 of file PerigeeCircle.h.

352 {
353 return impact() * (impact() * curvature() / 2.0 + 1.0);
354 }

◆ n1()

double n1 ( ) const
inline

Getter for the generalised circle parameters n1.

Definition at line 363 of file PerigeeCircle.h.

364 {
365 return n12().x();
366 }
double x() const
Getter for the x coordinate.
Definition: Vector2D.h:595

◆ n12()

Vector2D n12 ( ) const
inline

Getter for the generalised circle parameters n1 and n2.

Definition at line 357 of file PerigeeCircle.h.

358 {
359 return -phi0Vec().orthogonal() * (1 + curvature() * impact());
360 }

◆ n2()

double n2 ( ) const
inline

Getter for the generalised circle parameters n2.

Definition at line 370 of file PerigeeCircle.h.

371 {
372 return n12().y();
373 }
double y() const
Getter for the y coordinate.
Definition: Vector2D.h:605

◆ n3()

double n3 ( ) const
inline

Getter for the generalised circle parameter n3.

Definition at line 377 of file PerigeeCircle.h.

378 {
379 return curvature() / 2.0;
380 }

◆ normal()

Vector2D normal ( const Vector2D point) const
inline

Unit normal vector from the circle to the given point.

Definition at line 274 of file PerigeeCircle.h.

275 {
276 return gradient(point).unit();
277 }
Vector2D gradient(const Vector2D &point) const
Gradient of the distance field, hence indicates the direction of increasing distance.
Vector2D unit() const
Returns a unit vector colaligned with this.
Definition: Vector2D.h:321

◆ omega()

double omega ( ) const
inline

Getter for omega parameter of the common Belle2::Helix which is the wrong sign curvature.

Definition at line 404 of file PerigeeCircle.h.

405 {
406 return -curvature();
407 }

◆ orientation()

ERotation orientation ( ) const
inline

Getter for the orientation of the circle.

Definition at line 262 of file PerigeeCircle.h.

263 {
264 return static_cast<ERotation>(sign(curvature()));
265 }
ERotation
Enumeration to represent the distinct possibilities of the right left passage information.
Definition: ERotation.h:25

◆ passiveMoveBy()

void passiveMoveBy ( const Vector2D by)

Moves the coordinates system by the given vector. Updates perigee parameters in place.

Definition at line 174 of file PerigeeCircle.cc.

175{
176 double arcLength = arcLengthTo(by);
177 m_impact = distance(by);
178 m_phi0 = m_phi0 + curvature() * arcLength;
181}
double arcLengthTo(const Vector2D &point) const
Calculates the arc length between the perigee and the given point.
static void normalise(double &angle)
Normalise an angle inplace to lie in the range from [-pi, pi].
Definition: Angle.h:41

◆ passiveMoveByJacobian() [1/2]

PerigeeJacobian passiveMoveByJacobian ( const Vector2D by) const

Computes the Jacobi matrix for a move of the coordinate system by the given vector.

Definition at line 183 of file PerigeeCircle.cc.

184{
186 passiveMoveByJacobian(by, jacobian);
187 return jacobian;
188}
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

◆ passiveMoveByJacobian() [2/2]

void passiveMoveByJacobian ( const Vector2D by,
PerigeeJacobian jacobian 
) const

Puts the Jacobi matrix for a move of the coordinate system by the given vector in the given matrix as an output argument.

Definition at line 190 of file PerigeeCircle.cc.

191{
192 Vector2D deltaVec = by - perigee();
193 double delta = deltaVec.norm();
194 double deltaParallel = phi0Vec().dot(deltaVec);
195 // double deltaOrthogonal = phi0Vec().cross(deltaVec);
196 // double zeta = deltaVec.normSquared();
197
198 Vector2D UVec = gradient(by);
199 double U = UVec.norm();
200 double USquared = UVec.normSquared();
201 double UOrthogonal = phi0Vec().cross(UVec);
202 // double UParallel = phi0Vec().dot(UVec);
203
204 // Vector2D CB = gradient(by).orthogonal();
205 // double U = sqrt(1 + curvature() * A);
206 // double xi = 1.0 / CB.normSquared();
207 // double nu = 1 - curvature() * deltaOrthogonal;
208 // double mu = 1.0 / (U * (U + 1)) + curvature() * lambda;
209 // double mu = 1.0 / U / 2.0;
210 // double nu = -UOrthogonal;
211 // double xi = 1 / USquared;
212
213 // double halfA = fastDistance(by);
214 // double A = 2 * halfA;
215 // double lambda = halfA / ((1 + U) * (1 + U) * U);
216 double dr = distance(by);
217
218 // Vector2D uVec = gradient(Vector2D(0.0, 0.0));
219 // double u = uVec.norm();
220 double u = 1 + curvature() * impact(); //= n12().cylindricalR()
221
222 using namespace NPerigeeParameterIndices;
223 jacobian(c_Curv, c_Curv) = 1;
224 jacobian(c_Curv, c_Phi0) = 0;
225 jacobian(c_Curv, c_I) = 0;
226
227 jacobian(c_Phi0, c_Curv) = deltaParallel / USquared;
228 jacobian(c_Phi0, c_Phi0) = -u * UOrthogonal / USquared;
229 jacobian(c_Phi0, c_I) = -curvature() * curvature() * deltaParallel / USquared;
230
231 jacobian(c_I, c_Curv) = (delta - dr) * (delta + dr) / U / 2;
232 jacobian(c_I, c_Phi0) = u * deltaParallel / U;
233 jacobian(c_I, c_I) = -UOrthogonal / U;
234}
double norm() const
Calculates the length of the vector.
Definition: Vector2D.h:175

◆ perigee()

Vector2D perigee ( ) const
inline

Getter for the perigee point.

Definition at line 292 of file PerigeeCircle.h.

293 {
294 return phi0Vec().orthogonal() * impact();
295 }

◆ perigeeParameters()

PerigeeParameters perigeeParameters ( ) const
inline

Getter for the three perigee parameters in the order defined by EPerigeeParameter.h.

Definition at line 440 of file PerigeeCircle.h.

441 {
442 using namespace NPerigeeParameterIndices;
443 PerigeeParameters result;
444 result(c_Curv) = curvature();
445 result(c_Phi0) = phi0();
446 result(c_I) = impact();
447 return result;
448 }

◆ perimeter()

double perimeter ( ) const
inline

Gives the signed perimeter of the circle.

Definition at line 328 of file PerigeeCircle.h.

329 {
330 return 2 * M_PI * radius();
331 }

◆ phi0()

double phi0 ( ) const
inline

Getter for the azimuth angle of the direction of flight at the perigee.

Definition at line 422 of file PerigeeCircle.h.

423 {
424 return m_phi0;
425 }

◆ phi0Vec()

const Vector2D & phi0Vec ( ) const
inline

Getter for the unit vector of the direction of flight at the perigee.

Definition at line 428 of file PerigeeCircle.h.

429 {
430 return m_phi0Vec;
431 }

◆ radius()

double radius ( ) const
inline

Gives the signed radius of the circle. If it was a line this will be infinity.

Definition at line 334 of file PerigeeCircle.h.

335 {
336 return 1 / curvature();
337 }

◆ reverse()

void reverse ( )

Flips the orientation of the circle in place.

Definition at line 126 of file PerigeeCircle.cc.

127{
132}
Vector2D & reverse()
Reverses the direction of the vector in place.
Definition: Vector2D.h:327

◆ reversed()

PerigeeCircle reversed ( ) const

Returns a copy of the circle with opposite orientation.

Definition at line 134 of file PerigeeCircle.cc.

◆ setCenterAndRadius()

void setCenterAndRadius ( const Vector2D center,
double  absRadius,
ERotation  orientation = ERotation::c_CounterClockwise 
)

Setter for the circle center and radius.

Definition at line 334 of file PerigeeCircle.cc.

337{
338 m_curvature = static_cast<double>(orientation) / std::fabs(absRadius);
341 m_phi0 = m_phi0Vec.phi();
342 m_impact = (center.norm() - std::fabs(absRadius)) * static_cast<double>(orientation);
343}
double normalize()
Normalizes the vector to unit length.
Definition: Vector2D.h:303
ERotation reversed(ERotation eRotation)
Return the reversed rotation. Leaves ERotation::c_Invalid the same.
Definition: ERotation.h:41

◆ setCurvature()

void setCurvature ( double  curvature)
inline

Setter for signed curvature.

Definition at line 451 of file PerigeeCircle.h.

452 {
454 }

◆ setImpact()

void setImpact ( double  impact)
inline

Sets the impact parameter of the circle.

Definition at line 471 of file PerigeeCircle.h.

472 {
474 }

◆ setN() [1/4]

void setN ( const GeneralizedCircle n0123)
inline

Setter for four generalised circle parameters.

Definition at line 398 of file PerigeeCircle.h.

399 {
400 setN(n0123.n0(), n0123.n12(), n0123.n3());
401 }

◆ setN() [2/4]

void setN ( const Line2D n012)
inline

Setter for generalised circle parameters from a normal line.

Definition at line 392 of file PerigeeCircle.h.

393 {
394 setN(n012.n0(), n012.n12());
395 }

◆ setN() [3/4]

void setN ( double  n0,
const Vector2D n12,
double  n3 = 0.0 
)

Setter for four generalised circle parameters.

Definition at line 345 of file PerigeeCircle.cc.

346{
347 double normalization = sqrt(n12.normSquared() - 4 * n0 * n3);
348 m_curvature = 2 * n3 / normalization;
351 m_phi0 = m_phi0Vec.phi();
352 m_impact = distance(n0 / normalization); // Uses the new curvature
353}

◆ setN() [4/4]

void setN ( double  n0,
double  n1,
double  n2,
double  n3 = 0.0 
)
inline

Setter for four generalised circle parameters.

Definition at line 383 of file PerigeeCircle.h.

384 {
385 setN(n0, Vector2D(n1, n2), n3);
386 }

◆ setPerigeeParameters() [1/2]

void setPerigeeParameters ( double  curvature,
const Vector2D phi0Vec,
double  impact 
)
inline

Setter for the perigee parameters.

Definition at line 477 of file PerigeeCircle.h.

478 {
480 m_phi0 = phi0Vec.phi();
483 }

◆ setPerigeeParameters() [2/2]

void setPerigeeParameters ( double  curvature,
double  phi0,
double  impact 
)
inline

Setter for the perigee parameters.

Definition at line 486 of file PerigeeCircle.h.

487 {
489 m_phi0 = phi0;
492 }

◆ setPhi0() [1/2]

void setPhi0 ( const Vector2D phi0Vec)
inline

Sets the unit direction of flight at the perigee.

Definition at line 464 of file PerigeeCircle.h.

465 {
466 m_phi0 = phi0Vec.phi();
468 }

◆ setPhi0() [2/2]

void setPhi0 ( double  phi0)
inline

Sets the azimuth angle of the direction of flight at the perigee.

Definition at line 457 of file PerigeeCircle.h.

458 {
459 m_phi0 = phi0;
461 }

◆ tangential() [1/2]

const Vector2D & tangential ( ) const
inline

Getter for the tangtial vector at the perigee.

Definition at line 286 of file PerigeeCircle.h.

287 {
288 return phi0Vec();
289 }

◆ tangential() [2/2]

Vector2D tangential ( const Vector2D point) const
inline

Tangential vector to the circle near the given position.

Definition at line 280 of file PerigeeCircle.h.

281 {
282 return normal(point).orthogonal();
283 }

Member Data Documentation

◆ m_curvature

double m_curvature
private

Memory for the signed curvature.

Definition at line 503 of file PerigeeCircle.h.

◆ m_impact

double m_impact
private

Memory for the signed impact parameter.

Definition at line 512 of file PerigeeCircle.h.

◆ m_phi0

double m_phi0
private

Memory for the azimuth angle of the direction of flight at the perigee.

Definition at line 506 of file PerigeeCircle.h.

◆ m_phi0Vec

Vector2D m_phi0Vec
private

Cached unit direction of flight at the perigee.

Definition at line 509 of file PerigeeCircle.h.


The documentation for this class was generated from the following files: