2 #ifndef RIVET_RivetHandler_HH 3 #define RIVET_RivetHandler_HH 5 #include "Rivet/Config/RivetCommon.hh" 6 #include "Rivet/Particle.hh" 7 #include "Rivet/AnalysisLoader.hh" 8 #include "Rivet/Tools/RivetYODA.hh" 15 typedef std::shared_ptr<Analysis> AnaHandle;
20 bool operator() (
const AnaHandle& a,
const AnaHandle& b)
const {
21 return a.get() < b.get();
57 string runName()
const {
return _runname; }
62 size_t numEvents()
const {
return _eventcounter.numEntries(); }
68 double sumW()
const {
return _eventcounter.sumW(); }
70 double sumW2()
const {
return _eventcounter.sumW2(); }
90 throw Error(
"Can't set sum of weights independently, since it's now tracked by a Counter. " 91 "Please contact the Rivet authors if you need this.");
97 bool needCrossSection()
const;
100 bool hasCrossSection()
const;
112 MSG_DEBUG(
"Setting run beams = " << beams <<
" @ " <<
sqrtS()/GeV <<
" GeV");
117 const ParticlePair&
beams()
const {
return _beams; }
125 double sqrtS()
const;
128 void setIgnoreBeams(
bool ignore=
true);
137 std::vector<std::string> analysisNames()
const;
140 const std::set<AnaHandle, CmpAnaHandle>&
analyses()
const {
145 const AnaHandle analysis(
const std::string& analysisname)
const;
159 AnalysisHandler& addAnalysis(
const std::string& analysisname, std::map<string, string> pars);
167 AnalysisHandler& addAnalyses(
const std::vector<std::string>& analysisnames);
174 AnalysisHandler& removeAnalyses(
const std::vector<std::string>& analysisnames);
183 void init(
const GenEvent& event);
189 void analyze(
const GenEvent& event);
195 void analyze(
const GenEvent* event);
208 void addData(
const std::vector<AnalysisObjectPtr>& aos);
211 void readData(
const std::string& filename);
214 std::vector<AnalysisObjectPtr> getData(
bool includeorphans =
false,
215 bool includetmps =
false)
const;
218 void writeData(
const std::string& filename)
const;
223 void dump(
string dumpfile,
int period) {
224 _dumpPeriod = period;
225 _dumpFile = dumpfile;
242 void mergeYodas(
const vector<string> & aofiles,
243 const vector<string> & delopts = vector<string>(),
247 void stripOptions(AnalysisObjectPtr ao,
248 const vector<string> & delopts)
const;
255 set<AnaHandle, CmpAnaHandle> _analyses;
259 vector<AnalysisObjectPtr> _orphanedPreloads;
263 vector<AnalysisObjectPtr> _finalizedAOs;
269 std::string _runname;
272 Counter _eventcounter;
Definition: ALICE_2010_I880049.cc:13
const ParticlePair & beams() const
Get the beam particles for this run, usually determined from the first event.
Definition: AnalysisHandler.hh:117
ParticlePair beams(const Event &e)
Get beam particles from an event.
Definition: Beam.cc:9
double crossSection() const
Get the cross-section known to the handler.
Definition: AnalysisHandler.hh:103
void setSumOfWeights(const double &sum)
Set the sum of weights.
Definition: AnalysisHandler.hh:88
double sumW2() const
Access to the sum of squared-weights.
Definition: AnalysisHandler.hh:70
double sqrtS(const FourMomentum &pa, const FourMomentum &pb)
Get beam centre-of-mass energy from a pair of beam momenta.
Definition: Beam.cc:35
Definition: AnalysisHandler.hh:19
Generic runtime Rivet error.
Definition: Exceptions.hh:12
double sumOfWeights() const
Compatibility alias for sumOfWeights.
Definition: AnalysisHandler.hh:75
This is the base class of all analysis classes in Rivet.
Definition: Analysis.hh:52
T sum(const CONTAINER &c, const T &start=T())
Generic sum function, adding x for all x in container c, starting with start.
Definition: Utils.hh:345
PdgIdPair beamIds(const ParticlePair &beams)
Definition: Beam.hh:21
Definition: AnalysisHandler.hh:29
void dump(string dumpfile, int period)
Definition: AnalysisHandler.hh:223
double sumW() const
Access the sum of the event weights seen.
Definition: AnalysisHandler.hh:68
const std::set< AnaHandle, CmpAnaHandle > & analyses() const
Get the collection of currently registered analyses.
Definition: AnalysisHandler.hh:140
size_t numEvents() const
Definition: AnalysisHandler.hh:62
string runName() const
Get the name of this run.
Definition: AnalysisHandler.hh:57
AnalysisHandler & setRunBeams(const ParticlePair &beams)
Set the beam particles for this run.
Definition: AnalysisHandler.hh:110