Rivet::AnalysisHandler Class Reference

`#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. More...
| ~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.

Deprecated:
  All this will be removed when histogramming is overhauled

AIDA::IAnalysisFactory & | analysisFactory ()
void | commitData ()
void | writeData (const std::string &filename)
AIDA::ITree & | tree ()
AIDA::IHistogramFactory & | histogramFactory ()
AIDA::IDataPointSetFactory & | datapointsetFactory ()

## Detailed Description

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.

## Constructor & Destructor Documentation

## AnalysisHandler()

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.

Deprecated:
  Prefer to specify output files and formats explicitly.

References Rivet::createAnalysisFactory().

## Member Function Documentation

## addAnalyses()

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

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

Todo:
  Might we want to be able to run an analysis twice, with different params? Requires avoiding histo tree clashes, i.e. storing the histos on the analysis objects.

References Rivet::AnalysisLoader::getAnalysis().

Referenced by addAnalyses().

## analysisFactory()

AIDA::IAnalysisFactory & Rivet::AnalysisHandler::analysisFactory | ( |  | ) |

The AIDA analysis factory.

Deprecated:
  When AIDA goes, this goes...

Referenced by Rivet::Analysis::analysisFactory().

## analyze()

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 Rivet::beamIds(), beams(), Rivet::compatible(), Rivet::fuzzyEquals(), init(), setCrossSection(), Rivet::sqrtS(), sqrtS(), and Rivet::toBeamsString().

## commitData()

void Rivet::AnalysisHandler::commitData | ( |  | ) |

Commit the AIDA tree to file.

Deprecated:
  When AIDA goes, this goes...

References tree().

## datapointsetFactory()

AIDA::IDataPointSetFactory & Rivet::AnalysisHandler::datapointsetFactory | ( |  | ) |

The AIDA histogram factory.

Deprecated:
  When AIDA goes, this goes...

Referenced by Rivet::Analysis::datapointsetFactory(), and writeData().

## finalize()

void Rivet::AnalysisHandler::finalize | ( |  | ) |

Finalize a run. This function first calls the AnalysisBase::finalize() functions of all included analysis objects and converts all histograms to AIDA DataPointSet objects in the AIDA tree. Using the histogram tree for further analysis or writing to file is left to the API user.

References tree().

## histogramFactory()

AIDA::IHistogramFactory & Rivet::AnalysisHandler::histogramFactory | ( |  | ) |

The AIDA histogram factory.

Deprecated:
  When AIDA goes, this goes...

Referenced by Rivet::Analysis::histogramFactory().

## init()

void Rivet::AnalysisHandler::init | ( |  | ) |

inline

Deprecated:
  Obsolete method, kept only for backwards compatibility

Referenced by analyze().

## numEvents()

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

## setSumOfWeights()

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)

## sumOfWeights()

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

## tree()

AIDA::ITree & Rivet::AnalysisHandler::tree | ( |  | ) |

The AIDA tree object.

Deprecated:
  When AIDA goes, this goes...

Referenced by commitData(), finalize(), removeAnalysis(), Rivet::Analysis::tree(), and writeData().

## writeData()

void Rivet::AnalysisHandler::writeData | ( | const std::string & | filename | ) |

Write the AIDA tree to the named file.

Deprecated:
  When AIDA goes, this goes...

References datapointsetFactory(), and tree().

The documentation for this class was generated from the following files:

- include/Rivet/AnalysisHandler.hh
- src/Core/AnalysisHandler.cc