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
// -*- 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
    RIVET_DEFAULT_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
      book(_histPt         ,"pT", 30, 0, 30);
      book(_histMass       ,"Mass", 20, 0, 1);

    }


    /// Do the analysis
    void analyze(const Event& event) {

      const Particles ps = apply<FinalState>(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());
        if ( combine->accept(p) )
          _histMass->fill(p.mass());
      }
    }


    /// Finalize
    void finalize() {
      normalize(_histPt); normalize(_histMass);
    }

    //@}


    //@{
    /// Histograms
    Histo1DPtr _histPt, _histMass;
    //@}

  };



  // The hook for the plugin system
  RIVET_DECLARE_PLUGIN(EXAMPLE_CUTS);

}