 |
Belle II Software
release-05-01-25
|
10 #include <tracking/trackFindingCDC/numerics/SinEqLine.h>
12 #include <framework/logging/Logger.h>
17 using namespace TrackFindingCDC;
23 if (root > 0)
return root;
28 if (root > 0)
return root;
30 for (
int iHalfPeriod = 1; iHalfPeriod <= maxIHalfPeriod; ++iHalfPeriod) {
34 if (root > 0)
return root;
59 if (xLineIsPlusOne > xLineIsMinusOne) {
62 }
else if (xLineIsPlusOne < xLineIsMinusOne) {
71 if (not(lowerX < upperX))
return NAN;
79 B2INFO(
"Coverage early");
98 if (not updatedBound)
return NAN;
110 if (not updatedBound) {
118 if (not updatedBound) {
124 if (not updatedBound)
break;
139 return (lower.
x() + upper.
x()) / 2.0;
144 return (lower.
x() * upper.
y() - upper.
x() * lower.
y()) / (upper.
y() - lower.
y());
149 return pos.x() - pos.y() /
gradient(pos.x());
155 if (not
isBetween(lower, next, upper))
return false;
158 if (incDecInfo == EIncDec::c_Increasing) {
159 if (next.
y() > 0.0 and upper.
y() > 0.0) {
163 }
else if (next.
y() <= 0.0 and lower.
y() <= 0.0) {
171 }
else if (incDecInfo == EIncDec::c_Decreasing) {
172 if (next.
y() >= 0 and lower.
y() >= 0.0) {
176 }
else if (next.
y() < 0 and upper.
y() < 0) {
191 double extremumInFirstHalfPeriod = acos(slope);
193 double extremumInFirstPeriod =
194 isEven(iHalfPeriod) ? extremumInFirstHalfPeriod : 2 * M_PI - extremumInFirstHalfPeriod;
197 return extremumInFirstPeriod + 2 * M_PI * iPeriod;
double getSlope() const
Getter for the slope.
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.
void setY(const double y)
Setter for the y coordinate.
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.
static EIncDec getEIncDec(const Vector2D &lower, const Vector2D &upper)
Determines if the function is increasing or decreasing in the intervall.
void setX(const double x)
Setter for the x coordinate.
static double getConvergedBound(const Vector2D &lower, const Vector2D &upper)
Returns the better solution x from the bounds of the intervall.
void set(const double first, const double second)
Setter for both coordinate.
double computeRootForLargeSlope() const
Compute single solution in the case that fabs(slope) >= 1.
double computeExtremumXInHalfPeriod(int iHalfPeriod) const
Get the local extermum that is located in the half period indicated by the given index.