Rivet  1.8.3
Hemispheres.hh
1 // -*- C++ -*-
2 #ifndef RIVET_Hemispheres_HH
3 #define RIVET_Hemispheres_HH
4 
5 #include "Rivet/Projection.hh"
6 #include "Rivet/Projections/FinalState.hh"
7 #include "Rivet/Projections/AxesDefinition.hh"
8 #include "Rivet/Event.hh"
9 
10 
11 namespace Rivet {
12 
58  class Hemispheres : public Projection {
59  public:
60 
63  setName("Hemispheres");
64  addProjection(ax, "Axes");
65  clear();
66  }
67 
69  virtual const Projection* clone() const {
70  return new Hemispheres(*this);
71  }
72 
73  // Reset the projection
74  void clear() {
75  _E2vis = -1;
76  _M2high = -1;
77  _M2low = -1;
78  _Bmax = -1;
79  _Bmin = -1;
80  _highMassEqMaxBroad = true;
81  }
82 
83 
84  protected:
85 
87  void project(const Event& e);
88 
90  int compare(const Projection& p) const {
91  return mkNamedPCmp(p, "Axes");
92  }
93 
94 
95  public:
96 
98 
99 
100  double E2vis() const { return _E2vis; }
101  double Evis() const { return sqrt(_E2vis); }
102 
103  double M2high() const { return _M2high; }
104  double Mhigh() const { return sqrt(M2high()); }
105 
106  double M2low() const { return _M2low; }
107  double Mlow() const { return sqrt(M2low()); }
108 
109  double M2diff() const { return _M2high -_M2low; }
110  double Mdiff() const { return sqrt(M2diff()); }
111 
112  double scaledM2high() const {
113  if (isZero(_M2high)) return 0.0;
114  if (!isZero(_E2vis)) return _M2high/_E2vis;
115  else return std::numeric_limits<double>::max();
116  }
117  double scaledMhigh() const { return sqrt(scaledM2high()); }
118 
119  double scaledM2low() const {
120  if (isZero(_M2low)) return 0.0;
121  if (!isZero(_E2vis)) return _M2low/_E2vis;
122  else return std::numeric_limits<double>::max();
123  }
124  double scaledMlow() const { return sqrt(scaledM2low()); }
125 
126  double scaledM2diff() const {
127  if (M2diff() == 0.0) return 0.0;
128  if (_E2vis != 0.0) return M2diff()/_E2vis;
129  else return std::numeric_limits<double>::max();
130  }
131  double scaledMdiff() const { return sqrt(scaledM2diff()); }
133 
134 
136 
137  double Bmax() const { return _Bmax; }
138  double Bmin() const { return _Bmin; }
139  double Bsum() const { return _Bmax + _Bmin; }
140  double Bdiff() const { return fabs(_Bmax - _Bmin); } // <- fabs(), just in case...
142 
143 
146  return _highMassEqMaxBroad;
147  }
148 
149 
150  private:
151 
153  double _E2vis;
154 
156  double _M2high, _M2low;
157 
159  double _Bmax, _Bmin;
160 
162  bool _highMassEqMaxBroad;
163 
164  };
165 
166 
167 }
168 
169 #endif
void setName(const std::string &name)
Used by derived classes to set their name.
Definition: Projection.hh:120
Definition: MC_JetAnalysis.hh:9
Base class for projections which define a spatial basis.
Definition: AxesDefinition.hh:20
Definition: Event.hh:22
Hemispheres(const AxesDefinition &ax)
Constructor.
Definition: Hemispheres.hh:62
Calculate the hemisphere masses and broadenings.
Definition: Hemispheres.hh:58
int compare(const Projection &p) const
Compare with other projections.
Definition: Hemispheres.hh:90
bool isZero(double val, double tolerance=1E-8)
Definition: MathUtils.hh:17
void project(const Event &e)
Perform the projection on the Event.
Definition: Hemispheres.cc:7
bool massMatchesBroadening()
Is the hemisphere with the max mass the same as the one with the max broadening?
Definition: Hemispheres.hh:145
const PROJ & addProjection(const PROJ &proj, const std::string &name)
Definition: ProjectionApplier.hh:113
Cmp< Projection > mkNamedPCmp(const Projection &otherparent, const std::string &pname) const
Definition: Projection.cc:51
Base class for all Rivet projections.
Definition: Projection.hh:28
virtual const Projection * clone() const
Clone on the heap.
Definition: Hemispheres.hh:69