Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-05-12 09:05:02

0001 // -*- C++ -*-
0002 #ifndef RIVET_JetShape_HH
0003 #define RIVET_JetShape_HH
0004 
0005 #include "Rivet/Config/RivetCommon.hh"
0006 #include "Rivet/Projection.hh"
0007 #include "Rivet/Projections/JetFinder.hh"
0008 #include "Rivet/Particle.hh"
0009 #include "Rivet/Event.hh"
0010 #include "Rivet/Tools/Utils.hh"
0011 
0012 namespace Rivet {
0013 
0014 
0015   /// @brief Calculate transverse jet profiles
0016   ///
0017   /// Calculate the differential and integral jet shapes in \f$P_{\perp}\f$ for a given
0018   /// set of jets. This particular jet shape projection calculates jet shapes relative
0019   /// to jet centroids, using only the particles associated to each jet, for the hardest
0020   /// \f$ n \f$ jets.
0021   ///
0022   /// The rapidity scheme (\f$ \eta \f$ or \f$ y \f$) has to be specified when
0023   /// invoking the constructor.
0024   ///
0025   /// The differential jet shape around a given jet axis at distance interval
0026   /// \f$ r \pm \delta{r}/2 \f$ is defined as
0027   /// \f[
0028   /// \rho(r) =
0029   ///   \frac{1}{\delta r} \frac{1}{N_\mathrm{jets}}
0030   ///   \sum_\mathrm{jets} \frac{P_\perp(r - \delta r/2, r+\delta r/2)}{p_\perp(0, R)}
0031   /// \f]
0032   /// 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$.
0033   ///
0034   /// The integral jet shape around a given jet axes until distance \f$ r \f$ is defined as
0035   /// \f[
0036   /// \Psi(r) =
0037   ///   \frac{1}{N_\mathrm{jets}}
0038   ///   \sum_\mathrm{jets} \frac{P_\perp(0, r)}{p_\perp(0, R)}
0039   /// \f]
0040   /// 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$.
0041   ///
0042   /// The constructor expects also the binning in radius \f$ r \f$ to be supplied.
0043   ///
0044   class JetShape : public Projection {
0045   public:
0046 
0047     /// @name Constructors etc.
0048     /// @{
0049 
0050     /// Constructor from histo range and number of bins.
0051     JetShape(const JetFinder& jetalg,
0052              double rmin, double rmax, size_t nbins,
0053              double ptmin=0, double ptmax=DBL_MAX,
0054              double absrapmin=-DBL_MAX, double absrapmax=-DBL_MAX,
0055              RapScheme rapscheme=RAPIDITY);
0056 
0057     /// Constructor from vector of bin edges.
0058     JetShape(const JetFinder& jetalg, vector<double> binedges,
0059              double ptmin=0, double ptmax=DBL_MAX,
0060              double absrapmin=-DBL_MAX, double absrapmax=-DBL_MAX,
0061              RapScheme rapscheme=RAPIDITY);
0062 
0063     /// Clone on the heap.
0064     RIVET_DEFAULT_PROJ_CLONE(JetShape);
0065 
0066     /// @}
0067 
0068     /// Import to avoid warnings about overload-hiding
0069     using Projection::operator =;
0070 
0071 
0072     /// Reset projection between events.
0073     void clear();
0074 
0075 
0076     /// Do the calculation directly on a supplied collection of Jet objects.
0077     void calc(const Jets& jets);
0078 
0079 
0080   public:
0081 
0082 
0083     /// Number of equidistant radius bins.
0084     size_t numBins() const {
0085       return _binedges.size() - 1;
0086     }
0087 
0088     /// Number of jets which passed cuts.
0089     size_t numJets() const {
0090       return _diffjetshapes.size();
0091     }
0092 
0093     /// \f$ r_\text{min} \f$ value.
0094     double rMin() const {
0095       return _binedges.front();
0096     }
0097 
0098     /// \f$ r_\text{max} \f$ value.
0099     double rMax() const {
0100       return _binedges.back();
0101     }
0102 
0103     /// \f$ p_\perp^\text{min} \f$ value.
0104     double ptMin() const {
0105       return _ptcuts.first;
0106     }
0107 
0108     /// \f$ p_\perp^\text{max} \f$ value.
0109     double ptMax() const {
0110       return _ptcuts.second;
0111     }
0112 
0113     /// Central \f$ r \f$ value for bin @a rbin.
0114     double rBinMin(size_t rbin) const {
0115       assert(inRange(rbin, 0u, numBins()));
0116       return _binedges[rbin];
0117     }
0118 
0119     /// Central \f$ r \f$ value for bin @a rbin.
0120     double rBinMax(size_t rbin) const {
0121       assert(inRange(rbin, 0u, numBins()));
0122       return _binedges[rbin+1];
0123     }
0124 
0125     /// Central \f$ r \f$ value for bin @a rbin.
0126     double rBinMid(size_t rbin) const {
0127       assert(inRange(rbin, 0u, numBins()));
0128       //cout << _binedges << '\n';
0129       return (_binedges[rbin] + _binedges[rbin+1])/2.0;
0130     }
0131 
0132     /// Return value of differential jet shape profile histo bin.
0133     double diffJetShape(size_t ijet, size_t rbin) const {
0134       assert(inRange(ijet, 0u, numJets()));
0135       assert(inRange(rbin, 0u, numBins()));
0136       return _diffjetshapes[ijet][rbin];
0137     }
0138 
0139     /// Return value of integrated jet shape profile histo bin.
0140     double intJetShape(size_t ijet, size_t rbin) const {
0141       assert(inRange(ijet, 0u, numJets()));
0142       assert(inRange(rbin, 0u, numBins()));
0143       double rtn  = 0;
0144       for (size_t i = 0; i <= rbin; ++i) {
0145         rtn += _diffjetshapes[ijet][i];
0146       }
0147       return rtn;
0148     }
0149 
0150     /// @todo Provide int and diff jet shapes with some sort of area normalisation?
0151 
0152     // /// Return value of \f$ \Psi \f$ (integrated jet shape) at given radius for a \f$ p_T \f$ bin.
0153     // /// @todo Remove this external indexing thing
0154     // double psi(size_t pTbin) const {
0155     //   return _PsiSlot[pTbin];
0156     // }
0157 
0158 
0159   protected:
0160 
0161     /// Apply the projection to the event.
0162     void project(const Event& e);
0163 
0164     /// Compare projections.
0165     CmpState compare(const Projection& p) const;
0166 
0167 
0168   protected:
0169 
0170     /// @name Jet-shape parameters
0171     /// @{
0172 
0173     /// Vector of radius bin edges
0174     vector<double> _binedges;
0175 
0176     /// Lower and upper cuts on contributing jet \f$ p_\perp \f$.
0177     pair<double, double> _ptcuts;
0178 
0179     /// Lower and upper cuts on contributing jet (pseudo)rapidity.
0180     pair<double, double> _rapcuts;
0181 
0182     /// Rapidity scheme
0183     RapScheme _rapscheme;
0184 
0185     /// @}
0186 
0187 
0188     /// @name The projected jet shapes
0189     /// @{
0190 
0191     /// Jet shape histo -- first index is jet number, second is r bin
0192     vector< vector<double> > _diffjetshapes;
0193 
0194     /// @}
0195 
0196   };
0197 
0198 
0199 }
0200 
0201 #endif