Rivet is hosted by Hepforge, IPPP Durham

## Rivet analyses reference

### EXAMPLE_CUTS

A demo to show the new cut system in Rivet analyses
Experiment: ()
Status: EXAMPLE
Authors:
• David Grellscheid
No references listed
Beams: * *
Beam energies: ANY
Run details:
• All event types will be accepted.

This analysis is a demonstration of the Rivet cut system and functionality.

Source code: EXAMPLE_CUTS.cc
  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Just measures a few random things as an example. class EXAMPLE_CUTS : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(EXAMPLE_CUTS); /// @name Analysis methods //@{ /// Set up projections and book histograms void init() { // Projections const FinalState cnfs(Cuts::abseta < 4); declare(cnfs, "FS"); // Histograms _histPt = bookHisto1D("pT", 30, 0, 30); _histMass = bookHisto1D("Mass", 20, 0, 1); } /// Do the analysis void analyze(const Event& event) { // Make sure to always include the event weight in histogram fills! const double weight = event.weight(); const Particles ps = apply(event, "FS").particlesByPt(); Cut ptcut = Cuts::range(Cuts::pT, 5, 20); Cut masscut = Cuts::range(Cuts::mass, 0, 0.2); Cut combine = ptcut && masscut; //< Possible to combine cuts for (const Particle& p : ps) { if ( ptcut->accept(p) ) _histPt->fill(p.pT(), weight); if ( combine->accept(p) ) _histMass->fill(p.mass(), weight); } } /// Finalize void finalize() { normalize({_histPt, _histMass}); } //@} //@{ /// Histograms Histo1DPtr _histPt, _histMass; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(EXAMPLE_CUTS); }