[1] | 1 | //---------------------------------------------------------------------- |
---|
| 2 | // This file distributed with FastJet has been obtained from SpartyJet |
---|
| 3 | // v2.20.0 by Pierre-Antoine Delsart, Kurtis L. Geerlings, Joey |
---|
| 4 | // Huston, Brian T. Martin and Chris Vermilion |
---|
| 5 | // For details, see http://www.pa.msu.edu/~huston/SpartyJet/ |
---|
| 6 | // http://projects.hepforge.org/spartyjet/ |
---|
| 7 | // |
---|
| 8 | // Changes from the original file are listed below. |
---|
| 9 | //---------------------------------------------------------------------- |
---|
| 10 | |
---|
| 11 | // History of changes compared to the original LorentzVector.hh file |
---|
| 12 | // |
---|
| 13 | // 2011-11-14 Gregory Soyez <soyez@fastjet.fr> |
---|
| 14 | // |
---|
| 15 | // * removed some harmless warnings coming with the -Wshadow gcc option |
---|
| 16 | // |
---|
| 17 | // 2009-01-15 Gregory Soyez <soyez@fastjet.fr> |
---|
| 18 | // |
---|
| 19 | // * put the code in the fastjet::atlas namespace |
---|
| 20 | |
---|
| 21 | #ifndef _LORENTZ_VECTOR_HH_ |
---|
| 22 | #define _LORENTZ_VECTOR_HH_ |
---|
| 23 | |
---|
| 24 | #include <cmath> |
---|
| 25 | #include <fastjet/internal/base.hh> |
---|
| 26 | |
---|
| 27 | #ifndef M_PI |
---|
| 28 | #define M_PI 3.141592653589793238462643383279502884197 |
---|
| 29 | #endif |
---|
| 30 | |
---|
| 31 | FASTJET_BEGIN_NAMESPACE |
---|
| 32 | |
---|
| 33 | namespace atlas{ |
---|
| 34 | |
---|
| 35 | class LorentzVector |
---|
| 36 | { |
---|
| 37 | public: |
---|
| 38 | |
---|
| 39 | double px,py,pz,E; |
---|
| 40 | |
---|
| 41 | LorentzVector(): px(0), py(0), pz(0), E(0) {} |
---|
| 42 | LorentzVector(double p1, double p2, double p3, double p0): px(p1), py(p2), pz(p3), E(p0) {} |
---|
| 43 | LorentzVector(const LorentzVector& lv): px(lv.px), py(lv.py), pz(lv.pz), E(lv.E) {} |
---|
| 44 | double p() const {return sqrt(px*px + py*py + pz*pz);} |
---|
| 45 | double pt() const {return sqrt(px*px + py*py);} |
---|
| 46 | double mt() const {return sqrt((E-pz)*(E+pz));} |
---|
| 47 | double y() const {return 0.5*log((E + pz)/(E - pz));} |
---|
| 48 | double Et() const {return E/p()*pt();} |
---|
| 49 | inline double et() const {return Et();} |
---|
| 50 | inline double e() const {return E;} |
---|
| 51 | double eta() const {return 0.5*log((p() + pz)/(p() - pz));} |
---|
| 52 | double phi() const |
---|
| 53 | { |
---|
| 54 | double r = atan2(py,px); |
---|
| 55 | if(r < 0) |
---|
| 56 | r += 2*M_PI; |
---|
| 57 | return r; |
---|
| 58 | } |
---|
| 59 | void add(LorentzVector v) |
---|
| 60 | { |
---|
| 61 | px += v.px; |
---|
| 62 | py += v.py; |
---|
| 63 | pz += v.pz; |
---|
| 64 | E += v.E; |
---|
| 65 | } |
---|
| 66 | void subtract(LorentzVector v) |
---|
| 67 | { |
---|
| 68 | px -= v.px; |
---|
| 69 | py -= v.py; |
---|
| 70 | pz -= v.pz; |
---|
| 71 | E -= v.E; |
---|
| 72 | } |
---|
| 73 | bool isEqual(LorentzVector v) |
---|
| 74 | { |
---|
| 75 | return px == v.px && py == v.py && pz == v.pz && E == v.E; |
---|
| 76 | } |
---|
| 77 | }; |
---|
| 78 | |
---|
| 79 | } // namespace atlas |
---|
| 80 | |
---|
| 81 | FASTJET_END_NAMESPACE |
---|
| 82 | |
---|
| 83 | #endif |
---|