 |
Belle II Software
release-05-01-25
|
12 #include <tracking/trackFindingCDC/numerics/Modulo.h>
14 #include <tracking/trackFindingCDC/geometry/Line2D.h>
15 #include <tracking/trackFindingCDC/geometry/Vector2D.h>
17 #include <tracking/trackFindingCDC/numerics/EIncDec.h>
27 namespace TrackFindingCDC {
55 SinEqLine(
const double slope,
const double intercept) :
62 double map(
const double x)
const
66 double gradient(
const double x)
const
71 {
return floor(x / M_PI); }
103 {
return lower.
x() < next.
x() and next.
x() < upper.
x(); }
108 return fabs(lower.
y()) < 10e-7 or fabs(upper.
y()) < 10e-7;
114 if (not std::isfinite(lower.
y()) or not std::isfinite(upper.
y())) {
118 if (fabs(lower.
y()) <= fabs(upper.
y())) {
122 if (fabs(lower.
y()) > fabs(upper.
y())) {
131 static bool changesSign(
const Vector2D& lower,
const Vector2D& upper)
132 {
return (lower.y() > 0 and upper.y() < 0) or (lower.y() < 0 and upper.y() > 0); }
137 if (lower.y() < upper.y()) {
138 return EIncDec::c_Increasing;
139 }
else if (lower.y() > upper.y()) {
140 return EIncDec::c_Decreasing;
141 }
else if (lower.y() == upper.y()) {
142 return EIncDec::c_Constant;
144 return EIncDec::c_Invalid;
154 {
return isEven(iHalfPeriod) ? iHalfPeriod / 2 : (iHalfPeriod - 1) / 2; }
double getSlope() const
Getter for the slope.
double m_intercept
Memory for the intercept.
static bool changesSign(const Vector2D &lower, const Vector2D &upper)
Checks if the function changes sign in the intervall.
static bool isConverged(const Vector2D &lower, const Vector2D &upper)
Check if the intervall has shrunk close enough to the solution.
double m_slope
Memory for the slope.
double newtonX(const Vector2D &pos) const
Shrinking method of the newton algorithm return the next candidate root.
A two dimensional vector which is equipped with functions for correct handeling of orientation relat...
static int getIPeriodFromIHalfPeriod(int iHalfPeriod)
Helper function to translate the index of the half period to index of the containing period.
EIncDec
Enumeration to represent the distinct possibilities of the right left passage information.
double y() const
Getter for the y coordinate.
static bool updateBounds(Vector2D &lower, Vector2D &upper, const Vector2D &next)
Replaces the lower or upper bound inplace if the next candidate position is valid and within the inte...
double map(const double x) const
Interpreting as the function f this method carries out the translation from x to y coordinates.
static bool isBetween(const Vector2D &lower, const Vector2D &next, const Vector2D &upper)
Check is next position is within the intervall given by lower and upper.
double gradient(const double x) const
Interpreting as the function f this method calculates the gradient as need in Newtons algorithms.
double computeSmallestPositiveRoot(int maxIHalfPeriod=5) const
double getIntercept() const
Getter for the intercept.
Abstract base class for different kinds of events.
static double middleX(const Vector2D &lower, const Vector2D &upper)
Simple fall back shrinking method using trivial devision of the intervall.
static double secantX(const Vector2D &lower, const Vector2D &upper)
Fall back shrinking method to the secant algorithm.
double computeRootLargerThanExtemumInHalfPeriod(int iHalfPeriod) const
Computes the solution that is addressed by the given half period index.
bool hasLargeSlope() const
Indicates that the slope is so large such that the function has no local exterma.
double computeRootInInterval(double lowerX, double upperX) const
Computes the solution in between the given x values. The x values are generally choosen consecutive l...
double x() const
Getter for the x coordinate.
A two dimensional normal line.
static EIncDec getEIncDec(const Vector2D &lower, const Vector2D &upper)
Determines if the function is increasing or decreasing in the intervall.
static double getConvergedBound(const Vector2D &lower, const Vector2D &upper)
Returns the better solution x from the bounds of the intervall.
double computeRootForLargeSlope() const
Compute single solution in the case that fabs(slope) >= 1.
SinEqLine()
Default constructor initializing slope and intercept to zero.
double computeExtremumXInHalfPeriod(int iHalfPeriod) const
Get the local extermum that is located in the half period indicated by the given index.
int getIHalfPeriod(const double x) const
Returns the half period index in which the x position is located.