Rivet
1.8.3
|
#include <AnalysisHandler.hh>
Public Member Functions | |
Constructors and destructors. */ | |
AnalysisHandler (const string &runname="") | |
Preferred constructor, with optional run name. | |
AnalysisHandler (const string &basefilename, const string &runname, HistoFormat storetype=AIDAML) | |
Make a Rivet handler with a set base filename and store type. | |
~AnalysisHandler () | |
Destructor The destructor is not virtual, as this class should not be inherited from. | |
Run properties | |
string | runName () const |
Get the name of this run. | |
size_t | numEvents () const |
double | sumOfWeights () const |
void | setSumOfWeights (const double &sum) |
bool | needCrossSection () const |
Is cross-section information required by at least one child analysis? | |
AnalysisHandler & | setCrossSection (double xs) |
Set the cross-section for the process being generated. | |
double | crossSection () const |
Get the cross-section known to the handler. | |
bool | hasCrossSection () const |
Whether the handler knows about a cross-section. | |
AnalysisHandler & | setRunBeams (const ParticlePair &beams) |
Set beams for this run. | |
const ParticlePair & | beams () const |
Get beam IDs for this run, usually determined from the first event. | |
PdgIdPair | beamIds () const |
Get beam IDs for this run, usually determined from the first event. | |
double | sqrtS () const |
Get energy for this run, usually determined from the first event. | |
void | setIgnoreBeams (bool ignore=true) |
Setter for _ignoreBeams. | |
Handle analyses | |
std::vector< std::string > | analysisNames () const |
Get a list of the currently registered analyses' names. | |
const std::set< AnaHandle, AnaHandleLess > & | analyses () const |
Get the collection of currently registered analyses. | |
AnalysisHandler & | addAnalysis (const std::string &analysisname) |
AnalysisHandler & | removeAnalysis (const std::string &analysisname) |
Remove an analysis from the run list using its name. | |
AnalysisHandler & | addAnalyses (const std::vector< std::string > &analysisnames) |
AnalysisHandler & | removeAnalyses (const std::vector< std::string > &analysisnames) |
Remove analyses from the run list using their names. | |
AnalysisHandler & | addAnalysis (Analysis *analysis) |
Add an analysis to the run list by object. | |
Main init/execute/finalise | |
void | init () |
void | init (const GenEvent &event) |
Initialize a run, with the run beams taken from the example event. | |
void | analyze (const GenEvent &event) |
void | finalize () |
AIDA factories etc. | |
| |
AIDA::IAnalysisFactory & | analysisFactory () |
void | commitData () |
void | writeData (const std::string &filename) |
AIDA::ITree & | tree () |
AIDA::IHistogramFactory & | histogramFactory () |
AIDA::IDataPointSetFactory & | datapointsetFactory () |
A class which handles a number of analysis objects to be applied to generated events. An Analysis' AnalysisHandler is also responsible for handling the final writing-out of histograms.
Rivet::AnalysisHandler::AnalysisHandler | ( | const string & | basefilename, |
const string & | runname, | ||
HistoFormat | storetype = AIDAML |
||
) |
Make a Rivet handler with a set base filename and store type.
An AnalysisHandler built with this constructor sets the output histo format and filename when the handler is created rather than when it is written. This is not the preferred behaviour, to allow for more flexible histogramming in future, use the writeData() method to supply the filename and format at the point of file-writing.
Note that the run name is now a compulsory argument: this is to avoid conflict with the preferred one-argument constructor.
References Rivet::createAnalysisFactory().
AnalysisHandler & Rivet::AnalysisHandler::addAnalyses | ( | const std::vector< std::string > & | analysisnames | ) |
Add analyses to the run list using their names. The actual Analysis' to be used will be obtained via AnalysisHandler::addAnalysis(string), which in turn uses AnalysisHandler::getAnalysis(string). If no matching analysis is found for a given name, no analysis is added, but also no error is thrown.
References addAnalysis().
AnalysisHandler & Rivet::AnalysisHandler::addAnalysis | ( | const std::string & | analysisname | ) |
Add an analysis to the run list using its name. The actual Analysis to be used will be obtained via AnalysisHandler::getAnalysis(string). If no matching analysis is found, no analysis is added (i.e. the null pointer is checked and discarded.
References Rivet::AnalysisLoader::getAnalysis().
Referenced by addAnalyses().
AIDA::IAnalysisFactory & Rivet::AnalysisHandler::analysisFactory | ( | ) |
The AIDA analysis factory.
Referenced by Rivet::Analysis::analysisFactory().
void Rivet::AnalysisHandler::analyze | ( | const GenEvent & | event | ) |
Analyze the given event. This function will call the AnalysisBase::analyze() function of all included analysis objects.
References beamIds(), beams(), Rivet::compatible(), Rivet::fuzzyEquals(), init(), setCrossSection(), sqrtS(), and Rivet::toBeamsString().
void Rivet::AnalysisHandler::commitData | ( | ) |
AIDA::IDataPointSetFactory & Rivet::AnalysisHandler::datapointsetFactory | ( | ) |
The AIDA histogram factory.
Referenced by Rivet::Analysis::datapointsetFactory().
void Rivet::AnalysisHandler::finalize | ( | ) |
AIDA::IHistogramFactory & Rivet::AnalysisHandler::histogramFactory | ( | ) |
The AIDA histogram factory.
Referenced by Rivet::Analysis::histogramFactory().
|
inline |
Referenced by analyze().
size_t Rivet::AnalysisHandler::numEvents | ( | ) | const |
Get the number of events seen. Should only really be used by external steering code or analyses in the finalize phase.
Referenced by Rivet::Analysis::numEvents().
void Rivet::AnalysisHandler::setSumOfWeights | ( | const double & | sum | ) |
Set sum of weights. This is useful if Rivet is steered externally and the analyses are run for a sub-contribution of the events (but of course have to be normalised to the total sum of weights)
double Rivet::AnalysisHandler::sumOfWeights | ( | ) | const |
Get the sum of the event weights seen - the weighted equivalent of the number of events. Should only really be used by external steering code or analyses in the finalize phase.
Referenced by Rivet::Analysis::sumOfWeights().
AIDA::ITree & Rivet::AnalysisHandler::tree | ( | ) |
The AIDA tree object.
Referenced by commitData(), finalize(), Rivet::Analysis::tree(), and writeData().
void Rivet::AnalysisHandler::writeData | ( | const std::string & | filename | ) |