Rivet API documentation

Rivet 4.1.3
Run.hh
1// -*- C++ -*-
2#ifndef RIVET_Run_HH
3#define RIVET_Run_HH
4
5#include "Rivet/Tools/Logging.hh"
6#include "Rivet/Tools/RivetHepMC.hh"
7#include "Rivet/Tools/RivetSTL.hh"
8
9namespace Rivet {
10
11
12 // Forward declaration
13 class AnalysisHandler;
14
15
17 class Run {
18 public:
19
20 // /// Default constructor, makes its own default AnalysisHandler.
21 // /// @todo Allowing this requires the AnalysisHandler to be stored by value/ptr...
22 // Run();
23
26
29
30
33
35 AnalysisHandler& handler() {
36 return _ah;
37 }
38
40 const AnalysisHandler& handler() const {
41 return _ah;
42 }
43
45
46
49
51 Run& setCrossSection(double xs);
52
54 Run& setListAnalyses(bool dolist);
55
57
58
61
63 bool init(const std::string& evtfile, double weight = 1.0);
64
66 bool openFile(const std::string& evtfile, double weight = 1.0);
67
69 bool readEvent();
70
74 bool readEvents(const std::string& evtfile, int nmax = -1, double weight = 1.0);
75
77 //bool skipEvent();
78
81 size_t numEvents() const {
82 return _evtcount;
83 }
84
87
89 bool finalize();
90
92
93
94 private:
95
97 Log& getLog() const;
98
100 AnalysisHandler& _ah;
101
104
107 double _fileweight = 1.0;
108
110 double _xs = NAN;
111
113 size_t _evtcount = 0;
114
116 int _evtnumber = -1;
117
119
120
122 bool _listAnalyses = false;
123
124
127
129 std::shared_ptr<GenEvent> _evt;
130
132 std::shared_ptr<std::istream> _istr;
133
135 std::shared_ptr<HepMC_IO_type> _hepmcReader;
136
138 };
139
140
141}
142
143#endif
The key class for coordination of Analysis objects and the event loop.
Definition AnalysisHandler.hh:29
Logging system for controlled & formatted writing to stdout.
Definition Logging.hh:10
bool init(const std::string &evtfile, double weight=1.0)
Set up HepMC file readers (using the appropriate file weight for the first file).
bool readEvent()
Read the next HepMC event.
Run & setCrossSection(double xs)
Get the cross-section for this run.
Run & setListAnalyses(bool dolist)
Declare whether to list available analyses.
bool openFile(const std::string &evtfile, double weight=1.0)
Open a HepMC GenEvent file (using the appropriate file weight for the first file).
bool processEvent()
Handle next event.
size_t numEvents() const
Read the next HepMC event only to skip it.
Definition Run.hh:81
bool finalize()
Close up HepMC I/O.
bool readEvents(const std::string &evtfile, int nmax=-1, double weight=1.0)
Run(AnalysisHandler &ah)
Standard constructor.
~Run()
Destructor.
Definition LHCbCommon.hh:9