22 #include <fastjet/internal/base.hh>
24 FASTJET_BEGIN_NAMESPACE
29 namespace inline_maths {
31 const double PI = fabs(acos(-1.));
33 const double TWOPI = 2*PI;
36 inline double sqr(
double a) {
42 inline double min(
double a,
double b) {
43 return (a < b) ? a : b;
48 inline double delta_phi(
double phi1,
double phi2) {
49 double dphi = min(
double(fabs(phi1-phi2)),
double(2.*PI-fabs(phi1-phi2)) );
50 return (phi1 < phi2) ? -dphi : dphi;
55 inline double phi(
double px,
double py) {
61 inline double y(
double E,
double pz) {
65 if (fabs(E-pz) == 0.) {
72 y = 0.5*log((E+pz)/(E-pz));
81 inline double eta(
double p,
double pz) {
85 if (fabs(p-pz) == 0.) {
92 eta = 0.5*log((p+pz)/(p-pz));
101 inline double eta(
double px,
double py,
double pz) {
105 double p = sqrt(px*px+py*py+pz*pz);
106 if (fabs(p-pz) == 0.) {
113 eta = 0.5*log((p+pz)/(p-pz));
121 inline double eta(
double theta) {
122 double eta = -log(tan(theta/2.));
128 inline double theta(
double eta) {
129 double theta = 2.*atan(exp(-eta));
134 inline double theta(
double px,
double py,
double pz) {
135 double Eta = eta(px, py, pz);
136 double theta = 2.*atan(exp(-Eta));
146 FASTJET_END_NAMESPACE