FastJet 3.0.0
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 class HepEntityI {
00016 
00017  public:
00018 
00019   HepEntityI() {
00020     Et=0.;
00021     eta=0.;
00022     phi=0.;
00023     index = -1;
00024     return;
00025   }
00026 
00027 
00028   HepEntityI(double E, double px, double py, double pz,
00029              int index_in = -1) : index(index_in) {
00030     //Snowmass Et scheme    
00031     double pt = sqrt(px*px+py*py);
00032     double p = sqrt(pt*pt+pz*pz);
00033     phi = inline_maths::phi(px,py);
00034     double theta = asin(pt/p);
00035     eta = inline_maths::eta(theta);
00036 
00037     Et = E*sin(theta);
00038     
00039     return;
00040   }
00041 
00042 
00043 
00044    HepEntityI(const HepEntityI& in) : Et(in.Et), eta(in.eta), phi(in.phi), index(in.index) {
00045     return;
00046   }
00047 
00048 
00049 
00050   
00051   inline double pT() const {
00052     return Et;
00053   }
00054 
00055   inline double px() const {
00056     return Et*cos(phi);
00057   }
00058 
00059   inline double py() const {
00060     return Et*sin(phi);
00061   }
00062 
00063   inline double pz() const {
00064     return Et*sinh(eta);
00065   }
00066   
00067   inline double E() const {
00068     return Et*cosh(eta);
00069   }
00070 
00071   
00072   inline void p4vec(float* p) const {
00073     p[0] = Et*cos(phi);
00074     p[1] = Et*sin(phi);
00075     p[2] = Et*sinh(eta);
00076     p[3] = Et*cosh(eta); //E
00077     return;
00078   }
00079   
00080 
00081   inline void Add(const HepEntityI el) {
00082     //assumes Et, eta and phi stored accurately
00083     double w2 = el.Et;
00084     Et += el.Et;
00085     w2 /= Et;
00086     
00087     eta += w2*(el.eta - eta);
00088     phi += w2*inline_maths::delta_phi(el.phi, phi); 
00089 
00090     return; 
00091   }
00092 
00093 
00094   inline void Fill(double E, double px, double py, double pz, int index_in) {
00095     double pt = sqrt(px*px+py*py);
00096     double p = sqrt(pt*pt+pz*pz);
00097     phi = inline_maths::phi(px,py);
00098     double theta = asin(pt/p);
00099     eta = inline_maths::eta(theta);
00100     
00101     Et = E*sin(theta);
00102 
00103     index = index_in;
00104     
00105     return;
00106   }
00107 
00108 
00109   double Et;
00110   double eta;
00111   double phi;
00112   int index;
00113 
00114  private:
00115 
00116 
00117 
00118 };
00119 //end of class HepEntityI;
00120 
00121 } // end of namespace d0runi
00122 
00123 FASTJET_END_NAMESPACE
00124 
00125 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends