rivet is hosted by Hepforge, IPPP Durham
JetShape.hh
Go to the documentation of this file.
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 
00015   /**
00016      @brief Calculate the jet shape.
00017 
00018      Calculate the differential and integral jet shapes in \f$P_{\perp}\f$ for a given
00019      set of jets. This particular jet shape projection calculates jet shapes relative
00020      to jet centroids, using only the particles associated to each jet, for the hardest
00021      \f$ n \f$ jets.
00022 
00023      The rapidity scheme (\f$ \eta \f$ or \f$ y \f$) has to be specified when
00024      invoking the constructor.
00025 
00026      The differential jet shape around a given jet axis at distance interval
00027      \f$ r \pm \delta{r}/2 \f$ is defined as
00028      \f[
00029      \rho(r) =
00030        \frac{1}{\delta r} \frac{1}{N_\mathrm{jets}}
00031        \sum_\mathrm{jets} \frac{P_\perp(r - \delta r/2, r+\delta r/2)}{p_\perp(0, R)}
00032      \f]
00033      with \f$ 0 \le r \le R \f$ and \f$ P_\perp(r_1, r_2) = \sum_{\in [r_1, r_2)} p_\perp \f$.
00034 
00035      The integral jet shape around a given jet axes until distance \f$ r \f$ is defined as
00036      \f[
00037      \Psi(r) =
00038        \frac{1}{N_\mathrm{jets}}
00039        \sum_\mathrm{jets} \frac{P_\perp(0, r)}{p_\perp(0, R)}
00040      \f]
00041      with \f$ 0 \le r \le R \f$ and \f$ P_\perp(r_1, r_2) = \sum_{\in [r_1, r_2)} p_\perp \f$.
00042 
00043      The constructor expects also the binning in radius \f$ r \f$ to be supplied.
00044   */
00045   class JetShape : public Projection {
00046   public:
00047 
00048     /// @name Constructors etc.
00049     //@{
00050 
00051     /// Constructor from histo range and number of bins.
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 
00058     /// Constructor from vector of bin edges.
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 
00064     /// Clone on the heap.
00065     virtual const Projection* clone() const {
00066       return new JetShape(*this);
00067     }
00068 
00069     //@}
00070 
00071 
00072     /// Reset projection between events.
00073     void clear();
00074 
00075 
00076     /// Do the calculation directly on a supplied collection of Jet objects.
00077     void calc(const Jets& jets);
00078 
00079 
00080   public:
00081 
00082 
00083     /// Number of equidistant radius bins.
00084     size_t numBins() const {
00085       return _binedges.size() - 1;
00086     }
00087 
00088     /// Number of jets which passed cuts.
00089     size_t numJets() const {
00090       return _diffjetshapes.size();
00091     }
00092 
00093     /// \f$ r_\text{min} \f$ value.
00094     double rMin() const {
00095       return _binedges.front();
00096     }
00097 
00098     /// \f$ r_\text{max} \f$ value.
00099     double rMax() const {
00100       return _binedges.back();
00101     }
00102 
00103     /// \f$ p_\perp^\text{min} \f$ value.
00104     double ptMin() const {
00105       return _ptcuts.first;
00106     }
00107 
00108     /// \f$ p_\perp^\text{max} \f$ value.
00109     double ptMax() const {
00110       return _ptcuts.second;
00111     }
00112 
00113     /// Central \f$ r \f$ value for bin @a rbin.
00114     double rBinMin(size_t rbin) const {
00115       assert(inRange(rbin, 0, numBins()));
00116       return _binedges[rbin];
00117     }
00118 
00119     /// Central \f$ r \f$ value for bin @a rbin.
00120     double rBinMax(size_t rbin) const {
00121       assert(inRange(rbin, 0, numBins()));
00122       return _binedges[rbin+1];
00123     }
00124 
00125     /// Central \f$ r \f$ value for bin @a rbin.
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 
00132     /// Return value of differential jet shape profile histo bin.
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 
00139     /// Return value of integrated jet shape profile histo bin.
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 
00150     /// @todo Provide int and diff jet shapes with some sort of area normalisation?
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 
00161     /// Apply the projection to the event.
00162     void project(const Event& e);
00163 
00164     /// Compare projections.
00165     int compare(const Projection& p) const;
00166 
00167 
00168   private:
00169 
00170     /// @name Jet shape parameters
00171     //@{
00172 
00173     /// Vector of radius bin edges
00174     vector<double> _binedges;
00175 
00176     /// Lower and upper cuts on contributing jet \f$ p_\perp \f$.
00177     pair<double, double> _ptcuts;
00178 
00179     /// Lower and upper cuts on contributing jet (pseudo)rapidity.
00180     pair<double, double> _rapcuts;
00181 
00182     /// Rapidity scheme
00183     RapScheme _rapscheme;
00184 
00185     //@}
00186 
00187 
00188     /// @name The projected jet shapes
00189     //@{
00190 
00191     /// Jet shape histo -- first index is jet number, second is r bin
00192     vector< vector<double> > _diffjetshapes;
00193 
00194     //@}
00195 
00196   };
00197 
00198 
00199 }
00200 
00201 #endif