Rivet  3.1.0
JetShape.hh
1 // -*- C++ -*-
2 #ifndef RIVET_JetShape_HH
3 #define RIVET_JetShape_HH
4 
5 #include "Rivet/Config/RivetCommon.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 
44  class JetShape : public Projection {
45  public:
46 
48 
49 
51  JetShape(const JetAlg& jetalg,
52  double rmin, double rmax, size_t nbins,
53  double ptmin=0, double ptmax=DBL_MAX,
54  double absrapmin=-DBL_MAX, double absrapmax=-DBL_MAX,
55  RapScheme rapscheme=RAPIDITY);
56 
58  JetShape(const JetAlg& jetalg, vector<double> binedges,
59  double ptmin=0, double ptmax=DBL_MAX,
60  double absrapmin=-DBL_MAX, double absrapmax=-DBL_MAX,
61  RapScheme rapscheme=RAPIDITY);
62 
65 
67 
68 
70  void clear();
71 
72 
74  void calc(const Jets& jets);
75 
76 
77  public:
78 
79 
81  size_t numBins() const {
82  return _binedges.size() - 1;
83  }
84 
86  size_t numJets() const {
87  return _diffjetshapes.size();
88  }
89 
91  double rMin() const {
92  return _binedges.front();
93  }
94 
96  double rMax() const {
97  return _binedges.back();
98  }
99 
101  double ptMin() const {
102  return _ptcuts.first;
103  }
104 
106  double ptMax() const {
107  return _ptcuts.second;
108  }
109 
111  double rBinMin(size_t rbin) const {
112  assert(inRange(rbin, 0u, numBins()));
113  return _binedges[rbin];
114  }
115 
117  double rBinMax(size_t rbin) const {
118  assert(inRange(rbin, 0u, numBins()));
119  return _binedges[rbin+1];
120  }
121 
123  double rBinMid(size_t rbin) const {
124  assert(inRange(rbin, 0u, numBins()));
125  //cout << _binedges << '\n';
126  return (_binedges[rbin] + _binedges[rbin+1])/2.0;
127  }
128 
130  double diffJetShape(size_t ijet, size_t rbin) const {
131  assert(inRange(ijet, 0u, numJets()));
132  assert(inRange(rbin, 0u, numBins()));
133  return _diffjetshapes[ijet][rbin];
134  }
135 
137  double intJetShape(size_t ijet, size_t rbin) const {
138  assert(inRange(ijet, 0u, numJets()));
139  assert(inRange(rbin, 0u, numBins()));
140  double rtn = 0;
141  for (size_t i = 0; i <= rbin; ++i) {
142  rtn += _diffjetshapes[ijet][i];
143  }
144  return rtn;
145  }
146 
148 
149  // /// Return value of \f$ \Psi \f$ (integrated jet shape) at given radius for a \f$ p_T \f$ bin.
150  // /// @todo Remove this external indexing thing
151  // double psi(size_t pTbin) const {
152  // return _PsiSlot[pTbin];
153  // }
154 
155 
156  protected:
157 
159  void project(const Event& e);
160 
162  CmpState compare(const Projection& p) const;
163 
164 
165  private:
166 
168 
169 
171  vector<double> _binedges;
172 
174  pair<double, double> _ptcuts;
175 
177  pair<double, double> _rapcuts;
178 
180  RapScheme _rapscheme;
181 
183 
184 
186 
187 
189  vector< vector<double> > _diffjetshapes;
190 
192 
193  };
194 
195 
196 }
197 
198 #endif
double intJetShape(size_t ijet, size_t rbin) const
Return value of integrated jet shape profile histo bin.
Definition: JetShape.hh:137
Definition: MC_Cent_pPb.hh:10
double ptMax() const
value.
Definition: JetShape.hh:106
double rBinMin(size_t rbin) const
Central value for bin rbin.
Definition: JetShape.hh:111
double rMin() const
value.
Definition: JetShape.hh:91
double diffJetShape(size_t ijet, size_t rbin) const
Return value of differential jet shape profile histo bin.
Definition: JetShape.hh:130
void project(const Event &e)
Apply the projection to the event.
void calc(const Jets &jets)
Do the calculation directly on a supplied collection of Jet objects.
size_t numBins() const
Number of equidistant radius bins.
Definition: JetShape.hh:81
double rMax() const
value.
Definition: JetShape.hh:96
Representation of a HepMC event, and enabler of Projection caching.
Definition: Event.hh:22
JetShape(const JetAlg &jetalg, double rmin, double rmax, size_t nbins, double ptmin=0, double ptmax=DBL_MAX, double absrapmin=-DBL_MAX, double absrapmax=-DBL_MAX, RapScheme rapscheme=RAPIDITY)
Constructor from histo range and number of bins.
CmpState compare(const Projection &p) const
Compare projections.
double rBinMax(size_t rbin) const
Central value for bin rbin.
Definition: JetShape.hh:117
Abstract base class for projections which can return a set of Jets.
Definition: JetFinder.hh:15
std::enable_if< std::is_arithmetic< N1 >::value &&std::is_arithmetic< N2 >::value &&std::is_arithmetic< N3 >::value, bool >::type inRange(N1 value, N2 low, N3 high, RangeBoundary lowbound=CLOSED, RangeBoundary highbound=OPEN)
Determine if value is in the range low to high, for floating point numbers.
Definition: MathUtils.hh:112
RapScheme
Enum for rapidity variable to be used in calculating , applying rapidity cuts, etc.
Definition: MathConstants.hh:46
void clear()
Reset projection between events.
DEFAULT_RIVET_PROJ_CLONE(JetShape)
Clone on the heap.
Base class for all Rivet projections.
Definition: Projection.hh:29
double rBinMid(size_t rbin) const
Central value for bin rbin.
Definition: JetShape.hh:123
double ptMin() const
value.
Definition: JetShape.hh:101
size_t numJets() const
Number of jets which passed cuts.
Definition: JetShape.hh:86
Calculate transverse jet profiles.
Definition: JetShape.hh:44