Rivet  1.8.0
Hemispheres.hh
00001 // -*- C++ -*-
00002 #ifndef RIVET_Hemispheres_HH
00003 #define RIVET_Hemispheres_HH
00004 
00005 #include "Rivet/Projection.hh"
00006 #include "Rivet/Projections/FinalState.hh"
00007 #include "Rivet/Projections/AxesDefinition.hh"
00008 #include "Rivet/Event.hh"
00009 
00010 
00011 namespace Rivet {
00012 
00058   class Hemispheres : public Projection {
00059   public:
00060 
00062     Hemispheres(const AxesDefinition& ax) {
00063       setName("Hemispheres");
00064       addProjection(ax, "Axes");
00065       clear();
00066     }
00067 
00069     virtual const Projection* clone() const {
00070       return new Hemispheres(*this);
00071     }
00072 
00073     // Reset the projection
00074     void clear() {
00075       _E2vis = -1;
00076       _M2high = -1;
00077       _M2low = -1;
00078       _Bmax = -1;
00079       _Bmin = -1;
00080       _highMassEqMaxBroad = true;
00081     }
00082 
00083 
00084   protected:
00085 
00087     void project(const Event& e);
00088 
00090     int compare(const Projection& p) const {
00091       return mkNamedPCmp(p, "Axes");
00092     }
00093 
00094 
00095   public:
00096 
00098 
00099 
00100     double E2vis() const { return _E2vis; }
00101     double Evis() const { return sqrt(_E2vis); }
00102 
00103     double M2high() const { return _M2high; }
00104     double Mhigh() const { return sqrt(M2high()); }
00105 
00106     double M2low() const { return _M2low; }
00107     double Mlow() const { return sqrt(M2low()); }
00108 
00109     double M2diff() const { return _M2high -_M2low; }
00110     double Mdiff() const { return sqrt(M2diff()); }
00111 
00112     double scaledM2high() const {
00113       if (isZero(_M2high)) return 0.0;
00114       if (!isZero(_E2vis)) return _M2high/_E2vis;
00115       else return std::numeric_limits<double>::max();
00116     }
00117     double scaledMhigh() const { return sqrt(scaledM2high()); }
00118 
00119     double scaledM2low() const {
00120       if (isZero(_M2low)) return 0.0;
00121       if (!isZero(_E2vis)) return _M2low/_E2vis;
00122       else return std::numeric_limits<double>::max();
00123     }
00124     double scaledMlow() const { return sqrt(scaledM2low()); }
00125 
00126     double scaledM2diff() const {
00127       if (M2diff() == 0.0) return 0.0;
00128       if (_E2vis != 0.0) return M2diff()/_E2vis;
00129       else return std::numeric_limits<double>::max();
00130     }
00131     double scaledMdiff() const { return sqrt(scaledM2diff()); }
00133 
00134 
00136 
00137     double Bmax() const { return _Bmax; }
00138     double Bmin() const { return _Bmin; }
00139     double Bsum() const { return _Bmax + _Bmin; }
00140     double Bdiff() const { return fabs(_Bmax - _Bmin); } // <- fabs(), just in case...
00142 
00143 
00145     bool massMatchesBroadening() {
00146       return _highMassEqMaxBroad;
00147     }
00148 
00149 
00150   private:
00151 
00153     double _E2vis;
00154 
00156     double _M2high, _M2low;
00157 
00159     double _Bmax, _Bmin;
00160 
00162     bool _highMassEqMaxBroad;
00163 
00164   };
00165 
00166 
00167 }
00168 
00169 #endif