Rivet  1.8.0
Public Member Functions | Protected Member Functions | Friends
Rivet::Analysis Class Reference

This is the base class of all analysis classes in Rivet. More...

#include <Analysis.hh>

Inheritance diagram for Rivet::Analysis:
Rivet::ProjectionApplier Rivet::MC_JetAnalysis

List of all members.

Public Member Functions

AnalysisHandlerhandler () 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)
AnalysissetCrossSection (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 AnalysisInfoinfo () 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 AnalysissetRequiredBeams (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 AnalysissetRequiredEnergies (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.
AnalysissetNeedsCrossSection (bool needed=true)
 Declare whether this analysis needs to know the process cross-section from the generator.
Internal metadata modifiying methods
AnalysisInfoinfo ()
 Get the actual AnalysisInfo object in which all this metadata is stored (non-const).
virtual AnalysissetBeams (PdgId beam1, PdgId beam2)
Run conditions
const ParticlePairbeams () 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.
- Public Member Functions inherited from Rivet::ProjectionApplier
 ProjectionApplier ()
 Constructor.
std::set< ConstProjectionPtrgetProjections () const
 Get the contained projections, including recursion.
template<typename PROJ >
const PROJ & getProjection (const std::string &name) const
 Get the named projection, specifying return type via a template argument.
const ProjectiongetProjection (const std::string &name) const
template<typename PROJ >
const PROJ & applyProjection (const Event &evt, const PROJ &proj) const
 Apply the supplied projection on event.
template<typename PROJ >
const PROJ & applyProjection (const Event &evt, const Projection &proj) const
 Apply the supplied projection on event.
template<typename PROJ >
const PROJ & applyProjection (const Event &evt, const std::string &name) const
 Apply the named projection on event.

Protected Member Functions

LoggetLog () 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 BinEdgesbinEdges (const std::string &hname) const
 Get bin edges for a named histo (using ref AIDA caching)
const BinEdgesbinEdges (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="")
- Protected Member Functions inherited from Rivet::ProjectionApplier
ProjectionHandlergetProjHandler () const
 Get a reference to the ProjectionHandler for this thread.
template<typename PROJ >
const PROJ & addProjection (const PROJ &proj, const std::string &name)

Friends

class AnalysisHandler
 The AnalysisHandler is a friend.

Detailed Description

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.


Member Function Documentation

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
inlinevirtual

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
inlinevirtual

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

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.

Todo:
This doesn't change: calc and cache at first use!

References handler(), name(), and Rivet::AnalysisHandler::runName().

Referenced by histoPath().

virtual void Rivet::Analysis::init ( )
inlinevirtual

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
inlinevirtual

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

Parameters:
histoThe histogram to be normalised.
normThe new area of the histogram.
Warning:
The old histogram will be deleted, and its pointer set to zero.

References name(), scale(), and tree().

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

Parameters:
histoThe histogram to be normalised.
normThe new area of the histogram.
Warning:
The old histogram will be deleted, and its pointer set to zero.

References name(), scale(), and tree().

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
inlinevirtual

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.

Parameters:
histoThe histogram to be scaled.
scaleThe factor used to multiply the histogram bin heights.
Warning:
The old histogram will be deleted, and its pointer set to zero.

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.

Parameters:
histoThe histogram to be scaled.
scaleThe factor used to multiply the histogram bin heights.
Warning:
The old histogram will be deleted, and its pointer set to zero.

References datapointsetFactory(), name(), and tree().

virtual Analysis& Rivet::Analysis::setBeams ( PdgId  beam1,
PdgId  beam2 
)
inlinevirtual

Set the required beams

Deprecated:
To be removed in 2.0.0. Use .info file and AnalysisInfo class instead
Todo:
Print out a warning to use setRequiredBeams() instead (and really to use .info files)

References setRequiredBeams().

virtual std::string Rivet::Analysis::summary ( ) const
inlinevirtual

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


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