FastJet 3.0.5
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 // This file is distributed with FastJet under the terms of the GNU
00016 // General Public License (v2). Permission to do so has been granted
00017 // by Lars Sonnenschein and the D0 collaboration (see COPYING for
00018 // details)
00019 //
00020 // History of changes in FastJet compared tothe original version of
00021 // HepEntity.h
00022 //
00023 // 2011-12-13  Gregory Soyez  <soyez@fastjet.fr>
00024 // 
00025 //        * added license information
00026 //
00027 // 2011-11-14  Gregory Soyez  <soyez@fastjet.fr>
00028 //
00029 //         * removed some harmless warnings coming with the -Wshadow gcc option
00030 // 
00031 // 2011-10-06  Gregory Soyez  <soyez@fastjet.fr>
00032 //
00033 //        * put the code in the fastjet::d0runi namespace
00034 
00035 class HepEntityI {
00036 
00037  public:
00038 
00039   HepEntityI() {
00040     Et=0.;
00041     eta=0.;
00042     phi=0.;
00043     index = -1;
00044     return;
00045   }
00046 
00047 
00048   HepEntityI(double E_in, double px_in, double py_in, double pz_in,
00049              int index_in = -1) : index(index_in) {
00050     //Snowmass Et scheme    
00051     double pt = sqrt(px_in*px_in+py_in*py_in);
00052     double p = sqrt(pt*pt+pz_in*pz_in);
00053     phi = inline_maths::phi(px_in,py_in);
00054     double theta = asin(pt/p);
00055     eta = inline_maths::eta(theta);
00056 
00057     Et = E_in*sin(theta);
00058     
00059     return;
00060   }
00061 
00062 
00063 
00064    HepEntityI(const HepEntityI& in) : Et(in.Et), eta(in.eta), phi(in.phi), index(in.index) {
00065     return;
00066   }
00067 
00068 
00069 
00070   
00071   inline double pT() const {
00072     return Et;
00073   }
00074 
00075   inline double px() const {
00076     return Et*cos(phi);
00077   }
00078 
00079   inline double py() const {
00080     return Et*sin(phi);
00081   }
00082 
00083   inline double pz() const {
00084     return Et*sinh(eta);
00085   }
00086   
00087   inline double E() const {
00088     return Et*cosh(eta);
00089   }
00090 
00091   
00092   inline void p4vec(float* p) const {
00093     p[0] = Et*cos(phi);
00094     p[1] = Et*sin(phi);
00095     p[2] = Et*sinh(eta);
00096     p[3] = Et*cosh(eta); //E
00097     return;
00098   }
00099   
00100 
00101   inline void Add(const HepEntityI el) {
00102     //assumes Et, eta and phi stored accurately
00103     double w2 = el.Et;
00104     Et += el.Et;
00105     w2 /= Et;
00106     
00107     eta += w2*(el.eta - eta);
00108     phi += w2*inline_maths::delta_phi(el.phi, phi); 
00109 
00110     return; 
00111   }
00112 
00113 
00114   inline void Fill(double E_in, double px_in, double py_in, double pz_in, int index_in) {
00115     double pt = sqrt(px_in*px_in+py_in*py_in);
00116     double p = sqrt(pt*pt+pz_in*pz_in);
00117     phi = inline_maths::phi(px_in,py_in);
00118     double theta = asin(pt/p);
00119     eta = inline_maths::eta(theta);
00120     
00121     Et = E_in*sin(theta);
00122 
00123     index = index_in;
00124     
00125     return;
00126   }
00127 
00128 
00129   double Et;
00130   double eta;
00131   double phi;
00132   int index;
00133 
00134  private:
00135 
00136 
00137 
00138 };
00139 //end of class HepEntityI;
00140 
00141 } // end of namespace d0runi
00142 
00143 FASTJET_END_NAMESPACE
00144 
00145 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends