class Rivet::AnalysisHandler

Rivet::AnalysisHandler

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

#include <AnalysisHandler.hh>

Public Types

Name
enum classStage { OTHER, INIT, FINALIZE}

Public Functions

Name
Stagestage() const
Return the current processing stage.
stringrunName() const
Get the name of this run.
size_tnumEvents() const
doublesumW() const
Access the sum of the event weights seen.
doublesumW2() const
Access to the sum of squared-weights.
const vector< string > &weightNames() const
Names of event weight categories.
size_tnumWeights() const
Indices of the weights in the original weight matrix.
boolhaveNamedWeights() const
Are any of the weights non-numeric?
voidsetWeightNames(const GenEvent & ge)
Set the weight names from a GenEvent.
size_tdefaultWeightIndex() const
Get the index of the nominal weight-stream.
voidsetWeightCap(const double maxWeight)
Set the weight cap.
voidsetNLOSmearing(double frac)
Set the relative width of the NLO smearing window.
voidskipMultiWeights(bool ignore =false)
Setter for _skipWeights.
voidselectMultiWeights(std::string patterns ="")
Setter for _matchWeightNames.
voiddeselectMultiWeights(std::string patterns ="")
Setter for _unmatchWeightNames.
voidsetNominalWeightName(std::string name ="")
Setter for _nominalWeightName.
Scatter1DPtrcrossSection() const
Get the cross-section known to the handler.
voidsetCrossSection(const vector< pair< double, double > > & xsecs, bool isUserSupplied =false)
Set all cross-sections for the process being generated specifically (preferred)
voidsetCrossSection(const pair< double, double > & xsec, bool isUserSupplied =false)
Set all cross-sections for the process being generated, based on nominal weight.
voidsetCrossSection(double xsec, double xsecerr, bool isUserSupplied =false)
Set the cross-section for the process being generated (alternative signature)
doublenominalCrossSection() const
Get the nominal cross-section.
AnalysisHandler &setRunBeams(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.
PdgIdPairbeamIds() const
doublesqrtS() const
voidcheckBeams(bool check =true)
Option to disable AH beam-consistency checks.
voidsetIgnoreBeams(bool ignore =true)
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.
AnaHandleanalysis(const std::string & analysisname)
Get a registered analysis by name.
AnalysisHandler &addAnalysis(Analysis * analysis)
Add an analysis to the run list by object.
AnalysisHandler &addAnalysis(const std::string & analysisname)
Add an analysis to the run list using its name.
AnalysisHandler &addAnalysis(const std::string & analysisname, std::map< string, string > pars)
Add an analysis with a map of analysis options.
AnalysisHandler &addAnalyses(const std::vector< std::string > & analysisnames)
Add analyses to the run list using their names.
AnalysisHandler &removeAnalysis(const std::string & analysisname)
Remove an analysis from the run list using its name.
AnalysisHandler &removeAnalyses(const std::vector< std::string > & analysisnames)
Remove analyses from the run list using their names.
voidinit(const GenEvent & event)
Initialize a run, with the run beams taken from the example event.
voidanalyze(const GenEvent & event)
Analyze the given event by reference.
voidanalyze(const GenEvent * event)
Analyze the given event by pointer.
voidfinalize()
voidreadData(std::istream & istr, const string & fmt, bool preload =true)
Read analysis plots into the histo collection from the given stream.
voidreadData(const std::string & filename, bool preload =true)
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::AnalysisObjectPtrgetPreload(string path) const
voidwriteData(std::ostream & ostr, const string & fmt) const
Write all analyses’ plots (via getData) to the given stream.
voidwriteData(const string & filename) const
Write all analyses’ plots (via getData) to the named file.
voidsetAODump(const string & dumpfile, int period)
Configure the AnalysisObject dump rate and destination.
voidsetNoAODump()
Configure the AnalysisObject dump rate and destination.
voiddump(const string & dumpfile, int period)
voidmergeYodas(const vector< string > & aofiles, const vector< string > & delopts =vector< string >(), const vector< string > & addopts =vector< string >(), const vector< string > & matches =vector< string >(), const vector< string > & unmatches =vector< string >(), bool equiv =false)
Merge the vector of YODA files, using the cross-section and weight information provided in each.
voidmerge(AnalysisHandler & other)
A method to merge another AnalysisHandler into the current one.
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.
AnalysisHandler &operator=(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.

Detailed Description

class Rivet::AnalysisHandler;

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 AnalysisAnalysisHandler is also responsible for handling the final writing-out of histograms.

Public Types Documentation

enum Stage

EnumeratorValueDescription
OTHER
INIT
FINALIZE

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

Public Functions Documentation

function stage

inline Stage stage() const

Return the current processing stage.

function runName

string runName() const

Get the name of this run.

function numEvents

inline size_t numEvents() const

Get the number of events seen. Should only really be used by external steering code or analyses in the finalize phase.

N.B. This only reports the count for the last collapsed event group and hence ignores any additional sub-events seen so far.

function sumW

inline double sumW() const

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.

function sumW2

inline double sumW2() const

Access to the sum of squared-weights.

function weightNames

inline const vector< string > & weightNames() const

Names of event weight categories.

function numWeights

inline size_t numWeights() const

Indices of the weights in the original weight matrix.

Are any of the weights non-numeric?

function haveNamedWeights

bool haveNamedWeights() const

Are any of the weights non-numeric?

function setWeightNames

void setWeightNames(
    const GenEvent & ge
)

Set the weight names from a GenEvent.

function defaultWeightIndex

inline size_t defaultWeightIndex() const

Get the index of the nominal weight-stream.

function setWeightCap

inline void setWeightCap(
    const double maxWeight
)

Set the weight cap.

function setNLOSmearing

inline void setNLOSmearing(
    double frac
)

Set the relative width of the NLO smearing window.

function skipMultiWeights

void skipMultiWeights(
    bool ignore =false
)

Setter for _skipWeights.

function selectMultiWeights

void selectMultiWeights(
    std::string patterns =""
)

Setter for _matchWeightNames.

function deselectMultiWeights

void deselectMultiWeights(
    std::string patterns =""
)

Setter for _unmatchWeightNames.

function setNominalWeightName

void setNominalWeightName(
    std::string name =""
)

Setter for _nominalWeightName.

function crossSection

inline Scatter1DPtr crossSection() const

Get the cross-section known to the handler.

function setCrossSection

void setCrossSection(
    const vector< pair< double, double > > & xsecs,
    bool isUserSupplied =false
)

Set all cross-sections for the process being generated specifically (preferred)

function setCrossSection

void setCrossSection(
    const pair< double, double > & xsec,
    bool isUserSupplied =false
)

Set all cross-sections for the process being generated, based on nominal weight.

function setCrossSection

inline void setCrossSection(
    double xsec,
    double xsecerr,
    bool isUserSupplied =false
)

Set the cross-section for the process being generated (alternative signature)

function nominalCrossSection

inline double nominalCrossSection() const

Get the nominal cross-section.

function setRunBeams

inline AnalysisHandler & setRunBeams(
    const ParticlePair & beams
)

Set the beam particles for this run.

function beams

inline const ParticlePair & beams() const

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

function beamIds

PdgIdPair beamIds() const

Deprecated:

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

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

function sqrtS

double sqrtS() const

Deprecated:

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

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

function checkBeams

inline void checkBeams(
    bool check =true
)

Option to disable AH beam-consistency checks.

function setIgnoreBeams

void setIgnoreBeams(
    bool ignore =true
)

Deprecated:

Use checkBeams()

Opposite of checkBeams()

function analysisNames

std::vector< std::string > analysisNames() const

Get a list of the currently registered analyses’ names.

function stdAnalysisNames

std::vector< std::string > stdAnalysisNames() const

Get a list of the official analysis names for this release.

function analysesMap

inline const std::map< std::string, AnaHandle > & analysesMap() const

Get the collection of currently registered analyses.

function analyses

inline std::vector< AnaHandle > analyses() const

Get the collection of currently registered analyses.

function analysis

inline AnaHandle analysis(
    const std::string & analysisname
)

Get a registered analysis by name.

function addAnalysis

AnalysisHandler & addAnalysis(
    Analysis * analysis
)

Add an analysis to the run list by object.

function addAnalysis

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.

function addAnalysis

AnalysisHandler & addAnalysis(
    const std::string & analysisname,
    std::map< string, string > pars
)

Add an analysis with a map of analysis options.

function addAnalyses

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.

function removeAnalysis

AnalysisHandler & removeAnalysis(
    const std::string & analysisname
)

Remove an analysis from the run list using its name.

function removeAnalyses

AnalysisHandler & removeAnalyses(
    const std::vector< std::string > & analysisnames
)

Remove analyses from the run list using their names.

function init

void init(
    const GenEvent & event
)

Initialize a run, with the run beams taken from the example event.

function analyze

void analyze(
    const GenEvent & event
)

Analyze the given event by reference.

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

function analyze

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

function finalize

void finalize()

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

function readData

void readData(
    std::istream & istr,
    const string & fmt,
    bool preload =true
)

Read analysis plots into the histo collection from the given stream.

Use the fmt flag to specify the YODA output format (yoda, yoda.gz, yoda.h5, …)

function readData

void readData(
    const std::string & filename,
    bool preload =true
)

Read analysis plots into the histo collection (via addData) from the named file.

function getYodaAOs

vector< YODA::AnalysisObjectPtr > getYodaAOs(
    bool includeraw =false
) const

Get all YODA analysis objects (across all weights, optionally including RAW)

function getPreload

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

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

function writeData

void writeData(
    std::ostream & ostr,
    const string & fmt
) const

Write all analyses’ plots (via getData) to the given stream.

Use the fmt flag to specify the YODA output format (yoda, yoda.gz, yoda.h5, …)

function writeData

void writeData(
    const string & filename
) const

Write all analyses’ plots (via getData) to the named file.

function setAODump

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

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.

function setNoAODump

inline void setNoAODump()

Configure the AnalysisObject dump rate and destination.

function dump

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

Deprecated:

Prefer setAODump()

Alias for setAODump()

function mergeYodas

void mergeYodas(
    const vector< string > & aofiles,
    const vector< string > & delopts =vector< string >(),
    const vector< string > & addopts =vector< string >(),
    const vector< string > & matches =vector< string >(),
    const vector< string > & unmatches =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 written out by writeData().

If delopts is non-empty, it is assumed to contain names of different options to be merged into the same analysis objects.

function merge

void merge(
    AnalysisHandler & other
)

A method to merge another AnalysisHandler into the current one.

function AnalysisHandler

AnalysisHandler(
    const string & runname =""
)

Preferred constructor, with optional run name.

function AnalysisHandler

AnalysisHandler(
    const AnalysisHandler & 
) =delete

The copy constructor is deleted, so it can never be called.

function operator=

AnalysisHandler & operator=(
    const AnalysisHandler & 
) =delete

The assignment operator is deleted, so it can never be called.

function ~AnalysisHandler

~AnalysisHandler()

The destructor is not virtual, as this class should not be inherited from.


Updated on 2022-08-07 at 20:17:16 +0100