11#include <Math/Vector3D.h>
31 inline double unfold(
double x,
int nx,
double A)
33 if (nx % 2 == 0)
return (nx * A + x);
34 else return (nx * A - x);
44 inline double unfold(
double kx,
int nx)
46 if (nx % 2 == 0)
return kx;
59 inline void fold(
double xu,
double A,
double& x,
double& kx,
int& nx)
78 inline double clip(
double x,
int Nx,
double A,
double xmi,
double xma)
81 x = std::max(std::min(x, xma), xmi) - Nx * A;
82 if (Nx % 2 != 0) x = -x;
94 return (j2 - j1 + 1 - std::abs(j1) % 2) / 2;
104 angle = fmod(angle, 2 * M_PI);
105 if (angle < 0) angle += 2 * M_PI;
114 inline void rotateUz(ROOT::Math::XYZVector& vec,
const ROOT::Math::XYZVector& z_Axis)
116 auto zAxis = z_Axis.Unit();
117 double cth = zAxis.Z();
118 double sth =
sqrt(1 - cth * cth);
120 if (cth < 0) vec = -vec;
123 double cfi = zAxis.X() / sth;
124 double sfi = zAxis.Y() / sth;
126 double x = cth * vec.X() + sth * vec.Z();
128 double z = -sth * vec.X() + cth * vec.Z();
129 vec.SetX(cfi * x - sfi * y);
130 vec.SetY(sfi * x + cfi * y);
double sqrt(double a)
sqrt for double
double unfold(double x, int nx, double A)
unfold a coordinate.
void rotateUz(ROOT::Math::XYZVector &vec, const ROOT::Math::XYZVector &z_Axis)
Replacement for a function TVector3::RotateUz which is not implemented in GenVector classes.
double clip(double x, int Nx, double A, double xmi, double xma)
Performs a clip on x w.r.t xmi and xma.
int getNumOfEven(int j1, int j2)
Returns number of even numbers in the range given by arguments.
void fold(double xu, double A, double &x, double &kx, int &nx)
fold a coordinate (inverse of unfold).
double within2PI(double angle)
Returns angle within 0 and 2PI.
Abstract base class for different kinds of events.