Rivet  1.8.0
JetShape.hh
00001 // -*- C++ -*-
00002 #ifndef RIVET_JetShape_HH
00003 #define RIVET_JetShape_HH
00004 
00005 #include "Rivet/Rivet.hh"
00006 #include "Rivet/Projection.hh"
00007 #include "Rivet/Projections/JetAlg.hh"
00008 #include "Rivet/Particle.hh"
00009 #include "Rivet/Event.hh"
00010 #include "Rivet/Tools/Utils.hh"
00011 
00012 namespace Rivet {
00013 
00014 
00045   class JetShape : public Projection {
00046   public:
00047 
00049 
00050 
00052     JetShape(const JetAlg& jetalg,
00053              double rmin, double rmax, size_t nbins,
00054              double ptmin=0, double ptmax=MAXDOUBLE,
00055              double absrapmin=-MAXDOUBLE, double absrapmax=-MAXDOUBLE,
00056              RapScheme rapscheme=RAPIDITY);
00057 
00059     JetShape(const JetAlg& jetalg, vector<double> binedges,
00060              double ptmin=0, double ptmax=MAXDOUBLE,
00061              double absrapmin=-MAXDOUBLE, double absrapmax=-MAXDOUBLE,
00062              RapScheme rapscheme=RAPIDITY);
00063 
00065     virtual const Projection* clone() const {
00066       return new JetShape(*this);
00067     }
00068 
00070 
00071 
00073     void clear();
00074 
00075 
00077     void calc(const Jets& jets);
00078 
00079 
00080   public:
00081 
00082 
00084     size_t numBins() const {
00085       return _binedges.size() - 1;
00086     }
00087 
00089     size_t numJets() const {
00090       return _diffjetshapes.size();
00091     }
00092 
00094     double rMin() const {
00095       return _binedges.front();
00096     }
00097 
00099     double rMax() const {
00100       return _binedges.back();
00101     }
00102 
00104     double ptMin() const {
00105       return _ptcuts.first;
00106     }
00107 
00109     double ptMax() const {
00110       return _ptcuts.second;
00111     }
00112 
00114     double rBinMin(size_t rbin) const {
00115       assert(inRange(rbin, 0, numBins()));
00116       return _binedges[rbin];
00117     }
00118 
00120     double rBinMax(size_t rbin) const {
00121       assert(inRange(rbin, 0, numBins()));
00122       return _binedges[rbin+1];
00123     }
00124 
00126     double rBinMid(size_t rbin) const {
00127       assert(inRange(rbin, 0, numBins()));
00128       //cout << _binedges << endl;
00129       return (_binedges[rbin] + _binedges[rbin+1])/2.0;
00130     }
00131 
00133     double diffJetShape(size_t ijet, size_t rbin) const {
00134       assert(inRange(ijet, 0, numJets()));
00135       assert(inRange(rbin, 0, numBins()));
00136       return _diffjetshapes[ijet][rbin];
00137     }
00138 
00140     double intJetShape(size_t ijet, size_t rbin) const {
00141       assert(inRange(ijet, 0, numJets()));
00142       assert(inRange(rbin, 0, numBins()));
00143       double rtn  = 0;
00144       for (size_t i = 0; i <= rbin; ++i) {
00145         rtn += _diffjetshapes[ijet][i];
00146       }
00147       return rtn;
00148     }
00149 
00151 
00152     // /// Return value of \f$ \Psi \f$ (integrated jet shape) at given radius for a \f$ p_T \f$ bin.
00153     // /// @todo Remove this external indexing thing
00154     // double psi(size_t pTbin) const {
00155     //   return _PsiSlot[pTbin];
00156     // }
00157 
00158 
00159   protected:
00160 
00162     void project(const Event& e);
00163 
00165     int compare(const Projection& p) const;
00166 
00167 
00168   private:
00169 
00171 
00172 
00174     vector<double> _binedges;
00175 
00177     pair<double, double> _ptcuts;
00178 
00180     pair<double, double> _rapcuts;
00181 
00183     RapScheme _rapscheme;
00184 
00186 
00187 
00189 
00190 
00192     vector< vector<double> > _diffjetshapes;
00193 
00195 
00196   };
00197 
00198 
00199 }
00200 
00201 #endif