Rivet  3.1.3
Public Member Functions | List of all members
Rivet::AnalysisHandler Class Reference

The key class for coordination of Analysis objects and the event loop. More...

#include <AnalysisHandler.hh>

Public Member Functions

 AnalysisHandler (const string &runname="")
 Preferred constructor, with optional run name.
 
 AnalysisHandler (const AnalysisHandler &)=delete
 The copy constructor is deleted, so it can never be called.
 
AnalysisHandleroperator= (const AnalysisHandler &)=delete
 The assignment operator is deleted, so it can never be called.
 
 ~AnalysisHandler ()
 The destructor is not virtual, as this class should not be inherited from.
 
Run properties and weights
string runName () const
 Get the name of this run.
 
size_t numEvents () const
 
double sumW () const
 Access the sum of the event weights seen. More...
 
double sumW2 () const
 Access to the sum of squared-weights.
 
const vector< string > & weightNames () const
 Names of event weight categories.
 
size_t numWeights () const
 Indices of the weights in the original weight matrix. More...
 
bool haveNamedWeights () const
 Are any of the weights non-numeric?
 
void setWeightNames (const GenEvent &ge)
 Set the weight names from a GenEvent.
 
size_t defaultWeightIndex () const
 Get the index of the nominal weight-stream.
 
void setWeightCap (const double maxWeight)
 Set the weight cap.
 
void setNLOSmearing (double frac)
 Set the relative width of the NLO smearing window.
 
void skipMultiWeights (bool ignore=false)
 Setter for _skipWeights.
 
void selectMultiWeights (std::string patterns="")
 Setter for _matchWeightNames.
 
void deselectMultiWeights (std::string patterns="")
 Setter for _unmatchWeightNames.
 
void setNominalWeightName (std::string name="")
 Setter for _nominalWeightName.
 
Cross-sections
Scatter1DPtr crossSection () const
 Get the cross-section known to the handler.
 
void setCrossSection (const pair< double, double > &xsec, bool isUserSupplied=false)
 Set the cross-section for the process being generated.
 
void setCrossSection (double xsec, double xsecerr, bool isUserSupplied=false)
 Set the cross-section for the process being generated (alternative signature)
 
double nominalCrossSection () const
 Get the nominal cross-section.
 
Beams
AnalysisHandlersetRunBeams (const ParticlePair &beams)
 Set the beam particles for this run.
 
const ParticlePair & beams () const
 Get the beam particles for this run, usually determined from the first event.
 
PdgIdPair beamIds () const
 
double sqrtS () const
 
void checkBeams (bool check=true)
 
void setIgnoreBeams (bool ignore=true)
 
Analysis handling
std::vector< std::string > analysisNames () const
 Get a list of the currently registered analyses' names.
 
std::vector< std::string > stdAnalysisNames () const
 Get a list of the official analysis names for this release.
 
const std::map< std::string, AnaHandle > & analysesMap () const
 Get the collection of currently registered analyses.
 
std::vector< AnaHandle > analyses () const
 Get the collection of currently registered analyses.
 
AnaHandle analysis (const std::string &analysisname)
 Get a registered analysis by name.
 
AnalysisHandleraddAnalysis (Analysis *analysis)
 Add an analysis to the run list by object.
 
AnalysisHandleraddAnalysis (const std::string &analysisname)
 Add an analysis to the run list using its name. More...
 
AnalysisHandleraddAnalysis (const std::string &analysisname, std::map< string, string > pars)
 Add an analysis with a map of analysis options.
 
AnalysisHandleraddAnalyses (const std::vector< std::string > &analysisnames)
 Add analyses to the run list using their names. More...
 
AnalysisHandlerremoveAnalysis (const std::string &analysisname)
 Remove an analysis from the run list using its name.
 
AnalysisHandlerremoveAnalyses (const std::vector< std::string > &analysisnames)
 Remove analyses from the run list using their names.
 
Main init/execute/finalise
void init (const GenEvent &event)
 Initialize a run, with the run beams taken from the example event.
 
void analyze (const GenEvent &event)
 Analyze the given event by reference. More...
 
void analyze (const GenEvent *event)
 Analyze the given event by pointer. More...
 
void finalize ()
 
Histogram / data object access
void readData (const std::string &filename)
 Read analysis plots into the histo collection (via addData) from the named file.
 
vector< YODA::AnalysisObjectPtr > getYodaAOs (bool includeraw=false) const
 Get all YODA analysis objects (across all weights, optionally including RAW)
 
const YODA::AnalysisObjectPtr getPreload (string path) const
 
void writeData (const string &filename) const
 Write all analyses' plots (via getData) to the named file.
 
void setAODump (const string &dumpfile, int period)
 Configure the AnalysisObject dump rate and destination. More...
 
void setNoAODump ()
 Configure the AnalysisObject dump rate and destination.
 
