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