36#define M_PI 3.141592653589793238462643383279502884197
43inline double phi_in_range(
double phi) {
44 if (phi <= -M_PI) phi +=
twopi;
45 else if (phi > M_PI) phi -=
twopi;
52inline double dphi(
double phi1,
double phi2) {
53 return phi_in_range(phi1-phi2);
60inline double abs_dphi(
double phi1,
double phi2) {
61 double delta = fabs(phi1-phi2);
62 return delta > M_PI ?
twopi-delta : delta;
66inline double pow2(
double x) {
return x*x;}
87 inline double mod2()
const {
return pow2(
x)+pow2(y);}
98inline double dot_product(
const Ctwovect & a,
const Ctwovect & b) {
99 return a.x*b.x + a.y*b.y;
107inline double cross_product(
const Ctwovect & a,
const Ctwovect & b) {
108 return a.x*b.y - a.y*b.x;
154 inline unsigned int get_eta_cell(
double eta){
159 inline unsigned int get_phi_cell(
double phi){
160 return (
unsigned int) (1u << ((int) (32*phi/
twopi+16)%32));
168bool is_range_overlap(
const Ceta_phi_range &r1,
const Ceta_phi_range &r2);
175const Ceta_phi_range range_union(
const Ceta_phi_range &r1,
const Ceta_phi_range &r2);
class for holding a covering range in eta-phi
unsigned int eta_range
eta range as a binary coding of covered cells
static double eta_max
maximal value for eta
int add_particle(const double eta, const double phi)
add a particle to the range
static double eta_min
minimal value for eta
Ceta_phi_range & operator=(const Ceta_phi_range &r)
assignment of range
Ceta_phi_range()
default ctor
unsigned int phi_range
phi range as a binary coding of covered cells
class for holding a two-vector
double mod2() const
norm (modulud square) of the vector
double x
vector coordinates
double modulus() const
modulus of the vector
Ctwovect(double _x, double _y)
ctor with initialisation
const double twopi
definition of 2*M_PI which is useful a bit everyhere!