FastJet 3.0.2
|
00001 //---------------------------------------------------------------------- 00002 // This file distributed with FastJet has been obtained from SpartyJet 00003 // v2.20.0 by Pierre-Antoine Delsart, Kurtis L. Geerlings, Joey 00004 // Huston, Brian T. Martin and Chris Vermilion 00005 // For details, see http://www.pa.msu.edu/~huston/SpartyJet/ 00006 // http://projects.hepforge.org/spartyjet/ 00007 // 00008 // Changes from the original file are listed below. 00009 //---------------------------------------------------------------------- 00010 00011 // History of changes compared to the original LorentzVector.hh file 00012 // 00013 // 2011-11-14 Gregory Soyez <soyez@fastjet.fr> 00014 // 00015 // * removed some harmless warnings coming with the -Wshadow gcc option 00016 // 00017 // 2009-01-15 Gregory Soyez <soyez@fastjet.fr> 00018 // 00019 // * put the code in the fastjet::atlas namespace 00020 00021 #ifndef _LORENTZ_VECTOR_HH_ 00022 #define _LORENTZ_VECTOR_HH_ 00023 00024 #include <cmath> 00025 #include <fastjet/internal/base.hh> 00026 00027 #ifndef M_PI 00028 #define M_PI 3.141592653589793238462643383279502884197 00029 #endif 00030 00031 FASTJET_BEGIN_NAMESPACE 00032 00033 namespace atlas{ 00034 00035 class LorentzVector 00036 { 00037 public: 00038 00039 double px,py,pz,E; 00040 00041 LorentzVector(): px(0), py(0), pz(0), E(0) {} 00042 LorentzVector(double p1, double p2, double p3, double p0): px(p1), py(p2), pz(p3), E(p0) {} 00043 LorentzVector(const LorentzVector& lv): px(lv.px), py(lv.py), pz(lv.pz), E(lv.E) {} 00044 double p() const {return sqrt(px*px + py*py + pz*pz);} 00045 double pt() const {return sqrt(px*px + py*py);} 00046 double mt() const {return sqrt((E-pz)*(E+pz));} 00047 double y() const {return 0.5*log((E + pz)/(E - pz));} 00048 double Et() const {return E/p()*pt();} 00049 inline double et() const {return Et();} 00050 inline double e() const {return E;} 00051 double eta() const {return 0.5*log((p() + pz)/(p() - pz));} 00052 double phi() const 00053 { 00054 double r = atan2(py,px); 00055 if(r < 0) 00056 r += 2*M_PI; 00057 return r; 00058 } 00059 void add(LorentzVector v) 00060 { 00061 px += v.px; 00062 py += v.py; 00063 pz += v.pz; 00064 E += v.E; 00065 } 00066 void subtract(LorentzVector v) 00067 { 00068 px -= v.px; 00069 py -= v.py; 00070 pz -= v.pz; 00071 E -= v.E; 00072 } 00073 bool isEqual(LorentzVector v) 00074 { 00075 return px == v.px && py == v.py && pz == v.pz && E == v.E; 00076 } 00077 }; 00078 00079 } // namespace atlas 00080 00081 FASTJET_END_NAMESPACE 00082 00083 #endif