fastjet 2.4.5
LorentzVector.hh
Go to the documentation of this file.
00001 // file taken from the CDF Plugin implementation
00002 // 
00003 // we've added et() and e() for easier use 
00004 
00005 #ifndef _LORENTZ_VECTOR_HH_
00006 #define _LORENTZ_VECTOR_HH_
00007 
00008 #include <cmath>
00009 #include <fastjet/internal/base.hh>
00010 
00011 #ifndef M_PI
00012 #define M_PI  3.141592653589793238462643383279502884197 
00013 #endif
00014 
00015 FASTJET_BEGIN_NAMESPACE
00016 
00017 namespace atlas{
00018 
00019 class LorentzVector
00020 {
00021  public:
00022 
00023   double px,py,pz,E;
00024 
00025   LorentzVector(): px(0), py(0), pz(0), E(0) {}
00026   LorentzVector(double p1, double p2, double p3, double p0): px(p1), py(p2), pz(p3), E(p0) {}
00027   LorentzVector(const LorentzVector& p): px(p.px), py(p.py), pz(p.pz), E(p.E) {}
00028   double p()   const {return sqrt(px*px + py*py + pz*pz);}
00029   double pt()  const {return sqrt(px*px + py*py);}
00030   double mt()  const {return sqrt((E-pz)*(E+pz));}
00031   double y()   const {return 0.5*log((E + pz)/(E - pz));}
00032   double Et()  const {return E/p()*pt();}
00033   inline double et()  const {return Et();}
00034   inline double e()  const {return E;}
00035   double eta() const {return 0.5*log((p() + pz)/(p() - pz));}
00036   double phi() const
00037   {
00038     double r = atan2(py,px);
00039     if(r < 0)
00040       r += 2*M_PI;
00041     return r;
00042   }
00043   void add(LorentzVector v)
00044   {
00045     px += v.px;
00046     py += v.py;
00047     pz += v.pz;
00048     E  += v.E;
00049   }
00050   void subtract(LorentzVector v)
00051   {
00052     px -= v.px;
00053     py -= v.py;
00054     pz -= v.pz;
00055     E  -= v.E;
00056   }
00057   bool isEqual(LorentzVector v)
00058   {
00059     return px == v.px && py == v.py && pz == v.pz && E == v.E;
00060   }
00061 };
00062 
00063 } // namespace atlas
00064 
00065 FASTJET_END_NAMESPACE
00066 
00067 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines