FastJet 3.0.1
HepEntityIpre96.h
00001 #ifndef  D0RunIconeJets_HepEntityPre96_class
00002 #define  D0RunIconeJets_HepEntityPre96_class
00003 
00004 #include "inline_maths.h"
00005 #include "HepEntityI.h"
00006 #include <fastjet/internal/base.hh>
00007 
00008 FASTJET_BEGIN_NAMESPACE
00009 
00010 namespace d0runi{
00011 
00012 //Author: Lars Sonnenschein 25/Feb/2010
00013 //This is an example class fulfilling the minimal requirements needed by the
00014 //D0 RunI cone jet algorithm implementation prior to 1996, which is an inlined template class
00015 //See FERMILAB-Pub-97-242-E for details
00016 
00017 // History of changes in FastJet compared tothe original version of
00018 // HepEntity.h
00019 //
00020 // 2011-11-14  Gregory Soyez  <soyez@fastjet.fr>
00021 //
00022 //         * removed some harmless warnings coming with the -Wshadow gcc option
00023 // 
00024 // 2011-10-06  Gregory Soyez  <soyez@fastjet.fr>
00025 //
00026 //        * put the code in the fastjet::d0 namespace
00027 
00028 class HepEntityIpre96 : public HepEntityI {
00029 
00030  public:
00031 
00032   HepEntityIpre96() {
00033     Et=0.;
00034     eta=0.;
00035     phi=0.;
00036     Ex=0.;
00037     Ey=0.;
00038     Ez=0.;
00039     index = -1;
00040     phi_pre96=0.;
00041     eta_pre96=0.;
00042 
00043     return;
00044   }
00045 
00046 
00047  HepEntityIpre96(double E_in, double px_in, double py_in, double pz_in,
00048                  int index_in = -1) : index(index_in) {
00049    //Snowmass Et scheme    
00050     double pt = sqrt(px_in*px_in+py_in*py_in);
00051     double p = sqrt(pt*pt+pz_in*pz_in);
00052     phi = inline_maths::phi(px_in,py_in);
00053     double theta = asin(pt/p);
00054     eta = inline_maths::eta(theta);
00055 
00056     Et = E_in*sin(theta);
00057 
00058     phi_pre96 = phi;
00059     eta_pre96 = eta;
00060 
00061     Ex = Et*cos(phi_pre96);
00062     Ey = Et*sin(phi_pre96);
00063     Ez = Et*sinh(eta_pre96);
00064   
00065     return;
00066   }
00067 
00068 
00069   inline double px() const {
00070     return Et*cos(phi_pre96);
00071   }
00072 
00073   inline double py() const {
00074     return Et*sin(phi_pre96);
00075   }
00076 
00077   inline double pz() const {
00078     return Et*sinh(eta_pre96);
00079   }
00080   
00081   inline double E() const {
00082     return Et*cosh(eta_pre96);
00083   }
00084   
00085  
00086   inline void Add(const HepEntityIpre96 el) {
00087     //assumes Et, eta and phi stored accurately
00088     double w2 = el.Et;
00089     Et += el.Et;
00090     w2 /= Et;
00091     
00092     eta += w2*(el.eta - eta);
00093     phi += w2*inline_maths::delta_phi(el.phi, phi); 
00094 
00095 
00096     Ex += el.Ex;
00097     Ey += el.Ey;
00098     Ez += el.Ez;
00099     phi_pre96 = atan2(Ey, Ex);
00100     double theta_pre96 = atan2(sqrt(Ex*Ex+Ey*Ey),Ez);
00101     eta_pre96 = -log(tan(theta_pre96/2.));
00102 
00103     return; 
00104   }
00105 
00106 
00107   inline void Fill(double E_in, double px_in, double py_in, double pz_in, int index_in) {
00108     double pt = sqrt(px_in*px_in+py_in*py_in);
00109     double p = sqrt(pt*pt+pz_in*pz_in);
00110     phi = inline_maths::phi(px_in,py_in);
00111     double theta = asin(pt/p);
00112     eta = inline_maths::eta(theta);
00113 
00114     Et = E_in*sin(theta);
00115 
00116     
00117     phi_pre96 = phi;
00118     eta_pre96 = eta;
00119 
00120     Ex = Et*cos(phi_pre96);
00121     Ey = Et*sin(phi_pre96);
00122     Ez = Et*sinh(eta_pre96);
00123 
00124     index = index_in;
00125 
00126     return;
00127   }
00128 
00129 
00130   double Ex;
00131   double Ey;
00132   double Ez;
00133   int index;
00134   double phi_pre96;
00135   double eta_pre96;
00136 
00137  private:
00138 
00139 
00140 
00141 };
00142 //end of class HepEntityIpre96;
00143 
00144 } // end of namespace d0runi
00145 
00146 FASTJET_END_NAMESPACE
00147 
00148 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends