1 | #ifndef _LORENTZ_VECTOR_HH_ |
---|
2 | #define _LORENTZ_VECTOR_HH_ |
---|
3 | |
---|
4 | //---------------------------------------------------------------------- |
---|
5 | // This file distributed with FastJet has been obtained from |
---|
6 | // http://www.pa.msu.edu/~huston/Les_Houches_2005/JetClu+Midpoint-StandAlone.tgz |
---|
7 | // |
---|
8 | // Permission to distribute it with FastJet has been granted by Joey |
---|
9 | // Huston (see the COPYING file in the main FastJet directory for |
---|
10 | // details). |
---|
11 | // Changes from the original file are listed below. |
---|
12 | //---------------------------------------------------------------------- |
---|
13 | |
---|
14 | // History of changes compared to the original LorentzVector.hh file |
---|
15 | // |
---|
16 | // 2011-11-14 Gregory Soyez <soyez@fastjet.fr> |
---|
17 | // |
---|
18 | // * removed some harmless warnings coming with the -Wshadow gcc option |
---|
19 | // |
---|
20 | // 2009-01-17 Gregory Soyez <soyez@fastjet.fr> |
---|
21 | // |
---|
22 | // * put the code in the fastjet::cdf namespace |
---|
23 | // |
---|
24 | // 2008-01-15 Gregory Soyez <soyez@fastjet.fr> |
---|
25 | // |
---|
26 | // * fixed issues with compilation under VC (definition of M_PI) |
---|
27 | // |
---|
28 | // 2007-02-21 Gavin Salam <salam@lpthe.jussieu.fr> |
---|
29 | // |
---|
30 | // * added option of choosing the scale used in the split-merge |
---|
31 | // procedure (pt [default], Et or mt) |
---|
32 | // |
---|
33 | // 2006-09-24 Gavin Salam <salam@lpthe.jussieu.fr> |
---|
34 | // |
---|
35 | // * added JetClu+MidPoint to FastJet |
---|
36 | |
---|
37 | #include <cmath> |
---|
38 | |
---|
39 | #ifndef M_PI |
---|
40 | #define M_PI 3.141592653589793238462643383279502884197 |
---|
41 | #endif |
---|
42 | |
---|
43 | #include <fastjet/internal/base.hh> |
---|
44 | |
---|
45 | FASTJET_BEGIN_NAMESPACE |
---|
46 | |
---|
47 | namespace cdf{ |
---|
48 | |
---|
49 | class LorentzVector |
---|
50 | { |
---|
51 | public: |
---|
52 | |
---|
53 | double px,py,pz,E; |
---|
54 | |
---|
55 | LorentzVector(): px(0), py(0), pz(0), E(0) {} |
---|
56 | LorentzVector(double p1, double p2, double p3, double p0): px(p1), py(p2), pz(p3), E(p0) {} |
---|
57 | LorentzVector(const LorentzVector& lv): px(lv.px), py(lv.py), pz(lv.pz), E(lv.E) {} |
---|
58 | double p() const {return sqrt(px*px + py*py + pz*pz);} |
---|
59 | double pt() const {return sqrt(px*px + py*py);} |
---|
60 | double mt() const {return sqrt((E-pz)*(E+pz));} |
---|
61 | double y() const {return 0.5*log((E + pz)/(E - pz));} |
---|
62 | double Et() const {return E/p()*pt();} |
---|
63 | double eta() const {return 0.5*log((p() + pz)/(p() - pz));} |
---|
64 | double phi() const |
---|
65 | { |
---|
66 | double r = atan2(py,px); |
---|
67 | if(r < 0) |
---|
68 | r += 2*M_PI; |
---|
69 | return r; |
---|
70 | } |
---|
71 | void add(LorentzVector v) |
---|
72 | { |
---|
73 | px += v.px; |
---|
74 | py += v.py; |
---|
75 | pz += v.pz; |
---|
76 | E += v.E; |
---|
77 | } |
---|
78 | void subtract(LorentzVector v) |
---|
79 | { |
---|
80 | px -= v.px; |
---|
81 | py -= v.py; |
---|
82 | pz -= v.pz; |
---|
83 | E -= v.E; |
---|
84 | } |
---|
85 | bool isEqual(LorentzVector v) |
---|
86 | { |
---|
87 | return px == v.px && py == v.py && pz == v.pz && E == v.E; |
---|
88 | } |
---|
89 | }; |
---|
90 | |
---|
91 | } // namespace cdf |
---|
92 | |
---|
93 | FASTJET_END_NAMESPACE |
---|
94 | |
---|
95 | #endif |
---|