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
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.

Source code: MC_XS.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 74 75 76 77 78 79 80 // -*- C++ -*- #include "Rivet/Analysis.hh" #include "HepMC/HepMCDefs.h" namespace Rivet { /// @brief Analysis for the generated cross section class MC_XS : public Analysis { public: /// @name Constructors etc. //@{ /// Constructor MC_XS() : Analysis("MC_XS") { } //@} public: /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { /// @todo Convert to Scatter1D or Counter _h_XS = bookScatter2D("XS"); _h_N = bookHisto1D("N", 1, 0.0, 1.0); _h_pmXS = bookHisto1D("pmXS", 2, -1.0, 1.0); _h_pmN = bookHisto1D("pmN", 2, -1.0, 1.0); _mc_xs = _mc_error = 0.; } /// Perform the per-event analysis void analyze(const Event& event) { _h_N->fill(0.5,1.); _h_pmXS->fill(0.5*(event.weight() > 0 ? 1. : -1), abs(event.weight())); _h_pmN ->fill(0.5*(event.weight() > 0 ? 1. : -1), 1.); #ifdef HEPMC_HAS_CROSS_SECTION _mc_xs = event.genEvent()->cross_section()->cross_section(); _mc_error = event.genEvent()->cross_section()->cross_section_error(); #endif } /// Normalise histograms etc., after the run void finalize() { scale(_h_pmXS, crossSection()/sumOfWeights()); #ifndef HEPMC_HAS_CROSS_SECTION _mc_xs = crossSection(); _mc_error = 0.0; #endif _h_XS->addPoint(0, _mc_xs, 0.5, _mc_error); } //@} private: /// @name Histograms //@{ Scatter2DPtr _h_XS; Histo1DPtr _h_N; Histo1DPtr _h_pmXS; Histo1DPtr _h_pmN; double _mc_xs, _mc_error; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(MC_XS); }