// -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/RivetAIDA.hh" #include "Rivet/Tools/Logging.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/UnstableFinalState.hh" /// @todo Include more projections as required, e.g. ChargedFinalState, FastJets, ZFinder... namespace Rivet { class RIVET_TEST_ANA : public Analysis { public: /// @name Constructors etc. //@{ /// Constructor RIVET_TEST_ANA() : Analysis("RIVET_TEST_ANA") { } //@} public: /// @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.: // _h_XXXX = bookProfile1D(1, 1, 1); // _h_YYYY = bookHistogram1D(2, 1, 1); const FinalState fs(-4.5, 4.5, 0.*GeV); addProjection(fs, "ALL_FS"); UnstableFinalState unstable_fs(-4.5, 4.5, 0.*GeV); addProjection(unstable_fs, "UNSTABLE_FS"); } /// Perform the per-event analysis void analyze(const Event& event) { const double weight = event.weight(); const ParticleVector& allFS = applyProjection(event, "ALL_FS").particlesByPt(); const ParticleVector& unstableFS_particles = applyProjection(event, "UNSTABLE_FS").particles(); const ParticleVector& unstableFS_particlesByPt = applyProjection(event, "UNSTABLE_FS").particlesByPt(); /// @todo Do the event by event analysis here // MSG_INFO("n(final state particles) = " << allFS.size()); MSG_INFO("n(unstable final state particles) = " << unstableFS_particles.size()); MSG_INFO("n(unstable final state particlesByPt) = " << unstableFS_particlesByPt.size()); } /// Normalise histograms etc., after the run void finalize() { /// @todo Normalise, scale and otherwise manipulate histograms here // scale(_h_YYYY, crossSection()/sumOfWeights()); # norm to cross section // normalize(_h_YYYY); # normalize to unity } //@} private: // Data members like post-cuts event weight counters go here private: /// @name Histograms //@{ AIDA::IProfile1D *_h_XXXX; AIDA::IHistogram1D *_h_YYYY; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(RIVET_TEST_ANA); }