rivet is hosted by Hepforge, IPPP Durham

Rivet analyses reference

MC_XS

MC analysis for process total cross section
Experiment: ()
Status: VALIDATED
Authors:
  • Marek Schoenherr
  • Christian Gutschow
No references listed
Beams: * *
Beam energies: ANY
Run details:
  • Suitable for any process.

Analysis for bookkeeping of the total cross section, number of generated events and the ratio of events with positive and negative weights. This analysis will not produce sensible distributions in case of correlated NLO sub-events.

Source code: MC_XS.cc
 1// -*- C++ -*-
 2#include "Rivet/Analysis.hh"
 3#include "Rivet/AnalysisHandler.hh"
 4
 5namespace Rivet {
 6
 7
 8  /// Analysis of the generated cross-section
 9  class MC_XS : public Analysis {
10  public:
11
12    RIVET_DEFAULT_ANALYSIS_CTOR(MC_XS);
13
14
15    /// @name Analysis methods
16    /// @{
17
18    /// Book histograms and initialise projections before the run
19    void init() {
20      /// @todo Convert to Scatter1D or Counter
21      book(_h_XS, "XS");
22      book(_h_N, "N", 1, 0.0, 1.0);
23      book(_h_pmXS, "pmXS", 2, -1.0, 1.0);
24      book(_h_pmN, "pmN", 2, -1.0, 1.0);
25    }
26
27
28    /// Perform the per-event analysis
29    void analyze(const Event& event) {
30
31      const size_t numWeights = event.weights().size();
32      const vector<pair<double,double>> xsecs = event.crossSections();
33      for (size_t m = 0; m < numWeights; ++m) {
34        size_t idx = (xsecs.size() == numWeights)? m : 0;
35        const double xs    = xsecs[idx].first;
36        const double xserr = xsecs[idx].second;
37        _h_XS.get()->persistent(m)->set(xs, xserr);
38        const double weight = event.weights()[m];
39        _h_pmXS.get()->persistent(m)->fill(0.5*(weight > 0 ? 1. : -1), abs(weight));
40        _h_pmN.get()->persistent(m)->fill(0.5*(weight > 0 ? 1. : -1), 1.);
41        _h_N.get()->persistent(m)->fill(0.5, 1.0);
42      }
43
44    }
45
46
47    /// Normalise histograms etc., after the run
48    void finalize() {
49      scale(_h_pmXS, crossSection()/picobarn/sumOfWeights());
50    }
51
52    /// @}
53
54
55    /// @name Histograms
56    /// @{
57    Estimate0DPtr _h_XS;
58    Histo1DPtr _h_pmXS, _h_pmN, _h_N;
59    /// @}
60
61  };
62
63
64
65  RIVET_DECLARE_PLUGIN(MC_XS);
66
67}