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 ROOT::Math::XYVector &phi0Vec, double impact)
 Constructor from the perigee parameters.
 
 PerigeeCircle (double curvature, double phi0, double impact)
 Constructor from the perigee parameters.
 
 PerigeeCircle (const PerigeeParameters &perigeeParameters)
 Constructor from the perigee parameters.
 
 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 ROOT::Math::XYVector &by)
 Moves the coordinates system by the given vector. Updates perigee parameters in place.
 
PerigeeJacobian passiveMoveByJacobian (const ROOT::Math::XYVector &by) const
 Computes the Jacobi matrix for a move of the coordinate system by the given vector.
 
void passiveMoveByJacobian (const ROOT::Math::XYVector &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.
 
ROOT::Math::XYVector atArcLength (double arcLength) const
 Calculates the point, which lies at the give perpendicular travel distance (counted from the perigee)
 
double arcLengthTo (const ROOT::Math::XYVector &point) const
 Calculates the arc length between the perigee and the given point.
 
double arcLengthBetween (const ROOT::Math::XYVector &from, const ROOT::Math::XYVector &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< ROOT::Math::XYVector, ROOT::Math::XYVector > atCylindricalR (double cylindricalR) const
 Calculates the two points with the given cylindrical radius on the generalised circle.
 
ROOT::Math::XYVector atCylindricalRForwardOf (const ROOT::Math::XYVector &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 ROOT::Math::XYVector &from, const ROOT::Math::XYVector &to) const
 Indicates whether to given point lies in the forward direction from the perigee.
 
EForwardBackward isForwardOrBackward (const ROOT::Math::XYVector &to) const
 Indicates whether to given point lies in the forward direction from the perigee.
 
ROOT::Math::XYVector chooseNextForwardOf (const ROOT::Math::XYVector &start, const ROOT::Math::XYVector &end1, const ROOT::Math::XYVector &end2) const
 Returns the one of two end point which is first reached from the given start if one strictly follows the forward direction of the circle.
 
ROOT::Math::XYVector closest (const ROOT::Math::XYVector &point) const
 Calculates the point of closest approach on the circle to the given point.
 
double distance (const ROOT::Math::XYVector &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 ROOT::Math::XYVector &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 ROOT::Math::XYVector &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.
 
ROOT::Math::XYVector gradient (const ROOT::Math::XYVector &point) const
 Gradient of the distance field, hence indicates the direction of increasing distance.
 
ROOT::Math::XYVector normal (const ROOT::Math::XYVector &point) const
 Unit normal vector from the circle to the given point.
 
ROOT::Math::XYVector tangential (const ROOT::Math::XYVector &point) const
 Tangential vector to the circle near the given position.
 
const ROOT::Math::XYVector & tangential () const
 Getter for the tangtial vector at the perigee.
 
ROOT::Math::XYVector perigee () const
 Getter for the perigee point.
 
ROOT::Math::XYVector center () const
 Getter for the center of the circle. If it was a line both components will be infinity.
 
ROOT::Math::XYVector 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 ROOT::Math::XYVector &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.
 
ROOT::Math::XYVector 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 ROOT::Math::XYVector &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 ROOT::Math::XYVector & phi0Vec () 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 ROOT::Math::XYVector &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 ROOT::Math::XYVector &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 ROOT::Math::XYVector &n12, double n3=0)
 Constructor with the four parameters of the generalized circle.
 
static PerigeeCircle fromCenterAndRadius (const ROOT::Math::XYVector &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 ROOT::Math::XYVector &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 = 0.0
 Memory for the signed curvature.
 
double m_phi0 = NAN
 Memory for the azimuth angle of the direction of flight at the perigee.
 
ROOT::Math::XYVector m_phi0Vec
 Cached unit direction of flight at the perigee.
 
double m_impact = 0.0
 Memory for the signed impact parameter.
 

Detailed Description

Extension of the generalized circle also caching the perigee coordinates.

Definition at line 38 of file PerigeeCircle.h.

Constructor & Destructor Documentation

◆ PerigeeCircle() [1/8]

Default constructor for ROOT compatibility.

Definition at line 41 of file PerigeeCircle.cc.

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

◆ PerigeeCircle() [2/8]

PerigeeCircle ( double curvature,
const ROOT::Math::XYVector & phi0Vec,
double impact )

Constructor from the perigee parameters.

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

Definition at line 46 of file PerigeeCircle.cc.

48 , m_phi0(phi0Vec.Phi())
51{
52}
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.
double m_impact
Memory for the signed impact parameter.
double m_curvature
Memory for the signed curvature.
double curvature() const
Getter for the signed curvature.
const ROOT::Math::XYVector & phi0Vec() const
Getter for the unit vector of the direction of flight at the perigee.
ROOT::Math::XYVector m_phi0Vec
Cached unit direction of flight at the perigee.

◆ PerigeeCircle() [3/8]

PerigeeCircle ( double curvature,
double phi0,
double impact )

Constructor from the perigee parameters.

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

Definition at line 54 of file PerigeeCircle.cc.

56 , m_phi0(phi0)
57 , m_phi0Vec(VectorUtil::Phi(phi0))
59{
60}
double phi0() const
Getter for the azimuth angle of the direction of flight at the perigee.

◆ PerigeeCircle() [4/8]

PerigeeCircle ( const PerigeeParameters & perigeeParameters)
explicit

Constructor from the perigee parameters.

Definition at line 62 of file PerigeeCircle.cc.

63 : PerigeeCircle(perigeeParameters(EPerigeeParameter::c_Curv),
64 perigeeParameters(EPerigeeParameter::c_Phi0),
65 perigeeParameters(EPerigeeParameter::c_I))
66{
67}
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 ROOT::Math::XYVector & phi0Vec,
double impact )
private

Constructor taking all stored parameters for internal use.

Nothing to do here

Definition at line 69 of file PerigeeCircle.cc.

71 , m_phi0(phi0)
74{
76}

◆ PerigeeCircle() [6/8]

PerigeeCircle ( const Line2D & n012)
explicit

Constructor from a two dimensional line.

Definition at line 78 of file PerigeeCircle.cc.

79{
80 setN(n012);
81}
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 83 of file PerigeeCircle.cc.

84{
85 setN(n0123);
86}

◆ PerigeeCircle() [8/8]

PerigeeCircle ( const Circle2D & circle)
explicit

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

Definition at line 88 of file PerigeeCircle.cc.

89{
90 setCenterAndRadius(circle.center(), circle.absRadius(), circle.orientation());
91}
double absRadius() const
Getter for the absolute radius.
Definition Circle2D.h:219
ROOT::Math::XYVector center() const
Getter for the central point of the circle.
Definition Circle2D.h:231
ERotation orientation() const
Indicates if the circle is to be interpreted counterclockwise or clockwise.
Definition Circle2D.h:225
void setCenterAndRadius(const ROOT::Math::XYVector &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 342 of file PerigeeCircle.h.

343 {
344 return fabs(radius());
345 }

◆ apogee()

ROOT::Math::XYVector apogee ( ) const
inline

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

Definition at line 306 of file PerigeeCircle.h.

307 {
308 return VectorUtil::Orthogonal(phi0Vec()) * (impact() + 2 * radius());
309 }

◆ 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 265 of file PerigeeCircle.cc.

266{
267 const double secantLength = sqrt((delta + dr) * (delta - dr) / (1 + dr * curvature()));
268 const double arcLength = arcLengthAtSecantLength(secantLength);
269 return arcLength;
270}
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 272 of file PerigeeCircle.cc.

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

◆ arcLengthBetween()

double arcLengthBetween ( const ROOT::Math::XYVector & from,
const ROOT::Math::XYVector & to ) const

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

The arc length is signed positive 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 243 of file PerigeeCircle.cc.

244{
245 EForwardBackward lengthSign = isForwardOrBackwardOf(from, to);
246 if (not NForwardBackward::isValid(lengthSign)) return NAN;
247 // Handling the rare case that from and to correspond to opposing points on the circle
248 if (lengthSign == EForwardBackward::c_Unknown) lengthSign = EForwardBackward::c_Forward;
249 ROOT::Math::XYVector closestAtFrom = closest(from);
250 ROOT::Math::XYVector closestAtTo = closest(to);
251 double secantLength = VectorUtil::Distance(closestAtFrom, closestAtTo);
252 return static_cast<double>(lengthSign) * arcLengthAtSecantLength(secantLength);
253}
ROOT::Math::XYVector closest(const ROOT::Math::XYVector &point) const
Calculates the point of closest approach on the circle to the given point.
EForwardBackward isForwardOrBackwardOf(const ROOT::Math::XYVector &from, const ROOT::Math::XYVector &to) const
Indicates whether to given point lies in the forward direction from the perigee.
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 324 of file PerigeeCircle.h.

325 {
326 return std::fabs(perimeter());
327 }

◆ arcLengthTo()

double arcLengthTo ( const ROOT::Math::XYVector & point) const

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

Definition at line 235 of file PerigeeCircle.cc.

236{
237 ROOT::Math::XYVector closestToPoint = closest(point);
238 double secantLength = VectorUtil::Distance(perigee(), closestToPoint);
239 double deltaParallel = phi0Vec().Dot(point);
240 return copysign(arcLengthAtSecantLength(secantLength), deltaParallel);
241}
ROOT::Math::XYVector perigee() const
Getter for the perigee point.

◆ 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 255 of file PerigeeCircle.cc.

256{
257 // Slight trick here
258 // Since the sought point is on the helix we treat it as the perigee
259 // and the origin as the point to extrapolate to.
260 // We know the distance of the origin to the circle, which is just d0
261 // The direct distance from the origin to the imaginary perigee is just the given cylindricalR.
262 return arcLengthAtDeltaLength(cylindricalR, impact());
263}
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()

ROOT::Math::XYVector atArcLength ( double arcLength) const

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

Definition at line 115 of file PerigeeCircle.cc.

116{
117 double chi = arcLength * curvature();
118 double chiHalf = chi / 2.0;
119
120 double atX = arcLength * sinc(chi);
121 double atY = arcLength * sinc(chiHalf) * sin(chiHalf) + impact();
122 return VectorUtil::compose(phi0Vec(), atX, atY);
123}

◆ atCylindricalR()

std::pair< ROOT::Math::XYVector, ROOT::Math::XYVector > atCylindricalR ( double cylindricalR) const

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

Definition at line 279 of file PerigeeCircle.cc.

280{
281 const double u = (1 + curvature() * impact());
282 const double orthogonal = ((square(impact()) + square(cylindricalR)) * curvature() / 2.0 + impact()) / u;
283 const double parallel = sqrt(square(cylindricalR) - square(orthogonal));
284 ROOT::Math::XYVector atCylindricalR1 = VectorUtil::compose(phi0Vec(), -parallel, orthogonal);
285 ROOT::Math::XYVector atCylindricalR2 = VectorUtil::compose(phi0Vec(), parallel, orthogonal);
286 std::pair<ROOT::Math::XYVector, ROOT::Math::XYVector> result(atCylindricalR1, atCylindricalR2);
287 return result;
288}
constexpr T square(const T &x)
Calculate the square of the input.
Definition MathHelpers.h:21

◆ atCylindricalRForwardOf()

ROOT::Math::XYVector atCylindricalRForwardOf ( const ROOT::Math::XYVector & 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 ROOT::Math::XYVector(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 290 of file PerigeeCircle.cc.

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

◆ center()

ROOT::Math::XYVector center ( ) const
inline

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

Definition at line 300 of file PerigeeCircle.h.

301 {
302 return VectorUtil::Orthogonal(phi0Vec()) * (impact() + radius());
303 }

◆ chooseNextForwardOf()

ROOT::Math::XYVector chooseNextForwardOf ( const ROOT::Math::XYVector & start,
const ROOT::Math::XYVector & end1,
const ROOT::Math::XYVector & end2 ) const

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

If the generalized circle is truly a line none of the points might lie in the forward direction and ROOT::Math::XYVector(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 ROOT::Math::XYVector(NAN,NAN) if neither end1 nor end2 are reachable in the forward direction (line case only)

Definition at line 297 of file PerigeeCircle.cc.

300{
301 double arcLength1 = arcLengthBetween(start, end1);
302 double arcLength2 = arcLengthBetween(start, end2);
303 if (arcLength1 < 0) arcLength1 += arcLengthPeriod();
304 if (arcLength2 < 0) arcLength2 += arcLengthPeriod();
305 if (fmin(arcLength1, arcLength2) == arcLength1) {
306 return end1;
307 } else if (fmin(arcLength1, arcLength2) == arcLength2) {
308 return end2;
309 } else {
310 return ROOT::Math::XYVector(NAN, NAN);
311 }
312}
double arcLengthBetween(const ROOT::Math::XYVector &from, const ROOT::Math::XYVector &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()

ROOT::Math::XYVector closest ( const ROOT::Math::XYVector & point) const

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

Definition at line 314 of file PerigeeCircle.cc.

315{
316 return point - normal(point) * distance(point);
317}
ROOT::Math::XYVector normal(const ROOT::Math::XYVector &point) const
Unit normal vector from the circle to the given point.
double distance(const ROOT::Math::XYVector &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 138 of file PerigeeCircle.cc.

139{
140 double denominator = 2 + curvature() * impact();
141 std::swap(m_impact, m_curvature);
142 m_curvature *= denominator;
143 m_impact /= denominator;
144 // Also properly fixing the orientation to the opposite.
145 reverse();
146}
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 148 of file PerigeeCircle.cc.

149{
150 double denominator = 2 + curvature() * impact();
151 // Properly fixing the orientation to the opposite by the minus signs
152 double newCurvature = -impact() * denominator;
153 double newPhi0 = AngleUtil::reversed(phi0());
154 ROOT::Math::XYVector newPhi0Vec = -phi0Vec();
155 double newImpact = -curvature() / denominator;
156 return PerigeeCircle(newCurvature, newPhi0, newPhi0Vec, newImpact);
157}
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 418 of file PerigeeCircle.h.

419 {
420 return m_curvature;
421 }

◆ d0()

double d0 ( ) const
inline

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

Definition at line 412 of file PerigeeCircle.h.

413 {
414 return -impact();
415 }

◆ distance() [1/2]

double distance ( const ROOT::Math::XYVector & point) const
inline

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

Definition at line 212 of file PerigeeCircle.h.

213 {
214 return distance(fastDistance(point));
215 }

◆ distance() [2/2]

double distance ( double fastDistance) const

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

Definition at line 319 of file PerigeeCircle.cc.

320{
321 double A = 2 * fastDistance;
322 double U = std::sqrt(1 + A * curvature());
323 return A / (1.0 + U);
324}
double fastDistance(const ROOT::Math::XYVector &point) const
Getter for the linearised distance measure to a point.

◆ fastDistance() [1/2]

double fastDistance ( const ROOT::Math::XYVector & 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 326 of file PerigeeCircle.cc.

327{
328 ROOT::Math::XYVector delta = point - perigee();
329 double deltaOrthogonal = VectorUtil::Cross(phi0Vec(), delta);
330 return -deltaOrthogonal + curvature() * delta.Mag2() / 2;
331}

◆ 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 240 of file PerigeeCircle.h.

241 {
242 return distance * (1.0 + distance * curvature() / 2);
243 }

◆ fastImpact()

double fastImpact ( ) const
inline

Getter for the linearised distance to the origin.

Definition at line 231 of file PerigeeCircle.h.

232 {
233 return fastDistance(impact());
234 }

◆ fromCenterAndRadius()

PerigeeCircle fromCenterAndRadius ( const ROOT::Math::XYVector & 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 positive counterclockwise.

Definition at line 108 of file PerigeeCircle.cc.

109{
110 PerigeeCircle circle;
112 return circle;
113}
double absRadius() const
Gives the signed radius of the circle. If it was a line this will be infinity.
ROOT::Math::XYVector center() const
Getter for the center of the circle. If it was a line both components will be infinity.
ERotation orientation() const
Getter for the orientation of the circle.

◆ fromN() [1/2]

PerigeeCircle fromN ( double n0,
const ROOT::Math::XYVector & n12,
double n3 = 0 )
static

Constructor with the four parameters of the generalized circle.

Definition at line 100 of file PerigeeCircle.cc.

101{
102 PerigeeCircle circle;
103 circle.setN(n0, n12, n3);
104 return circle;
105}
double n3() const
Getter for the generalised circle parameter n3.
ROOT::Math::XYVector n12() const
Getter for the generalised circle parameters n1 and n2.
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 93 of file PerigeeCircle.cc.

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

◆ gradient()

ROOT::Math::XYVector gradient ( const ROOT::Math::XYVector & point) const
inline

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

Definition at line 270 of file PerigeeCircle.h.

271 {
272 return (point - perigee()) * curvature() - VectorUtil::Orthogonal(phi0Vec());
273 }

◆ impact()

double impact ( ) const
inline

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

Definition at line 436 of file PerigeeCircle.h.

437 {
438 return m_impact;
439 }

◆ invalidate()

void invalidate ( )

Sets all circle parameters to zero.

Definition at line 159 of file PerigeeCircle.cc.

160{
161 m_curvature = 0.0;
162 m_phi0 = NAN;
163 m_phi0Vec = ROOT::Math::XYVector(0.0, 0.0);
164 m_impact = 0;
165}

◆ isCircle()

bool isCircle ( ) const
inline

Indicates if the perigee parameters represent a closed circle.

Definition at line 258 of file PerigeeCircle.h.

259 {
260 return curvature() != 0.0;
261 }

◆ isForwardOrBackward()

EForwardBackward isForwardOrBackward ( const ROOT::Math::XYVector & to) const
inline

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

Definition at line 188 of file PerigeeCircle.h.

189 {
190 return VectorUtil::isForwardOrBackwardOf(tangential(), to);
191 }

◆ isForwardOrBackwardOf()

EForwardBackward isForwardOrBackwardOf ( const ROOT::Math::XYVector & from,
const ROOT::Math::XYVector & to ) const
inline

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

Definition at line 182 of file PerigeeCircle.h.

183 {
184 return VectorUtil::isForwardOrBackwardOf(tangential(from), (to - from));
185 }

◆ isInvalid()

bool isInvalid ( ) const

Indicates if all circle parameters are zero.

Definition at line 167 of file PerigeeCircle.cc.

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

◆ isLine()

bool isLine ( ) const
inline

Indicates if the perigee parameters represent a line.

Definition at line 252 of file PerigeeCircle.h.

253 {
254 return curvature() == 0.0;
255 }

◆ isRightOrLeft()

ERightLeft isRightOrLeft ( const ROOT::Math::XYVector & point) const
inline

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

Definition at line 246 of file PerigeeCircle.h.

247 {
248 return static_cast<ERightLeft>(sign(fastDistance(point)));
249 }
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 96 of file PerigeeCircle.h.

97 {
98 return not isInvalid();
99 }

◆ maximalCylindricalR()

double maximalCylindricalR ( ) const
inline

Gives the maximal cylindrical radius the circle reaches.

Definition at line 318 of file PerigeeCircle.h.

319 {
320 return fabs(impact() + 2 * radius());
321 }

◆ minimalCylindricalR()

double minimalCylindricalR ( ) const
inline

Gives the minimal cylindrical radius the circle reaches (unsigned)

Definition at line 312 of file PerigeeCircle.h.

313 {
314 return fabs(impact());
315 }

◆ n0()

double n0 ( ) const
inline

Getter for the generalised circle parameter n0.

Definition at line 353 of file PerigeeCircle.h.

354 {
355 return impact() * (impact() * curvature() / 2.0 + 1.0);
356 }

◆ n1()

double n1 ( ) const
inline

Getter for the generalised circle parameters n1.

Definition at line 365 of file PerigeeCircle.h.

366 {
367 return n12().x();
368 }

◆ n12()

ROOT::Math::XYVector n12 ( ) const
inline

Getter for the generalised circle parameters n1 and n2.

Definition at line 359 of file PerigeeCircle.h.

360 {
361 return -VectorUtil::Orthogonal(phi0Vec()) * (1 + curvature() * impact());
362 }

◆ n2()

double n2 ( ) const
inline

Getter for the generalised circle parameters n2.

Definition at line 372 of file PerigeeCircle.h.

373 {
374 return n12().y();
375 }

◆ n3()

double n3 ( ) const
inline

Getter for the generalised circle parameter n3.

Definition at line 379 of file PerigeeCircle.h.

380 {
381 return curvature() / 2.0;
382 }

◆ normal()

ROOT::Math::XYVector normal ( const ROOT::Math::XYVector & point) const
inline

Unit normal vector from the circle to the given point.

Definition at line 276 of file PerigeeCircle.h.

277 {
278 return VectorUtil::unit(gradient(point));
279 }

◆ omega()

double omega ( ) const
inline

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

Definition at line 406 of file PerigeeCircle.h.

407 {
408 return -curvature();
409 }

◆ orientation()

ERotation orientation ( ) const
inline

Getter for the orientation of the circle.

Definition at line 264 of file PerigeeCircle.h.

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

◆ passiveMoveBy()

void passiveMoveBy ( const ROOT::Math::XYVector & by)

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

Definition at line 173 of file PerigeeCircle.cc.

174{
175 double arcLength = arcLengthTo(by);
176 m_impact = distance(by);
177 m_phi0 = m_phi0 + curvature() * arcLength;
179 m_phi0Vec = VectorUtil::Phi(m_phi0);
180}
double arcLengthTo(const ROOT::Math::XYVector &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 ROOT::Math::XYVector & by) const

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

Definition at line 182 of file PerigeeCircle.cc.

183{
184 PerigeeJacobian jacobian = PerigeeUtil::identity();
185 passiveMoveByJacobian(by, jacobian);
186 return jacobian;
187}
PerigeeJacobian passiveMoveByJacobian(const ROOT::Math::XYVector &by) const
Computes the Jacobi matrix for a move of the coordinate system by the given vector.

◆ passiveMoveByJacobian() [2/2]

void passiveMoveByJacobian ( const ROOT::Math::XYVector & 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 189 of file PerigeeCircle.cc.

190{
191 ROOT::Math::XYVector deltaVec = by - perigee();
192 double delta = deltaVec.R();
193 double deltaParallel = phi0Vec().Dot(deltaVec);
194 // double deltaOrthogonal = VectorUtil::Cross(phi0Vec(), deltaVec);
195 // double zeta = deltaVec.Mag2();
196
197 ROOT::Math::XYVector UVec = gradient(by);
198 double U = UVec.R();
199 double USquared = UVec.Mag2();
200 double UOrthogonal = VectorUtil::Cross(phi0Vec(), UVec);
201 // double UParallel = phi0Vec().Dot(UVec);
202
203 // ROOT::Math::XYVector CB = VectorUtil::Orthogonal(gradient(by));
204 // double U = sqrt(1 + curvature() * A);
205 // double xi = 1.0 / CB.Mag2();
206 // double nu = 1 - curvature() * deltaOrthogonal;
207 // double mu = 1.0 / (U * (U + 1)) + curvature() * lambda;
208 // double mu = 1.0 / U / 2.0;
209 // double nu = -UOrthogonal;
210 // double xi = 1 / USquared;
211
212 // double halfA = fastDistance(by);
213 // double A = 2 * halfA;
214 // double lambda = halfA / ((1 + U) * (1 + U) * U);
215 double dr = distance(by);
216
217 // ROOT::Math::XYVector uVec = gradient(ROOT::Math::XYVector(0.0, 0.0));
218 // double u = uVec.R();
219 double u = 1 + curvature() * impact(); //= n12().R()
220
221 using namespace NPerigeeParameterIndices;
222 jacobian(c_Curv, c_Curv) = 1;
223 jacobian(c_Curv, c_Phi0) = 0;
224 jacobian(c_Curv, c_I) = 0;
225
226 jacobian(c_Phi0, c_Curv) = deltaParallel / USquared;
227 jacobian(c_Phi0, c_Phi0) = -u * UOrthogonal / USquared;
228 jacobian(c_Phi0, c_I) = -curvature() * curvature() * deltaParallel / USquared;
229
230 jacobian(c_I, c_Curv) = (delta - dr) * (delta + dr) / U / 2;
231 jacobian(c_I, c_Phi0) = u * deltaParallel / U;
232 jacobian(c_I, c_I) = -UOrthogonal / U;
233}
ROOT::Math::XYVector gradient(const ROOT::Math::XYVector &point) const
Gradient of the distance field, hence indicates the direction of increasing distance.

◆ perigee()

ROOT::Math::XYVector perigee ( ) const
inline

Getter for the perigee point.

Definition at line 294 of file PerigeeCircle.h.

295 {
296 return VectorUtil::Orthogonal(phi0Vec()) * impact();
297 }

◆ perigeeParameters()

PerigeeParameters perigeeParameters ( ) const
inline

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

Definition at line 442 of file PerigeeCircle.h.

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

◆ perimeter()

double perimeter ( ) const
inline

Gives the signed perimeter of the circle.

Definition at line 330 of file PerigeeCircle.h.

331 {
332 return 2 * M_PI * radius();
333 }

◆ phi0()

double phi0 ( ) const
inline

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

Definition at line 424 of file PerigeeCircle.h.

425 {
426 return m_phi0;
427 }

◆ phi0Vec()

const ROOT::Math::XYVector & phi0Vec ( ) const
inline

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

Definition at line 430 of file PerigeeCircle.h.

431 {
432 return m_phi0Vec;
433 }

◆ radius()

double radius ( ) const
inline

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

Definition at line 336 of file PerigeeCircle.h.

337 {
338 return 1 / curvature();
339 }

◆ reverse()

void reverse ( )

Flips the orientation of the circle in place.

Definition at line 125 of file PerigeeCircle.cc.

◆ reversed()

PerigeeCircle reversed ( ) const

Returns a copy of the circle with opposite orientation.

Definition at line 133 of file PerigeeCircle.cc.

◆ setCenterAndRadius()

void setCenterAndRadius ( const ROOT::Math::XYVector & center,
double absRadius,
ERotation orientation = ERotation::c_CounterClockwise )

Setter for the circle center and radius.

Definition at line 333 of file PerigeeCircle.cc.

336{
337 m_curvature = static_cast<double>(orientation) / std::fabs(absRadius);
338 m_phi0Vec = VectorUtil::Orthogonal(center, NRotation::reversed(orientation));
339 if (m_phi0Vec.R() != 0.0) {
340 m_phi0Vec *= (1. / m_phi0Vec.R());
341 }
342 m_phi0 = m_phi0Vec.Phi();
343 m_impact = (center.R() - std::fabs(absRadius)) * static_cast<double>(orientation);
344}
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 453 of file PerigeeCircle.h.

454 {
455 m_curvature = curvature;
456 }

◆ setImpact()

void setImpact ( double impact)
inline

Sets the impact parameter of the circle.

Definition at line 473 of file PerigeeCircle.h.

474 {
475 m_impact = impact;
476 }

◆ setN() [1/4]

void setN ( const GeneralizedCircle & n0123)
inline

Setter for four generalised circle parameters.

Definition at line 400 of file PerigeeCircle.h.

401 {
402 setN(n0123.n0(), n0123.n12(), n0123.n3());
403 }

◆ setN() [2/4]

void setN ( const Line2D & n012)
inline

Setter for generalised circle parameters from a normal line.

Definition at line 394 of file PerigeeCircle.h.

395 {
396 setN(n012.n0(), n012.n12());
397 }

◆ setN() [3/4]

void setN ( double n0,
const ROOT::Math::XYVector & n12,
double n3 = 0.0 )

Setter for four generalised circle parameters.

Definition at line 346 of file PerigeeCircle.cc.

347{
348 double normalization = sqrt(n12.Mag2() - 4 * n0 * n3);
349 m_curvature = 2 * n3 / normalization;
350 m_phi0Vec = VectorUtil::Orthogonal(n12);
351 if (m_phi0Vec.R() != 0.0) {
352 m_phi0Vec *= (1. / m_phi0Vec.R());
353 }
354 m_phi0 = m_phi0Vec.Phi();
355 m_impact = distance(n0 / normalization); // Uses the new curvature
356}

◆ 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 385 of file PerigeeCircle.h.

386 {
387 setN(n0, ROOT::Math::XYVector(n1, n2), n3);
388 }

◆ setPerigeeParameters() [1/2]

void setPerigeeParameters ( double curvature,
const ROOT::Math::XYVector & phi0Vec,
double impact )
inline

Setter for the perigee parameters.

Definition at line 479 of file PerigeeCircle.h.

480 {
481 m_impact = impact;
482 m_phi0 = phi0Vec.Phi();
483 m_phi0Vec = VectorUtil::unit(phi0Vec);
484 m_curvature = curvature;
485 }

◆ setPerigeeParameters() [2/2]

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

Setter for the perigee parameters.

Definition at line 488 of file PerigeeCircle.h.

489 {
490 m_impact = impact;
491 m_phi0 = phi0;
492 m_phi0Vec = VectorUtil::Phi(phi0);
493 m_curvature = curvature;
494 }

◆ setPhi0() [1/2]

void setPhi0 ( const ROOT::Math::XYVector & phi0Vec)
inline

Sets the unit direction of flight at the perigee.

Definition at line 466 of file PerigeeCircle.h.

467 {
468 m_phi0 = phi0Vec.Phi();
469 m_phi0Vec = VectorUtil::unit(phi0Vec);
470 }

◆ setPhi0() [2/2]

void setPhi0 ( double phi0)
inline

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

Definition at line 459 of file PerigeeCircle.h.

460 {
461 m_phi0 = phi0;
462 m_phi0Vec = VectorUtil::Phi(phi0);
463 }

◆ tangential() [1/2]

const ROOT::Math::XYVector & tangential ( ) const
inline

Getter for the tangtial vector at the perigee.

Definition at line 288 of file PerigeeCircle.h.

289 {
290 return phi0Vec();
291 }

◆ tangential() [2/2]

ROOT::Math::XYVector tangential ( const ROOT::Math::XYVector & point) const
inline

Tangential vector to the circle near the given position.

Definition at line 282 of file PerigeeCircle.h.

283 {
284 return VectorUtil::Orthogonal(normal(point));
285 }

Member Data Documentation

◆ m_curvature

double m_curvature = 0.0
private

Memory for the signed curvature.

Definition at line 505 of file PerigeeCircle.h.

◆ m_impact

double m_impact = 0.0
private

Memory for the signed impact parameter.

Definition at line 514 of file PerigeeCircle.h.

◆ m_phi0

double m_phi0 = NAN
private

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

Definition at line 508 of file PerigeeCircle.h.

◆ m_phi0Vec

ROOT::Math::XYVector m_phi0Vec
private

Cached unit direction of flight at the perigee.

Definition at line 511 of file PerigeeCircle.h.


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