78 const double xCenter = (x_interval.second + x_interval.first) / 2.;
79 const double yCenter = (y_interval.second + y_interval.first) / 2.;
80 const double delta = std::fabs(yCenter - xCenter);
83 const double xArm = x_interval.second - xCenter;
84 const double yArm = yCenter - y_interval.first;
85 const double sigmaSum = xArm + yArm;
86 if (delta < sigmaSum)
return true;
89 const double xArm = xCenter - x_interval.first;
90 const double yArm = y_interval.second - yCenter;
91 const double sigmaSum = xArm + yArm;
92 if (std::fabs(delta) < sigmaSum)
return true;
135 const Interval y(angle.getLowerIntervalBoundary(sigma), angle.getUpperIntervalBoundary(sigma));
177 const double twoPi = TMath::TwoPi();
179 const Interval y(angle.getLowerIntervalBoundary(sigma), angle.getUpperIntervalBoundary(sigma));
182 const double shift = x.first;
183 const Interval xShifted(x.first - shift, x.second - shift);
184 const Interval yShifted(y.first - shift, y.second - shift);
186 if (twoPi < xShifted.second)
return true;
188 if ((yShifted.first <= 0) and (twoPi < yShifted.second))
return true;
190 if ((0. <= yShifted.first) and (yShifted.second < twoPi)) {
194 if (!(0. <= yShifted.first) and (yShifted.second < twoPi)) {
195 const Interval y1(y.first + twoPi, twoPi);
203 if ((0 <= yShifted.first) and !(yShifted.second < twoPi)) {
205 const Interval y2(0., y.second - twoPi);
Class to compare if two angles are compatible withing a given error range.
bool intervalsCompatible(const Interval &x_interval, const Interval &y_interval) const
Checks if the intervals overlap at some point.
double getLowerIntervalBoundary(double sigma=1) const
Getter for the lower interval bound: angle-sigma*error.
double getErrorInDeg() const
Getter for the error of the angle in degrees.
BaseAngle(double angle, double error)
Constructor.
double getAngle() const
Getter for the angle.
double getUpperIntervalBoundary(double sigma=1) const
Getter for the upper interval bound: angle+sigma*error.
double getError() const
Getter for the error of the angle.
double getAngleInDeg() const
Getter for angle in degrees.
double m_error
Error in rad.
double m_angle
Angle in rad.
virtual ~BaseAngle()
Destructor.
std::pair< double, double > Interval
Shortcut for std::pair used as interval.
bool containsIn(const PhiAngle &angle, double sigma) const
Check if two angles are compatible.
PhiAngle(double angle, double error)
Constructor using radian units.
bool contains(const PhiAngle &angle) const
Check if two angles are compatible.
ThetaAngle(double angle, double error)
Constructor using radian units.
bool containsIn(const ThetaAngle &angle, double sigma) const
Check if two angles are compatible.
bool contains(const ThetaAngle &angle) const
Check if two angles are compatible.
Abstract base class for different kinds of events.