Rivet  1.8.0
JetShape.hh
1 // -*- C++ -*-
2 #ifndef RIVET_JetShape_HH
3 #define RIVET_JetShape_HH
4 
5 #include "Rivet/Rivet.hh"
6 #include "Rivet/Projection.hh"
7 #include "Rivet/Projections/JetAlg.hh"
8 #include "Rivet/Particle.hh"
9 #include "Rivet/Event.hh"
10 #include "Rivet/Tools/Utils.hh"
11 
12 namespace Rivet {
13 
14 
45  class JetShape : public Projection {
46  public:
47 
49 
50 
52  JetShape(const JetAlg& jetalg,
53  double rmin, double rmax, size_t nbins,
54  double ptmin=0, double ptmax=MAXDOUBLE,
55  double absrapmin=-MAXDOUBLE, double absrapmax=-MAXDOUBLE,
56  RapScheme rapscheme=RAPIDITY);
57 
59  JetShape(const JetAlg& jetalg, vector<double> binedges,
60  double ptmin=0, double ptmax=MAXDOUBLE,
61  double absrapmin=-MAXDOUBLE, double absrapmax=-MAXDOUBLE,
62  RapScheme rapscheme=RAPIDITY);
63 
65  virtual const Projection* clone() const {
66  return new JetShape(*this);
67  }
68 
70 
71 
73  void clear();
74 
75 
77  void calc(const Jets& jets);
78 
79 
80  public:
81 
82 
84  size_t numBins() const {
85  return _binedges.size() - 1;
86  }
87 
89  size_t numJets() const {
90  return _diffjetshapes.size();
91  }
92 
94  double rMin() const {
95  return _binedges.front();
96  }
97 
99  double rMax() const {
100  return _binedges.back();
101  }
102 
104  double ptMin() const {
105  return _ptcuts.first;
106  }
107 
109  double ptMax() const {
110  return _ptcuts.second;
111  }
112 
114  double rBinMin(size_t rbin) const {
115  assert(inRange(rbin, 0, numBins()));
116  return _binedges[rbin];
117  }
118 
120  double rBinMax(size_t rbin) const {
121  assert(inRange(rbin, 0, numBins()));
122  return _binedges[rbin+1];
123  }
124 
126  double rBinMid(size_t rbin) const {
127  assert(inRange(rbin, 0, numBins()));
128  //cout << _binedges << endl;
129  return (_binedges[rbin] + _binedges[rbin+1])/2.0;
130  }
131 
133  double diffJetShape(size_t ijet, size_t rbin) const {
134  assert(inRange(ijet, 0, numJets()));
135  assert(inRange(rbin, 0, numBins()));
136  return _diffjetshapes[ijet][rbin];
137  }
138 
140  double intJetShape(size_t ijet, size_t rbin) const {
141  assert(inRange(ijet, 0, numJets()));
142  assert(inRange(rbin, 0, numBins()));
143  double rtn = 0;
144  for (size_t i = 0; i <= rbin; ++i) {
145  rtn += _diffjetshapes[ijet][i];
146  }
147  return rtn;
148  }
149 
151 
152  // /// Return value of \f$ \Psi \f$ (integrated jet shape) at given radius for a \f$ p_T \f$ bin.
153  // /// @todo Remove this external indexing thing
154  // double psi(size_t pTbin) const {
155  // return _PsiSlot[pTbin];
156  // }
157 
158 
159  protected:
160 
162  void project(const Event& e);
163 
165  int compare(const Projection& p) const;
166 
167 
168  private:
169 
171 
172 
174  vector<double> _binedges;
175 
177  pair<double, double> _ptcuts;
178 
180  pair<double, double> _rapcuts;
181 
183  RapScheme _rapscheme;
184 
186 
187 
189 
190 
192  vector< vector<double> > _diffjetshapes;
193 
195 
196  };
197 
198 
199 }
200 
201 #endif