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/Config/RivetCommon.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     DEFAULT_RIVET_PROJ_CLONE(JetShape);
00066 
00067     //@}
00068 
00069 
00070     /// Reset projection between events.
00071     void clear();
00072 
00073 
00074     /// Do the calculation directly on a supplied collection of Jet objects.
00075     void calc(const Jets& jets);
00076 
00077 
00078   public:
00079 
00080 
00081     /// Number of equidistant radius bins.
00082     size_t numBins() const {
00083       return _binedges.size() - 1;
00084     }
00085 
00086     /// Number of jets which passed cuts.
00087     size_t numJets() const {
00088       return _diffjetshapes.size();
00089     }
00090 
00091     /// \f$ r_\text{min} \f$ value.
00092     double rMin() const {
00093       return _binedges.front();
00094     }
00095 
00096     /// \f$ r_\text{max} \f$ value.
00097     double rMax() const {
00098       return _binedges.back();
00099     }
00100 
00101     /// \f$ p_\perp^\text{min} \f$ value.
00102     double ptMin() const {
00103       return _ptcuts.first;
00104     }
00105 
00106     /// \f$ p_\perp^\text{max} \f$ value.
00107     double ptMax() const {
00108       return _ptcuts.second;
00109     }
00110 
00111     /// Central \f$ r \f$ value for bin @a rbin.
00112     double rBinMin(size_t rbin) const {
00113       assert(inRange(rbin, 0u, numBins()));
00114       return _binedges[rbin];
00115     }
00116 
00117     /// Central \f$ r \f$ value for bin @a rbin.
00118     double rBinMax(size_t rbin) const {
00119       assert(inRange(rbin, 0u, numBins()));
00120       return _binedges[rbin+1];
00121     }
00122 
00123     /// Central \f$ r \f$ value for bin @a rbin.
00124     double rBinMid(size_t rbin) const {
00125       assert(inRange(rbin, 0u, numBins()));
00126       //cout << _binedges << endl;
00127       return (_binedges[rbin] + _binedges[rbin+1])/2.0;
00128     }
00129 
00130     /// Return value of differential jet shape profile histo bin.
00131     double diffJetShape(size_t ijet, size_t rbin) const {
00132       assert(inRange(ijet, 0u, numJets()));
00133       assert(inRange(rbin, 0u, numBins()));
00134       return _diffjetshapes[ijet][rbin];
00135     }
00136 
00137     /// Return value of integrated jet shape profile histo bin.
00138     double intJetShape(size_t ijet, size_t rbin) const {
00139       assert(inRange(ijet, 0u, numJets()));
00140       assert(inRange(rbin, 0u, numBins()));
00141       double rtn  = 0;
00142       for (size_t i = 0; i <= rbin; ++i) {
00143         rtn += _diffjetshapes[ijet][i];
00144       }
00145       return rtn;
00146     }
00147 
00148     /// @todo Provide int and diff jet shapes with some sort of area normalisation?
00149 
00150     // /// Return value of \f$ \Psi \f$ (integrated jet shape) at given radius for a \f$ p_T \f$ bin.
00151     // /// @todo Remove this external indexing thing
00152     // double psi(size_t pTbin) const {
00153     //   return _PsiSlot[pTbin];
00154     // }
00155 
00156 
00157   protected:
00158 
00159     /// Apply the projection to the event.
00160     void project(const Event& e);
00161 
00162     /// Compare projections.
00163     int compare(const Projection& p) const;
00164 
00165 
00166   private:
00167 
00168     /// @name Jet shape parameters
00169     //@{
00170 
00171     /// Vector of radius bin edges
00172     vector<double> _binedges;
00173 
00174     /// Lower and upper cuts on contributing jet \f$ p_\perp \f$.
00175     pair<double, double> _ptcuts;
00176 
00177     /// Lower and upper cuts on contributing jet (pseudo)rapidity.
00178     pair<double, double> _rapcuts;
00179 
00180     /// Rapidity scheme
00181     RapScheme _rapscheme;
00182 
00183     //@}
00184 
00185 
00186     /// @name The projected jet shapes
00187     //@{
00188 
00189     /// Jet shape histo -- first index is jet number, second is r bin
00190     vector< vector<double> > _diffjetshapes;
00191 
00192     //@}
00193 
00194   };
00195 
00196 
00197 }
00198 
00199 #endif