Fork me on GitHub

source: git/external/fastjet/plugins/D0RunIICone/inline_maths.h@ f59a7b6

ImprovedOutputFile Timing dual_readout llp
Last change on this file since f59a7b6 was d7d2da3, checked in by pavel <pavel@…>, 12 years ago

move branches/ModularDelphes to trunk

  • Property mode set to 100644
File size: 1.5 KB
Line 
1#ifndef INLINE_MATHS
2#define INLINE_MATHS
3
4// This file is distributed with FastJet under the terms of the GNU
5// General Public License (v2). Permission to do so has been granted
6// by Lars Sonnenschein and the D0 collaboration (see COPYING for
7// details)
8//
9// History of changes in FastJet compared tothe original version of
10// inline_math.h
11//
12// 2011-12-13 Gregory Soyez <soyez@fastjet.fr>
13//
14// * added license information
15//
16// 2009-01-17 Gregory Soyez <soyez@fastjet.fr>
17//
18// * put the code in the fastjet::d0 namespace
19
20#include <cerrno>
21
22#include <fastjet/internal/base.hh>
23
24FASTJET_BEGIN_NAMESPACE
25
26namespace d0{
27
28namespace inline_maths {
29
30const double PI = fabs(acos(-1.));
31
32const double TWOPI = 2*PI;
33
34
35inline double sqr(double a) {
36 return a*a;
37}
38
39
40
41inline double min(double a, double b) {
42 return (a < b) ? a : b;
43}
44
45
46
47inline double delta_phi(double phi1, double phi2) {
48 return min( double(fabs(phi1-phi2)), double(2.*PI-fabs(phi1-phi2)) );
49}
50
51
52
53inline double phi(double px, double py) {
54 return atan2(py, px);
55}
56
57
58
59inline double y(double E, double pz) {
60 errno=0;
61 double y;
62 //cout << "inline_maths: ";
63 if (fabs(E-pz) == 0.) {
64 // cout << "Error in header mathe.h: division by 0 in function eta!" << " p=" << p << " pz=" << pz << endl;
65 // exit(721);
66 errno=721;
67 y = 99999.;
68 }
69 else {
70 y = 0.5*log((E+pz)/(E-pz));
71 }
72 //cout << "y: E=" << E << " pz=" << pz << " y=" << y << endl;
73 return y;
74}
75
76
77} //end usename inline_maths
78
79
80} // namespace d0
81
82FASTJET_END_NAMESPACE
83
84#endif
Note: See TracBrowser for help on using the repository browser.