#include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/ChargedFinalState.hh" namespace Rivet { class MyAnalysis : public Analysis { public: DEFAULT_RIVET_ANALYSIS_CTOR(MyAnalysis); void init() { const ChargedFinalState cfs(-0.8, 0.8, 0.0*GeV); declare(cfs, "CFS"); //_Nevt_after_cuts_orveto = 0; _h_dNch_dPt = bookHisto1D("PtCh", 200, 0, 100); } void analyze(const Event& event) { const double weight = event.weight(); int count_plus = 0; const ChargedFinalState& charged = apply(event, "CFS"); foreach (const Particle& p, charged.particles()) { const double abseta = fabs(p.eta()); if (abseta < 0.8) count_plus++; const double pT = p.perp()/GeV; if ( count_plus > 0 ) { //_Nevt_after_cuts_orveto += weight; _h_dNch_dPt->fill(pT, weight); } } } void finalize() { //const double norm_orveto = 1.0/_Nevt_after_cuts_orveto; scale(_h_dNch_dPt, crossSection()/millibarn/sumOfWeights()); } private: Histo1DPtr _h_dNch_dPt; //double _Nevt_after_cuts_orveto; }; DECLARE_RIVET_PLUGIN(MyAnalysis); }