Rivet
1.8.0
|
This is the base class of all analysis classes in Rivet. More...
#include <Analysis.hh>
Public Member Functions | |
AnalysisHandler & | handler () const |
Access the controlling AnalysisHandler object. | |
void | normalize (AIDA::IHistogram1D *&histo, double norm=1.0) |
void | scale (AIDA::IHistogram1D *&histo, double scale) |
void | normalize (AIDA::IHistogram2D *&histo, double norm=1.0) |
void | scale (AIDA::IHistogram2D *&histo, double scale) |
Analysis & | setCrossSection (double xs) |
Set the cross section from the generator. | |
Standard constructors and destructors. | |
Analysis (const std::string &name) | |
Constructor. | |
virtual | ~Analysis () |
The destructor. | |
Main analysis methods | |
virtual void | init () |
virtual void | analyze (const Event &event)=0 |
virtual void | finalize () |
Metadata | |
Metadata is used for querying from the command line and also for building web pages and the analysis pages in the Rivet manual. | |
const AnalysisInfo & | info () const |
Get the actual AnalysisInfo object in which all this metadata is stored. | |
virtual std::string | name () const |
Get the name of the analysis. | |
virtual std::string | inspireId () const |
Get the Inspire ID code for this analysis. | |
virtual std::string | spiresId () const |
Get the SPIRES ID code for this analysis (~deprecated). | |
virtual std::vector< std::string > | authors () const |
Names & emails of paper/analysis authors. | |
virtual std::string | summary () const |
Get a short description of the analysis. | |
virtual std::string | description () const |
Get a full description of the analysis. | |
virtual std::string | runInfo () const |
Information about the events needed as input for this analysis. | |
virtual std::string | experiment () const |
Experiment which performed and published this analysis. | |
virtual std::string | collider () const |
Collider on which the experiment ran. | |
virtual std::string | year () const |
When the original experimental analysis was published. | |
virtual std::vector< std::string > | references () const |
Journal, and preprint references. | |
virtual std::string | bibKey () const |
BibTeX citation key for this article. | |
virtual std::string | bibTeX () const |
BibTeX citation entry for this article. | |
virtual std::string | status () const |
Whether this analysis is trusted (in any way!) | |
virtual std::vector< std::string > | todos () const |
Any work to be done on this analysis. | |
virtual const std::vector < PdgIdPair > & | requiredBeams () const |
Return the allowed pairs of incoming beams required by this analysis. | |
virtual Analysis & | setRequiredBeams (const std::vector< PdgIdPair > &requiredBeams) |
Declare the allowed pairs of incoming beams required by this analysis. | |
virtual const std::vector < std::pair< double, double > > & | requiredEnergies () const |
Sets of valid beam energy pairs, in GeV. | |
virtual Analysis & | setRequiredEnergies (const std::vector< std::pair< double, double > > &requiredEnergies) |
Declare the list of valid beam energy pairs, in GeV. | |
bool | needsCrossSection () const |
Return true if this analysis needs to know the process cross-section. | |
Analysis & | setNeedsCrossSection (bool needed=true) |
Declare whether this analysis needs to know the process cross-section from the generator. | |
Internal metadata modifiying methods | |
AnalysisInfo & | info () |
Get the actual AnalysisInfo object in which all this metadata is stored (non-const). | |
virtual Analysis & | setBeams (PdgId beam1, PdgId beam2) |
Run conditions | |
const ParticlePair & | beams () const |
Incoming beams for this run. | |
const PdgIdPair | beamIds () const |
Incoming beam IDs for this run. | |
double | sqrtS () const |
Centre of mass energy for this run. | |
Analysis / beam compatibility testing | |
bool | isCompatible (const ParticlePair &beams) const |
Check if analysis is compatible with the provided beam particle IDs and energies. | |
bool | isCompatible (PdgId beam1, PdgId beam2, double e1, double e2) const |
Check if analysis is compatible with the provided beam particle IDs and energies. | |
bool | isCompatible (const PdgIdPair &beams, const std::pair< double, double > &energies) const |
Check if analysis is compatible with the provided beam particle IDs and energies. | |
Protected Member Functions | |
Log & | getLog () const |
Get a Log object based on the name() property of the calling analysis object. | |
double | crossSection () const |
Get the process cross-section in pb. Throws if this hasn't been set. | |
double | crossSectionPerEvent () const |
size_t | numEvents () const |
double | sumOfWeights () const |
AIDA analysis infrastructure. | |
AIDA::IAnalysisFactory & | analysisFactory () |
Access the AIDA analysis factory of the controlling AnalysisHandler object. | |
AIDA::ITree & | tree () |
Access the AIDA tree of the controlling AnalysisHandler object. | |
AIDA::IHistogramFactory & | histogramFactory () |
Access the AIDA histogram factory of the controlling AnalysisHandler object. | |
AIDA::IDataPointSetFactory & | datapointsetFactory () |
Access the AIDA histogram factory of the controlling AnalysisHandler object. | |
const std::string | histoDir () const |
Get the canonical histogram "directory" path for this analysis. | |
const std::string | histoPath (const std::string &hname) const |
Get the canonical histogram path for the named histogram in this analysis. | |
const std::string | histoPath (size_t datasetId, size_t xAxisId, size_t yAxisId) const |
Get the canonical histogram path for the numbered histogram in this analysis. | |
const std::string | makeAxisCode (size_t datasetId, size_t xAxisId, size_t yAxisId) const |
Get the internal histogram name for given d, x and y (cf. HepData) | |
Internal histogram booking (for use by Analysis sub-classes). | |
const BinEdges & | binEdges (const std::string &hname) const |
Get bin edges for a named histo (using ref AIDA caching) | |
const BinEdges & | binEdges (size_t datasetId, size_t xAxisId, size_t yAxisId) const |
Get bin edges for a numbered histo (using ref AIDA caching) | |
BinEdges | logBinEdges (size_t nbins, double lower, double upper) |
Get bin edges with logarithmic widths. | |
AIDA::IHistogram1D * | bookHistogram1D (const std::string &name, size_t nbins, double lower, double upper, const std::string &title="", const std::string &xtitle="", const std::string &ytitle="") |
AIDA::IHistogram1D * | bookHistogram1D (const std::string &name, const std::vector< double > &binedges, const std::string &title="", const std::string &xtitle="", const std::string &ytitle="") |
AIDA::IHistogram2D * | bookHistogram2D (const std::string &name, size_t nxbins, double xlower, double xupper, size_t nybins, double ylower, double yupper, const std::string &title="", const std::string &xtitle="", const std::string &ytitle="", const std::string &ztitle="") |
AIDA::IHistogram2D * | bookHistogram2D (const std::string &name, const std::vector< double > &xbinedges, const std::vector< double > &ybinedges, const std::string &title="", const std::string &xtitle="", const std::string &ytitle="", const std::string &ztitle="") |
AIDA::IHistogram1D * | bookHistogram1D (const std::string &name, const std::string &title="", const std::string &xtitle="", const std::string &ytitle="") |
AIDA::IHistogram1D * | bookHistogram1D (size_t datasetId, size_t xAxisId, size_t yAxisId, const std::string &title="", const std::string &xtitle="", const std::string &ytitle="") |
Internal profile histogram booking (for use by Analysis sub-classes). | |
AIDA::IProfile1D * | bookProfile1D (const std::string &name, size_t nbins, double lower, double upper, const std::string &title="", const std::string &xtitle="", const std::string &ytitle="") |
AIDA::IProfile1D * | bookProfile1D (const std::string &name, const std::vector< double > &binedges, const std::string &title="", const std::string &xtitle="", const std::string &ytitle="") |
AIDA::IProfile1D * | bookProfile1D (const std::string &name, const std::string &title="", const std::string &xtitle="", const std::string &ytitle="") |
AIDA::IProfile1D * | bookProfile1D (size_t datasetId, size_t xAxisId, size_t yAxisId, const std::string &title="", const std::string &xtitle="", const std::string &ytitle="") |
Internal data point set booking (for use by Analysis sub-classes). | |
AIDA::IDataPointSet * | bookDataPointSet (const std::string &name, const std::string &title="", const std::string &xtitle="", const std::string &ytitle="") |
AIDA::IDataPointSet * | bookDataPointSet (const std::string &name, size_t npts, double lower, double upper, const std::string &title="", const std::string &xtitle="", const std::string &ytitle="") |
AIDA::IDataPointSet * | bookDataPointSet (size_t datasetId, size_t xAxisId, size_t yAxisId, const std::string &title="", const std::string &xtitle="", const std::string &ytitle="") |
Friends | |
class | AnalysisHandler |
The AnalysisHandler is a friend. |
This is the base class of all analysis classes in Rivet.
There are three virtual functions which should be implemented in base classes:
void init() is called by Rivet before a run is started. Here the analysis class should book necessary histograms. The needed projections should probably rather be constructed in the constructor.
void analyze(const Event&) is called once for each event. Here the analysis class should apply the necessary Projections and fill the histograms.
void finalize() is called after a run is finished. Here the analysis class should do whatever manipulations are necessary on the histograms. Writing the histograms to a file is, however, done by the Rivet class.
virtual void Rivet::Analysis::analyze | ( | const Event & | event | ) | [pure virtual] |
Analyze one event. A concrete class should here apply the necessary projections on the event and fill the relevant histograms. An overridden function must make sure it first calls the base class function.
Implemented in Rivet::MC_JetAnalysis.
virtual std::vector<std::string> Rivet::Analysis::authors | ( | ) | const [inline, virtual] |
Names & emails of paper/analysis authors.
Names and email of authors in 'NAME <EMAIL>' format. The first name in the list should be the primary contact person.
References Rivet::AnalysisInfo::authors(), and info().
IDataPointSet * Rivet::Analysis::bookDataPointSet | ( | const std::string & | name, |
const std::string & | title = "" , |
||
const std::string & | xtitle = "" , |
||
const std::string & | ytitle = "" |
||
) | [protected] |
Book a 2-dimensional data point set. (NB. this returns a pointer rather than a reference since it will have to be stored in the analysis class - there's no point in forcing users to explicitly get the pointer from a reference before they can use it!)
References datapointsetFactory(), histoPath(), and name().
Referenced by bookDataPointSet(), and Rivet::MC_JetAnalysis::init().
IDataPointSet * Rivet::Analysis::bookDataPointSet | ( | const std::string & | name, |
size_t | npts, | ||
double | lower, | ||
double | upper, | ||
const std::string & | title = "" , |
||
const std::string & | xtitle = "" , |
||
const std::string & | ytitle = "" |
||
) | [protected] |
Book a 2-dimensional data point set with equally spaced points in a range. (NB. this returns a pointer rather than a reference since it will have to be stored in the analysis class - there's no point in forcing users to explicitly get the pointer from a reference before they can use it!)
References bookDataPointSet().
IDataPointSet * Rivet::Analysis::bookDataPointSet | ( | size_t | datasetId, |
size_t | xAxisId, | ||
size_t | yAxisId, | ||
const std::string & | title = "" , |
||
const std::string & | xtitle = "" , |
||
const std::string & | ytitle = "" |
||
) | [protected] |
Book a 2-dimensional data point set based on the corresponding AIDA data file. The binnings (x-errors) will be obtained by reading the bundled AIDA data record file of the same filename as the analysis' name() property. Book a 2-dimensional data point set based on the paper, dataset and x/y-axis IDs in the corresponding HepData record. The binnings (x-errors) will be obtained by reading the bundled AIDA data record file of the same filename as the analysis' name() property.
References bookDataPointSet(), makeAxisCode(), and name().
IHistogram1D * Rivet::Analysis::bookHistogram1D | ( | const std::string & | name, |
size_t | nbins, | ||
double | lower, | ||
double | upper, | ||
const std::string & | title = "" , |
||
const std::string & | xtitle = "" , |
||
const std::string & | ytitle = "" |
||
) | [protected] |
Book a 1D histogram with nbins uniformly distributed across the range lower - upper . (NB. this returns a pointer rather than a reference since it will have to be stored in the analysis class - there's no point in forcing users to explicitly get the pointer from a reference before they can use it!)
References histogramFactory(), histoPath(), and name().
Referenced by bookHistogram1D(), and Rivet::MC_JetAnalysis::init().
IHistogram1D * Rivet::Analysis::bookHistogram1D | ( | const std::string & | name, |
const std::vector< double > & | binedges, | ||
const std::string & | title = "" , |
||
const std::string & | xtitle = "" , |
||
const std::string & | ytitle = "" |
||
) | [protected] |
Book a 1D histogram with non-uniform bins defined by the vector of bin edges binedges . (NB. this returns a pointer rather than a reference since it will have to be stored in the analysis class - there's no point in forcing users to explicitly get the pointer from a reference before they can use it!)
References histogramFactory(), histoPath(), and name().
IHistogram1D * Rivet::Analysis::bookHistogram1D | ( | const std::string & | name, |
const std::string & | title = "" , |
||
const std::string & | xtitle = "" , |
||
const std::string & | ytitle = "" |
||
) | [protected] |
Book a 1D histogram based on the name in the corresponding AIDA file. The binnings will be obtained by reading the bundled AIDA data record file with the same filename as the analysis' name() property.
References binEdges(), histogramFactory(), histoPath(), and name().
IHistogram1D * Rivet::Analysis::bookHistogram1D | ( | size_t | datasetId, |
size_t | xAxisId, | ||
size_t | yAxisId, | ||
const std::string & | title = "" , |
||
const std::string & | xtitle = "" , |
||
const std::string & | ytitle = "" |
||
) | [protected] |
Book a 1D histogram based on the paper, dataset and x/y-axis IDs in the corresponding HepData record. The binnings will be obtained by reading the bundled AIDA data record file of the same filename as the analysis' name() property.
References bookHistogram1D(), and makeAxisCode().
IHistogram2D * Rivet::Analysis::bookHistogram2D | ( | const std::string & | name, |
size_t | nxbins, | ||
double | xlower, | ||
double | xupper, | ||
size_t | nybins, | ||
double | ylower, | ||
double | yupper, | ||
const std::string & | title = "" , |
||
const std::string & | xtitle = "" , |
||
const std::string & | ytitle = "" , |
||
const std::string & | ztitle = "" |
||
) | [protected] |
Book a 2D histogram with nxbins and nybins uniformly distributed across the ranges xlower - xupper and ylower - yupper respectively along the x- and y-axis. (NB. this returns a pointer rather than a reference since it will have to be stored in the analysis class - there's no point in forcing users to explicitly get the pointer from a reference before they can use it!)
References histogramFactory(), histoPath(), and name().
IHistogram2D * Rivet::Analysis::bookHistogram2D | ( | const std::string & | name, |
const std::vector< double > & | xbinedges, | ||
const std::vector< double > & | ybinedges, | ||
const std::string & | title = "" , |
||
const std::string & | xtitle = "" , |
||
const std::string & | ytitle = "" , |
||
const std::string & | ztitle = "" |
||
) | [protected] |
Book a 2D histogram with non-uniform bins defined by the vectorx of bin edges xbinedges and ybinedges. (NB. this returns a pointer rather than a reference since it will have to be stored in the analysis class - there's no point in forcing users to explicitly get the pointer from a reference before they can use it!)
References histogramFactory(), histoPath(), and name().
IProfile1D * Rivet::Analysis::bookProfile1D | ( | const std::string & | name, |
size_t | nbins, | ||
double | lower, | ||
double | upper, | ||
const std::string & | title = "" , |
||
const std::string & | xtitle = "" , |
||
const std::string & | ytitle = "" |
||
) | [protected] |
Book a 1D profile histogram with nbins uniformly distributed across the range lower - upper . (NB. this returns a pointer rather than a reference since it will have to be stored in the analysis class - there's no point in forcing users to explicitly get the pointer from a reference before they can use it!)
References histogramFactory(), histoPath(), and name().
Referenced by bookProfile1D().
IProfile1D * Rivet::Analysis::bookProfile1D | ( | const std::string & | name, |
const std::vector< double > & | binedges, | ||
const std::string & | title = "" , |
||
const std::string & | xtitle = "" , |
||
const std::string & | ytitle = "" |
||
) | [protected] |
Book a 1D profile histogram with non-uniform bins defined by the vector of bin edges binedges . (NB. this returns a pointer rather than a reference since it will have to be stored in the analysis class - there's no point in forcing users to explicitly get the pointer from a reference before they can use it!)
References histogramFactory(), histoPath(), and name().
IProfile1D * Rivet::Analysis::bookProfile1D | ( | const std::string & | name, |
const std::string & | title = "" , |
||
const std::string & | xtitle = "" , |
||
const std::string & | ytitle = "" |
||
) | [protected] |
Book a 1D profile histogram based on the name in the corresponding AIDA file. The binnings will be obtained by reading the bundled AIDA data record file with the same filename as the analysis' name() property.
References binEdges(), histogramFactory(), histoPath(), and name().
IProfile1D * Rivet::Analysis::bookProfile1D | ( | size_t | datasetId, |
size_t | xAxisId, | ||
size_t | yAxisId, | ||
const std::string & | title = "" , |
||
const std::string & | xtitle = "" , |
||
const std::string & | ytitle = "" |
||
) | [protected] |
Book a 1D profile histogram based on the paper, dataset and x/y-axis IDs in the corresponding HepData record. The binnings will be obtained by reading the bundled AIDA data record file of the same filename as the analysis' name() property.
References bookProfile1D(), and makeAxisCode().
double Rivet::Analysis::crossSectionPerEvent | ( | ) | const [protected] |
Get the process cross-section per generated event in pb. Throws if this hasn't been set.
References sumOfWeights().
virtual std::string Rivet::Analysis::description | ( | ) | const [inline, virtual] |
Get a full description of the analysis.
Full textual description of this analysis, what it is useful for, what experimental techniques are applied, etc. Should be treated as a chunk of restructuredText (http://docutils.sourceforge.net/rst.html), with equations to be rendered as LaTeX with amsmath operators.
References Rivet::AnalysisInfo::description(), and info().
virtual void Rivet::Analysis::finalize | ( | ) | [inline, virtual] |
Finalize this analysis object. A concrete class should here make all necessary operations on the histograms. Writing the histograms to a file is, however, done by the Rivet class. An overridden function must make sure it first calls the base class function.
Reimplemented in Rivet::MC_JetAnalysis.
const string Rivet::Analysis::histoDir | ( | ) | const [protected] |
Get the canonical histogram "directory" path for this analysis.
References handler(), name(), and Rivet::AnalysisHandler::runName().
Referenced by histoPath().
virtual void Rivet::Analysis::init | ( | ) | [inline, virtual] |
Initialize this analysis object. A concrete class should here book all necessary histograms. An overridden function must make sure it first calls the base class function.
Reimplemented in Rivet::MC_JetAnalysis.
virtual std::string Rivet::Analysis::name | ( | ) | const [inline, virtual] |
Get the name of the analysis.
By default this is computed by combining the results of the experiment, year and Spires ID metadata methods and you should only override it if there's a good reason why those won't work.
Implements Rivet::ProjectionApplier.
References info(), and Rivet::AnalysisInfo::name().
Referenced by Analysis(), binEdges(), bookDataPointSet(), bookHistogram1D(), bookHistogram2D(), bookProfile1D(), crossSection(), getLog(), histoDir(), normalize(), Rivet::HistoHandler::registerAnalysisObject(), and scale().
void Rivet::Analysis::normalize | ( | AIDA::IHistogram1D *& | histo, |
double | norm = 1.0 |
||
) |
Normalize the given histogram, histo. After this call the histogram will have been transformed to a DataPointSet with the same name and path. It has the same effect as scale
(histo, norm/sumOfWeights).
histo | The histogram to be normalised. |
norm | The new area of the histogram. |
void Rivet::Analysis::normalize | ( | AIDA::IHistogram2D *& | histo, |
double | norm = 1.0 |
||
) |
Normalize the given histogram, histo. After this call the histogram will have been transformed to a DataPointSet with the same name and path. It has the same effect as scale
(histo, norm/sumOfWeights).
histo | The histogram to be normalised. |
norm | The new area of the histogram. |
size_t Rivet::Analysis::numEvents | ( | ) | const [protected] |
Get the number of events seen (via the analysis handler). Use in the finalize phase only.
References handler(), and Rivet::AnalysisHandler::numEvents().
virtual std::string Rivet::Analysis::runInfo | ( | ) | const [inline, virtual] |
Information about the events needed as input for this analysis.
Event types, energies, kinematic cuts, particles to be considered stable, etc. etc. Should be treated as a restructuredText bullet list (http://docutils.sourceforge.net/rst.html)
References info(), and Rivet::AnalysisInfo::runInfo().
void Rivet::Analysis::scale | ( | AIDA::IHistogram1D *& | histo, |
double | scale | ||
) |
Multiplicatively scale the given histogram, histo. After this call the histogram will have been transformed to a DataPointSet with the same name and path.
histo | The histogram to be scaled. |
scale | The factor used to multiply the histogram bin heights. |
References datapointsetFactory(), name(), and tree().
Referenced by Rivet::MC_JetAnalysis::finalize(), normalize(), and Rivet::BinnedHistogram< T >::scale().
void Rivet::Analysis::scale | ( | AIDA::IHistogram2D *& | histo, |
double | scale | ||
) |
Multiplicatively scale the given histogram, histo. After this call the histogram will have been transformed to a DataPointSet with the same name and path.
histo | The histogram to be scaled. |
scale | The factor used to multiply the histogram bin heights. |
References datapointsetFactory(), name(), and tree().
virtual Analysis& Rivet::Analysis::setBeams | ( | PdgId | beam1, |
PdgId | beam2 | ||
) | [inline, virtual] |
Set the required beams
References setRequiredBeams().
virtual std::string Rivet::Analysis::summary | ( | ) | const [inline, virtual] |
Get a short description of the analysis.
Short (one sentence) description used as an index entry. Use description() to provide full descriptive paragraphs of analysis details.
References info(), and Rivet::AnalysisInfo::summary().
double Rivet::Analysis::sumOfWeights | ( | ) | const [protected] |
Get the sum of event weights seen (via the analysis handler). Use in the finalize phase only.
References handler(), and Rivet::AnalysisHandler::sumOfWeights().
Referenced by crossSectionPerEvent(), and Rivet::MC_JetAnalysis::finalize().