FastJet 3.0beta1
|
00001 #ifndef D0RunIconeJets_HepEntity_class 00002 #define D0RunIconeJets_HepEntity_class 00003 00004 #include "inline_maths.h" 00005 00006 namespace d0runi{ 00007 00008 //Author: Lars Sonnenschein 15/Sep/2009 00009 //This is an example class fulfilling the minimal requirements needed by the 00010 //D0 RunI cone jet algorithm implementation, which is an inlined template class 00011 00012 class HepEntityI { 00013 00014 public: 00015 00016 HepEntityI() { 00017 Et=0.; 00018 eta=0.; 00019 phi=0.; 00020 index = -1; 00021 return; 00022 } 00023 00024 00025 HepEntityI(double E, double px, double py, double pz, 00026 int index_in = -1) : index(index_in) { 00027 //Snowmass Et scheme 00028 double pt = sqrt(px*px+py*py); 00029 double p = sqrt(pt*pt+pz*pz); 00030 phi = inline_maths::phi(px,py); 00031 double theta = asin(pt/p); 00032 eta = inline_maths::eta(theta); 00033 00034 Et = E*sin(theta); 00035 00036 return; 00037 } 00038 00039 00040 00041 HepEntityI(const HepEntityI& in) : Et(in.Et), eta(in.eta), phi(in.phi), index(in.index) { 00042 return; 00043 } 00044 00045 00046 00047 00048 inline double pT() const { 00049 return Et; 00050 } 00051 00052 inline double px() const { 00053 return Et*cos(phi); 00054 } 00055 00056 inline double py() const { 00057 return Et*sin(phi); 00058 } 00059 00060 inline double pz() const { 00061 return Et*sinh(eta); 00062 } 00063 00064 inline double E() const { 00065 return Et*cosh(eta); 00066 } 00067 00068 00069 inline void p4vec(float* p) const { 00070 p[0] = Et*cos(phi); 00071 p[1] = Et*sin(phi); 00072 p[2] = Et*sinh(eta); 00073 p[3] = Et*cosh(eta); //E 00074 return; 00075 } 00076 00077 00078 inline void Add(const HepEntityI el) { 00079 //assumes Et, eta and phi stored accurately 00080 double w2 = el.Et; 00081 Et += el.Et; 00082 w2 /= Et; 00083 00084 eta += w2*(el.eta - eta); 00085 phi += w2*inline_maths::delta_phi(el.phi, phi); 00086 00087 return; 00088 } 00089 00090 00091 inline void Fill(double E, double px, double py, double pz, int index_in) { 00092 double pt = sqrt(px*px+py*py); 00093 double p = sqrt(pt*pt+pz*pz); 00094 phi = inline_maths::phi(px,py); 00095 double theta = asin(pt/p); 00096 eta = inline_maths::eta(theta); 00097 00098 Et = E*sin(theta); 00099 00100 index = index_in; 00101 00102 return; 00103 } 00104 00105 00106 double Et; 00107 double eta; 00108 double phi; 00109 int index; 00110 00111 private: 00112 00113 00114 00115 }; 00116 //end of class HepEntityI; 00117 00118 } // end of namespace d0runi 00119 00120 #endif