void dump (const string &dumpfile, int period)
 
void mergeYodas (const vector< string > &aofiles, const vector< string > &delopts=vector< string >(), const vector< string > &addopts=vector< string >(), bool equiv=false)
 Merge the vector of YODA files, using the cross-section and weight information provided in each. More...
 

Processing stage

enum  Stage { OTHER, INIT, FINALIZE }
 
Stage stage () const
 Return the current processing stage.
 

Detailed Description

The key class for coordination of Analysis objects and the event loop.

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.

Member Enumeration Documentation

◆ Stage

Indicate which Rivet stage we're in. At the moment, only INIT is used to enable booking.

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 AnalysisLoader::getAnalysis(string). If no matching analysis is found for a given name, no analysis is added, but also no error is thrown.

Referenced by analysis().

◆ 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 AnalysisLoader::getAnalysis(string). If no matching analysis is found, no analysis is added (i.e. the null pointer is checked and discarded.

◆ analyze() [1/2]

void Rivet::AnalysisHandler::analyze ( const GenEvent &  event)

Analyze the given event by reference.

This function will call the AnalysisBase::analyze() function of all included analysis objects.

Referenced by analysis().

◆ analyze() [2/2]

void Rivet::AnalysisHandler::analyze ( const GenEvent *  event)

Analyze the given event by pointer.

This function will call the AnalysisBase::analyze() function of all included analysis objects, after checking the event pointer validity.

◆ beamIds()

PdgIdPair Rivet::AnalysisHandler::beamIds ( ) const

Get beam IDs for this run, usually determined from the first event.

Deprecated:
Use standalone beamIds(ah.beams()), to clean AH interface

Referenced by beams().

◆ checkBeams()

void Rivet::AnalysisHandler::checkBeams ( bool  check = true)
inline

Option to disable AH beam-consistency checks

Todo:
Make this the canonical name

References analysisNames(), setIgnoreBeams(), and stdAnalysisNames().

◆ dump()

void Rivet::AnalysisHandler::dump ( const string &  dumpfile,
int  period 
)
inline

Alias for setAODump()

Deprecated:
Prefer setAODump()

References mergeYodas().

Referenced by setAODump().

◆ finalize()

void Rivet::AnalysisHandler::finalize ( )

Finalize a run. This function calls the AnalysisBase::finalize() functions of all included analysis objects.

Referenced by analysis().

◆ getPreload()

const YODA::AnalysisObjectPtr Rivet::AnalysisHandler::getPreload ( string  path) const
inline

Get a pointer to a preloaded yoda object with the given path, or null if path is not found.

References writeData().

◆ mergeYodas()

void Rivet::AnalysisHandler::mergeYodas ( const vector< string > &  aofiles,
const vector< string > &  delopts = vector< string >(),
const vector< string > &  addopts = vector< string >(),
bool  equiv = false 
)

Merge the vector of YODA files, using the cross-section and weight information provided in each.

Each file in aofiles is assumed to have been produced by Rivet. By default the files are assumed to contain different processes (or the same processs but mutually exclusive cuts), but if equiv if true, the files are assumed to contain output of completely equivalent (but statistically independent) Rivet runs. The corresponding analyses will be loaded and their analysis objects will be filled with the merged result. finalize() will be run on each relevant analysis. The resulting YODA file can then be rwitten out by writeData(). If delopts is non-empty, it is assumed to contain names different options to be merged into the same analysis objects.

Todo:
Shouldn't this be private? Why is the Cython interface calling it?

Referenced by dump().

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

◆ numWeights()

size_t Rivet::AnalysisHandler::numWeights ( ) const
inline

Indices of the weights in the original weight matrix.

Are any of the weights non-numeric?

References haveNamedWeights(), and setWeightNames().

◆ setAODump()

void Rivet::AnalysisHandler::setAODump ( const string &  dumpfile,
int  period 
)
inline

Configure the AnalysisObject dump rate and destination.

Tell Rivet to dump intermediate result to a file named dumpfile every period'th event. If period is not positive, no dumping will be done.

References dump().

Referenced by setNoAODump().

◆ setIgnoreBeams()

void Rivet::AnalysisHandler::setIgnoreBeams ( bool  ignore = true)

Alias for checkBeams()

Deprecated:
Use checkBeams()

Referenced by checkBeams().

◆ sqrtS()

double Rivet::AnalysisHandler::sqrtS ( ) const

Get energy for this run, usually determined from the first event.

Deprecated:
Use standalone sqrtS(ah.beams()), to clean AH interface

Referenced by beams(), and setRunBeams().

◆ sumW()

double Rivet::AnalysisHandler::sumW ( ) const
inline

Access the sum of the event weights seen.

This is the weighted equivalent of the number of events. It should only be used by external steering code or analyses in the finalize phase.


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