// -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/ChargedFinalState.hh" #include "Rivet/Projections/FinalState.hh" /// @todo Include more projections as required, e.g. ChargedFinalState, FastJets, ZFinder... namespace Rivet { using namespace Cuts; class CMS_2015_I1384119 : public Analysis { public: /// Constructor CMS_2015_I1384119() : Analysis("CMS_2015_I1384119") { } /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { /// @todo Initialise and register projections here /// @todo Book histograms here, e.g.: const FinalState fsa(-20.0, 20.0, 0.0000*GeV); addProjection(fsa, "FSA"); const ChargedFinalState cfs(-2.0, 2.0, 0.0*GeV); addProjection(cfs, "CFS"); _Nevt_all = 0; _h_dNch_dEta_inel = bookHisto1D(1,1,1); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fsa = applyProjection(event, "FSA"); // apply inelastic selection (veto pp -> pp eleastic events) if (fsa.size() <= 2) vetoEvent; const ChargedFinalState& cfs = applyProjection(event, "CFS"); const double weight = event.weight(); _Nevt_all += weight; foreach (const Particle& p, cfs.particles()) { int id = p.pid(); // continue if particle is a proton, a kaon or a pion if (( (abs(id) == 211) || (abs(id) == 321) || (abs(id) == 2212))) { _h_dNch_dEta_inel ->fill(p.eta(), weight); } } } /// Normalise histograms etc., after the run void finalize() { /// @todo Normalise, scale and otherwise manipulate histograms here scale(_h_dNch_dEta_inel, 1./_Nevt_all); } //@} private: // Data members like post-cuts event weight counters go here double _Nevt_all; /// @name Histograms //@{ Histo1DPtr _h_dNch_dEta_inel; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(CMS_2015_I1384119); }