00001 #ifndef D0RunIconeJets_HepEntityPre96_class
00002 #define D0RunIconeJets_HepEntityPre96_class
00003
00004 #include "inline_maths.h"
00005 #include "HepEntityI.h"
00006
00007 namespace d0runi{
00008
00009
00010
00011
00012
00013 class HepEntityIpre96 : public HepEntityI {
00014
00015 public:
00016
00017 HepEntityIpre96() {
00018 Et=0.;
00019 eta=0.;
00020 phi=0.;
00021 Ex=0.;
00022 Ey=0.;
00023 Ez=0.;
00024 index = -1;
00025 phi_pre96=0.;
00026 eta_pre96=0.;
00027
00028 return;
00029 }
00030
00031
00032 HepEntityIpre96(double E, double px, double py, double pz,
00033 int index_in = -1) : index(index_in) {
00034
00035 double pt = sqrt(px*px+py*py);
00036 double p = sqrt(pt*pt+pz*pz);
00037 phi = inline_maths::phi(px,py);
00038 double theta = asin(pt/p);
00039 eta = inline_maths::eta(theta);
00040
00041 Et = E*sin(theta);
00042
00043 phi_pre96 = phi;
00044 eta_pre96 = eta;
00045
00046 Ex = Et*cos(phi_pre96);
00047 Ey = Et*sin(phi_pre96);
00048 Ez = Et*sinh(eta_pre96);
00049
00050 return;
00051 }
00052
00053
00054 inline double px() const {
00055 return Et*cos(phi_pre96);
00056 }
00057
00058 inline double py() const {
00059 return Et*sin(phi_pre96);
00060 }
00061
00062 inline double pz() const {
00063 return Et*sinh(eta_pre96);
00064 }
00065
00066 inline double E() const {
00067 return Et*cosh(eta_pre96);
00068 }
00069
00070
00071 inline void Add(const HepEntityIpre96 el) {
00072
00073 double w2 = el.Et;
00074 Et += el.Et;
00075 w2 /= Et;
00076
00077 eta += w2*(el.eta - eta);
00078 phi += w2*inline_maths::delta_phi(el.phi, phi);
00079
00080
00081 Ex += el.Ex;
00082 Ey += el.Ey;
00083 Ez += el.Ez;
00084 phi_pre96 = atan2(Ey, Ex);
00085 double theta_pre96 = atan2(sqrt(Ex*Ex+Ey*Ey),Ez);
00086 eta_pre96 = -log(tan(theta_pre96/2.));
00087
00088 return;
00089 }
00090
00091
00092 inline void Fill(double E, double px, double py, double pz, int index_in) {
00093 double pt = sqrt(px*px+py*py);
00094 double p = sqrt(pt*pt+pz*pz);
00095 phi = inline_maths::phi(px,py);
00096 double theta = asin(pt/p);
00097 eta = inline_maths::eta(theta);
00098
00099 Et = E*sin(theta);
00100
00101
00102 phi_pre96 = phi;
00103 eta_pre96 = eta;
00104
00105 Ex = Et*cos(phi_pre96);
00106 Ey = Et*sin(phi_pre96);
00107 Ez = Et*sinh(eta_pre96);
00108
00109 index = index_in;
00110
00111 return;
00112 }
00113
00114
00115 double Ex;
00116 double Ey;
00117 double Ez;
00118 int index;
00119 double phi_pre96;
00120 double eta_pre96;
00121
00122 private:
00123
00124
00125
00126 };
00127
00128
00129 }
00130
00131 #endif