Last change
on this file since 532 was 35, checked in by Xavier Rouby, 16 years ago |
first attemp towers CMS
|
File size:
1.2 KB
|
Line | |
---|
1 | #ifndef _LORENTZ_VECTOR_HH_
|
---|
2 | #define _LORENTZ_VECTOR_HH_
|
---|
3 |
|
---|
4 | #include <cmath>
|
---|
5 |
|
---|
6 | #ifndef M_PI
|
---|
7 | #define M_PI 3.141592653589793238462643383279502884197
|
---|
8 | #endif
|
---|
9 |
|
---|
10 | class LorentzVector
|
---|
11 | {
|
---|
12 | public:
|
---|
13 |
|
---|
14 | double px,py,pz,E;
|
---|
15 |
|
---|
16 | LorentzVector(): px(0), py(0), pz(0), E(0) {}
|
---|
17 | LorentzVector(double p1, double p2, double p3, double p0): px(p1), py(p2), pz(p3), E(p0) {}
|
---|
18 | LorentzVector(const LorentzVector& p): px(p.px), py(p.py), pz(p.pz), E(p.E) {}
|
---|
19 | double p() const {return sqrt(px*px + py*py + pz*pz);}
|
---|
20 | double pt() const {return sqrt(px*px + py*py);}
|
---|
21 | double mt() const {return sqrt((E-pz)*(E+pz));}
|
---|
22 | double y() const {return 0.5*log((E + pz)/(E - pz));}
|
---|
23 | double Et() const {return E/p()*pt();}
|
---|
24 | double eta() const {return 0.5*log((p() + pz)/(p() - pz));}
|
---|
25 | double phi() const
|
---|
26 | {
|
---|
27 | double r = atan2(py,px);
|
---|
28 | if(r < 0)
|
---|
29 | r += 2*M_PI;
|
---|
30 | return r;
|
---|
31 | }
|
---|
32 | void add(const LorentzVector& v)
|
---|
33 | {
|
---|
34 | px += v.px;
|
---|
35 | py += v.py;
|
---|
36 | pz += v.pz;
|
---|
37 | E += v.E;
|
---|
38 | }
|
---|
39 | void subtract(const LorentzVector& v)
|
---|
40 | {
|
---|
41 | px -= v.px;
|
---|
42 | py -= v.py;
|
---|
43 | pz -= v.pz;
|
---|
44 | E -= v.E;
|
---|
45 | }
|
---|
46 | bool isEqual(const LorentzVector& v)
|
---|
47 | {
|
---|
48 | return px == v.px && py == v.py && pz == v.pz && E == v.E;
|
---|
49 | }
|
---|
50 | };
|
---|
51 |
|
---|
52 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.