10#include <tracking/trackingUtilities/geometry/GeneralizedCircle.h>
11#include <tracking/trackingUtilities/geometry/Line2D.h>
13#include <tracking/trackingUtilities/geometry/PerigeeParameters.h>
15#include <tracking/trackingUtilities/geometry/VectorUtil.h>
17#include <tracking/trackingUtilities/numerics/EForwardBackward.h>
18#include <tracking/trackingUtilities/numerics/ERightLeft.h>
19#include <tracking/trackingUtilities/numerics/ERotation.h>
20#include <tracking/trackingUtilities/numerics/ESign.h>
22#include <Math/Vector2D.h>
34 namespace TrackingUtilities {
86 ERotation
orientation = ERotation::c_CounterClockwise);
139 ROOT::Math::XYVector
atArcLength(
double arcLength)
const;
142 double arcLengthTo(
const ROOT::Math::XYVector& point)
const;
153 double arcLengthBetween(
const ROOT::Math::XYVector& from,
const ROOT::Math::XYVector& to)
const;
164 std::pair<ROOT::Math::XYVector, ROOT::Math::XYVector>
atCylindricalR(
double cylindricalR)
const;
179 ROOT::Math::XYVector
atCylindricalRForwardOf(
const ROOT::Math::XYVector& startPoint,
double cylindricalR)
const;
184 return VectorUtil::isForwardOrBackwardOf(
tangential(from), (to - from));
190 return VectorUtil::isForwardOrBackwardOf(
tangential(), to);
207 chooseNextForwardOf(
const ROOT::Math::XYVector& start,
const ROOT::Math::XYVector& end1,
const ROOT::Math::XYVector& end2)
const;
209 ROOT::Math::XYVector
closest(
const ROOT::Math::XYVector& point)
const;
212 double distance(
const ROOT::Math::XYVector& point)
const
228 double fastDistance(
const ROOT::Math::XYVector& point)
const;
248 return static_cast<ERightLeft
>(sign(
fastDistance(point)));
266 return static_cast<ERotation
>(sign(
curvature()));
270 ROOT::Math::XYVector
gradient(
const ROOT::Math::XYVector& point)
const
276 ROOT::Math::XYVector
normal(
const ROOT::Math::XYVector& point)
const
278 return VectorUtil::unit(
gradient(point));
282 ROOT::Math::XYVector
tangential(
const ROOT::Math::XYVector& point)
const
284 return VectorUtil::Orthogonal(
normal(point));
332 return 2 * M_PI *
radius();
350 ERotation
orientation = ERotation::c_CounterClockwise);
359 ROOT::Math::XYVector
n12()
const
391 void setN(
double n0,
const ROOT::Math::XYVector&
n12,
double n3 = 0.0);
445 PerigeeParameters result;
447 result(c_Phi0) =
phi0();
519 std::ostream& operator<<(std::ostream& output,
const PerigeeCircle& circle);
A two dimensional circle in its natural representation using center and radius as parameters.
const ROOT::Math::XYVector & n12() const
Getter for the second and third circle parameter which natuarally from a vector.
double n3() const
Getter for the fourth circle parameter.
double n0() const
Getter for the first circle parameter.
A two dimensional normal line.
const ROOT::Math::XYVector & n12() const
Getter for the unit normal vector to the line.
double n0() const
Getter for the first line parameter.
Extension of the generalized circle also caching the perigee coordinates.
PerigeeCircle reversed() const
Returns a copy of the circle with opposite orientation.
ROOT::Math::XYVector tangential(const ROOT::Math::XYVector &point) const
Tangential vector to the circle near the given position.
static PerigeeCircle fromCenterAndRadius(const ROOT::Math::XYVector ¢er, double absRadius, ERotation orientation=ERotation::c_CounterClockwise)
Constructor from center, radius and a optional orientation.
double fastImpact() const
Getter for the linearised distance to the origin.
double m_phi0
Memory for the azimuth angle of the direction of flight at the perigee.
double n1() const
Getter for the generalised circle parameters n1.
double arcLengthTo(const ROOT::Math::XYVector &point) const
Calculates the arc length between the perigee and the given point.
ROOT::Math::XYVector gradient(const ROOT::Math::XYVector &point) const
Gradient of the distance field, hence indicates the direction of increasing distance.
bool isLine() const
Indicates if the perigee parameters represent a line.
ROOT::Math::XYVector apogee() const
Getter for the apogee of the circle. If it was a line both components will be infinity.
double phi0() const
Getter for the azimuth angle of the direction of flight at the perigee.
double fastDistance(const ROOT::Math::XYVector &point) const
Getter for the linearised distance measure to a point.
bool isInvalid() const
Indicates if all circle parameters are zero.
double minimalCylindricalR() const
Gives the minimal cylindrical radius the circle reaches (unsigned)
void reverse()
Flips the orientation of the circle in place.
void setPerigeeParameters(double curvature, const ROOT::Math::XYVector &phi0Vec, double impact)
Setter for the perigee parameters.
EForwardBackward isForwardOrBackward(const ROOT::Math::XYVector &to) const
Indicates whether to given point lies in the forward direction from the perigee.
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 radius() const
Gives the signed radius of the circle. If it was a line this will be infinity.
void setCurvature(double curvature)
Setter for signed curvature.
void setN(const Line2D &n012)
Setter for generalised circle parameters from a normal line.
void setCenterAndRadius(const ROOT::Math::XYVector ¢er, double absRadius, ERotation orientation=ERotation::c_CounterClockwise)
Setter for the circle center and radius.
ROOT::Math::XYVector closest(const ROOT::Math::XYVector &point) const
Calculates the point of closest approach on the circle to the given point.
double omega() const
Getter for omega parameter of the common Belle2::Helix which is the wrong sign curvature.
bool isValid() const
Indicates if the combination of the circle parameters makes up a valid circle.
void setN(const GeneralizedCircle &n0123)
Setter for four generalised circle parameters.
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.
void setImpact(double impact)
Sets the impact parameter of the circle.
ROOT::Math::XYVector normal(const ROOT::Math::XYVector &point) const
Unit normal vector from the circle to the given point.
double impact() const
Getter for the signed distance of the origin to the circle.
double maximalCylindricalR() const
Gives the maximal cylindrical radius the circle reaches.
double distance(const ROOT::Math::XYVector &point) const
Getter for the proper signed distance of the point to the circle.
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...
double n3() const
Getter for the generalised circle parameter n3.
void invalidate()
Sets all circle parameters to zero.
ERightLeft isRightOrLeft(const ROOT::Math::XYVector &point) const
Indicates if the point is on the right or left side of the circle.
ROOT::Math::XYVector perigee() const
Getter for the perigee point.
PerigeeParameters perigeeParameters() const
Getter for the three perigee parameters in the order defined by EPerigeeParameter....
void passiveMoveBy(const ROOT::Math::XYVector &by)
Moves the coordinates system by the given vector. Updates perigee parameters in place.
void conformalTransform()
Transforms the generalized circle to conformal space inplace.
double m_impact
Memory for the signed impact parameter.
double perimeter() const
Gives the signed perimeter of the circle.
double n2() const
Getter for the generalised circle parameters n2.
bool isCircle() const
Indicates if the perigee parameters represent a closed circle.
PerigeeJacobian passiveMoveByJacobian(const ROOT::Math::XYVector &by) const
Computes the Jacobi matrix for a move of the coordinate system by the given vector.
PerigeeCircle()
Default constructor for ROOT compatibility.
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 ...
ROOT::Math::XYVector atArcLength(double arcLength) const
Calculates the point, which lies at the give perpendicular travel distance (counted from the perigee)
double m_curvature
Memory for the signed curvature.
double curvature() const
Getter for the signed curvature.
void setN(double n0, double n1, double n2, double n3=0.0)
Setter for four generalised circle parameters.
double d0() const
Getter for d0 parameter of the common Belle2::Helix representation.
double absRadius() const
Gives the signed radius of the circle. If it was a line this will be infinity.
double fastDistance(double distance) const
Helper function to translate the proper distance to the linearized distance measure of the circle ret...
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.
double arcLengthAtSecantLength(double secantLength) const
Helper method to calculate the arc length between to points on the circle from a given direct secant ...
PerigeeCircle conformalTransformed() const
Returns a copy of the circle in conformal space.
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 star...
void setPhi0(double phi0)
Sets the azimuth angle of the direction of flight at the perigee.
void setPerigeeParameters(double curvature, double phi0, double impact)
Setter for the perigee parameters.
ROOT::Math::XYVector center() const
Getter for the center of the circle. If it was a line both components will be infinity.
const ROOT::Math::XYVector & tangential() const
Getter for the tangtial vector at the perigee.
const ROOT::Math::XYVector & phi0Vec() const
Getter for the unit vector of the direction of flight at the perigee.
ROOT::Math::XYVector n12() const
Getter for the generalised circle parameters n1 and n2.
double n0() const
Getter for the generalised circle parameter n0.
void setPhi0(const ROOT::Math::XYVector &phi0Vec)
Sets the unit direction of flight at the perigee.
ROOT::Math::XYVector m_phi0Vec
Cached unit direction of flight at the perigee.
static PerigeeCircle fromN(double n0, double n1, double n2, double n3=0)
Constructor with the four parameters of the generalized circle.
ERotation orientation() const
Getter for the orientation of the circle.
double arcLengthPeriod() const
Getter for the arc length for a full round of the circle.
double arcLengthToCylindricalR(double cylindricalR) const
Calculates the two dimensional arc length till the cylindrical radius is reached If the radius can no...
Namespace to hide the contained enum constants.
Abstract base class for different kinds of events.