File indexing completed on 2025-11-03 10:02:08
0001 
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   
0016   
0017   
0018   
0019   
0020   
0021   
0022   
0023   
0024   
0025   
0026   
0027   
0028   
0029   
0030   
0031   
0032   
0033   
0034   
0035   
0036   
0037   
0038   
0039   
0040   
0041   
0042   
0043   
0044   class JetShape : public Projection {
0045   public:
0046 
0047     
0048     
0049 
0050     
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     
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     
0064     RIVET_DEFAULT_PROJ_CLONE(JetShape);
0065 
0066     
0067 
0068     
0069     using Projection::operator =;
0070 
0071 
0072     
0073     void clear();
0074 
0075 
0076     
0077     void calc(const Jets& jets);
0078 
0079 
0080   public:
0081 
0082 
0083     
0084     size_t numBins() const {
0085       return _binedges.size() - 1;
0086     }
0087 
0088     
0089     size_t numJets() const {
0090       return _diffjetshapes.size();
0091     }
0092 
0093     
0094     double rMin() const {
0095       return _binedges.front();
0096     }
0097 
0098     
0099     double rMax() const {
0100       return _binedges.back();
0101     }
0102 
0103     
0104     double ptMin() const {
0105       return _ptcuts.first;
0106     }
0107 
0108     
0109     double ptMax() const {
0110       return _ptcuts.second;
0111     }
0112 
0113     
0114     double rBinMin(size_t rbin) const {
0115       assert(inRange(rbin, 0u, numBins()));
0116       return _binedges[rbin];
0117     }
0118 
0119     
0120     double rBinMax(size_t rbin) const {
0121       assert(inRange(rbin, 0u, numBins()));
0122       return _binedges[rbin+1];
0123     }
0124 
0125     
0126     double rBinMid(size_t rbin) const {
0127       assert(inRange(rbin, 0u, numBins()));
0128       
0129       return (_binedges[rbin] + _binedges[rbin+1])/2.0;
0130     }
0131 
0132     
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     
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     
0151 
0152     
0153     
0154     
0155     
0156     
0157 
0158 
0159   protected:
0160 
0161     
0162     void project(const Event& e);
0163 
0164     
0165     CmpState compare(const Projection& p) const;
0166 
0167 
0168   protected:
0169 
0170     
0171     
0172 
0173     
0174     vector<double> _binedges;
0175 
0176     
0177     pair<double, double> _ptcuts;
0178 
0179     
0180     pair<double, double> _rapcuts;
0181 
0182     
0183     RapScheme _rapscheme;
0184 
0185     
0186 
0187 
0188     
0189     
0190 
0191     
0192     vector< vector<double> > _diffjetshapes;
0193 
0194     
0195 
0196   };
0197 
0198 
0199 }
0200 
0201 #endif