AnalysisHandler Class Reference

#include <AnalysisHandler.hh>

Collaboration diagram for AnalysisHandler:
Collaboration graph
[legend]

List of all members.

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.
 ~AnalysisHandler ()
 Destructor The destructor is not virtual, as this class should not be inherited from.
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.
AnalysisHandleraddAnalysis (const std::string &analysisname)
AnalysisHandlerremoveAnalysis (const std::string &analysisname)
 Remove an analysis from the run list using its name.
AnalysisHandleraddAnalyses (const std::vector< std::string > &analysisnames)
AnalysisHandlerremoveAnalyses (const std::vector< std::string > &analysisnames)
 Remove analyses from the run list using their names.
AnalysisHandleraddAnalysis (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 ()

Private Member Functions

void _setupFactories (const string &basefilename, HistoFormat storetype)
void _setupFactories ()
void _normalizeTree (AIDA::ITree &tree)
LoggetLog () const
 Get a logger object.
AnalysisHandleroperator= (const AnalysisHandler &)
 AnalysisHandler (const AnalysisHandler &)

Private Attributes

set< AnaHandle, AnaHandleLess_analyses
 The collection of Analysis objects to be used.
AIDA factory handles

Note that only the analysis factory can be a shared_ptr, since it deletes all the others.

shared_ptr
< AIDA::IAnalysisFactory > 
_theAnalysisFactory
 The AIDA analysis factory.
AIDA::ITreeFactory * _theTreeFactory
 The AIDA tree factory.
AIDA::ITree * _theTree
 The AIDA tree object.
AIDA::IHistogramFactory * _theHistogramFactory
 The AIDA histogram factory.
AIDA::IDataPointSetFactory * _theDataPointSetFactory
 The AIDA data point set factory.

Run properties



std::string _runname
 Run name.
size_t _numEvents
 Number of events seen.
double _sumOfWeights
 Sum of event weights seen.
double _xs
 Cross-section known to AH.
ParticlePair _beams
 Beams used by this run.
bool _initialised
 Flag to check if init has been called.
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?
AnalysisHandlersetCrossSection (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.
AnalysisHandlersetRunBeams (const ParticlePair &beams)
 Set beams for this run.
const ParticlePairbeams () 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.

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.

Definition at line 29 of file AnalysisHandler.hh.


Constructor & Destructor Documentation

AnalysisHandler ( const string &  runname = ""  ) 

Preferred constructor, with optional run name.

Definition at line 17 of file AnalysisHandler.cc.

References AnalysisHandler::_setupFactories(), AnalysisHandler::_theAnalysisFactory, and Rivet::createAnalysisFactory().

00018     : _runname(runname), _numEvents(0),
00019       _sumOfWeights(0.0), _xs(-1.0),
00020       _initialised(false)
00021   {
00022     _theAnalysisFactory.reset( createAnalysisFactory() );
00023     _setupFactories();
00024   }

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.

Definition at line 27 of file AnalysisHandler.cc.

References AnalysisHandler::_setupFactories(), AnalysisHandler::_theAnalysisFactory, and Rivet::createAnalysisFactory().

00029     : _runname(runname), _numEvents(0),
00030       _sumOfWeights(0.0), _xs(-1.0),
00031       _initialised(false)
00032   {
00033     cerr << "AnalysisHandler(basefilename, runname, format) constructor is deprecated: "
00034          << "please migrate your code to use the one-arg constructor" << endl;
00035     _theAnalysisFactory.reset( createAnalysisFactory() );
00036     _setupFactories(basefilename, storetype);
00037   }

~AnalysisHandler (  ) 

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

Definition at line 40 of file AnalysisHandler.cc.

00041   {  }

AnalysisHandler ( const AnalysisHandler  )  [private]

The copy constructor is private and must never be called. In fact, it should not even be implemented.


Member Function Documentation

void _normalizeTree ( AIDA::ITree &  tree  )  [private]

Convert any IHistogram1D objects in the AIDA tree to IDataPointSet objects.

Deprecated:
When AIDA goes, this goes...

Referenced by AnalysisHandler::finalize().

void _setupFactories (  )  [private]

Do the initialisation of the AIDA analysis factories with no store.

Deprecated:
When AIDA goes, this goes...

Definition at line 239 of file AnalysisHandler.cc.

References AnalysisHandler::_theAnalysisFactory, AnalysisHandler::_theDataPointSetFactory, AnalysisHandler::_theHistogramFactory, AnalysisHandler::_theTree, AnalysisHandler::_theTreeFactory, and AnalysisHandler::tree().

Referenced by AnalysisHandler::AnalysisHandler().

00239                                         {
00240     _theTreeFactory = _theAnalysisFactory->createTreeFactory();
00241     _theTree = _theTreeFactory->create();
00242     _theHistogramFactory = _theAnalysisFactory->createHistogramFactory(tree());
00243     _theDataPointSetFactory = _theAnalysisFactory->createDataPointSetFactory(tree());
00244   }

void _setupFactories ( const string &  basefilename,
HistoFormat  storetype 
) [private]

Do the initialisation of the AIDA analysis factories.

Deprecated:
When AIDA goes, this goes...

Definition at line 220 of file AnalysisHandler.cc.

References AnalysisHandler::_theAnalysisFactory, AnalysisHandler::_theDataPointSetFactory, AnalysisHandler::_theHistogramFactory, AnalysisHandler::_theTree, AnalysisHandler::_theTreeFactory, Rivet::AIDAML, Rivet::endsWith(), Rivet::FLAT, Rivet::ROOT, and AnalysisHandler::tree().

00220                                                                                          {
00221     string filename(basefilename), storetypestr("");
00222     if (storetype == AIDAML) {
00223       if (!endsWith(filename, ".aida")) filename += ".aida";
00224       storetypestr = "xml";
00225     } else if (storetype == FLAT) {
00226       if (!endsWith(filename, ".data")) filename += ".data";
00227       storetypestr = "flat";
00228     } else if (storetype == ROOT) {
00229       if (!endsWith(filename, ".root")) filename += ".root";
00230       storetypestr = "root";
00231     }
00232     _theTreeFactory = _theAnalysisFactory->createTreeFactory();
00233     _theTree = _theTreeFactory->create(filename, storetypestr, false, true);
00234     _theHistogramFactory = _theAnalysisFactory->createHistogramFactory(tree());
00235     _theDataPointSetFactory = _theAnalysisFactory->createDataPointSetFactory(tree());
00236   }

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.

Definition at line 328 of file AnalysisHandler.cc.

References AnalysisHandler::addAnalysis().

00328                                                                                          {
00329     foreach (const string& aname, analysisnames) {
00330       //MSG_DEBUG("Adding analysis '" << aname << "'");
00331       addAnalysis(aname);
00332     }
00333     return *this;
00334   }

AnalysisHandler & addAnalysis ( Analysis analysis  ) 

Add an analysis to the run list by object.

Definition at line 390 of file AnalysisHandler.cc.

References AnalysisHandler::_analyses, and Analysis::_analysishandler.

00390                                                                   {
00391     analysis->_analysishandler = this;
00392     _analyses.insert(AnaHandle(analysis));
00393     return *this;
00394   }

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.

Definition at line 182 of file AnalysisHandler.cc.

References AnalysisHandler::_analyses, AnalysisLoader::getAnalysis(), MSG_DEBUG, and MSG_WARNING.

Referenced by AnalysisHandler::addAnalyses().

00182                                                                           {
00183     // Check for a duplicate analysis
00184     /// @todo Might we want to be able to run an analysis twice, with different params?
00185     ///       Requires avoiding histo tree clashes, i.e. storing the histos on the analysis objects.
00186     foreach (const AnaHandle& a, _analyses) {
00187       if (a->name() == analysisname) {
00188         MSG_WARNING("Analysis '" << analysisname << "' already registered: skipping duplicate");
00189         return *this;
00190       }
00191     }
00192     AnaHandle analysis( AnalysisLoader::getAnalysis(analysisname) );
00193     if (analysis.get() != 0) { // < Check for null analysis.
00194       MSG_DEBUG("Adding analysis '" << analysisname << "'");
00195       analysis->_analysishandler = this;
00196       _analyses.insert(analysis);
00197     } else {
00198       MSG_WARNING("Analysis '" << analysisname << "' not found.");
00199     }
00200     return *this;
00201   }

const std::set<AnaHandle, AnaHandleLess>& analyses (  )  const [inline]

Get the collection of currently registered analyses.

Definition at line 146 of file AnalysisHandler.hh.

References AnalysisHandler::_analyses.

Referenced by AnalysisHandler::init().

00146                                                              {
00147       return _analyses;
00148     }

AIDA::IAnalysisFactory & analysisFactory (  ) 

The AIDA analysis factory.

Deprecated:
When AIDA goes, this goes...

Definition at line 346 of file AnalysisHandler.cc.

References AnalysisHandler::_theAnalysisFactory.

Referenced by Analysis::analysisFactory().

00346                                                          {
00347     return *_theAnalysisFactory;
00348   }

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

Get a list of the currently registered analyses' names.

Definition at line 319 of file AnalysisHandler.cc.

References AnalysisHandler::_analyses.

Referenced by Run::init(), and AnalysisHandler::init().

00319                                                             {
00320     std::vector<std::string> rtn;
00321     foreach (AnaHandle a, _analyses) {
00322       rtn.push_back(a->name());
00323     }
00324     return rtn;
00325   }

void analyze ( const GenEvent &  event  ) 

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

Definition at line 106 of file AnalysisHandler.cc.

References AnalysisHandler::_analyses, AnalysisHandler::_beams, AnalysisHandler::_initialised, AnalysisHandler::_numEvents, AnalysisHandler::_sumOfWeights, AnalysisHandler::beamIds(), AnalysisHandler::beams(), Rivet::compatible(), Rivet::fuzzyEquals(), Rivet::GeV, AnalysisHandler::init(), MSG_DEBUG, AnalysisHandler::setCrossSection(), AnalysisHandler::sqrtS(), and Rivet::toBeamsString().

Referenced by Run::processEvent().

00106                                                   {
00107     // Call init with event as template if not already initialised
00108     if (!_initialised) {
00109       init(ge);
00110     }
00111     // Proceed with event analysis
00112     assert(_initialised);
00113     // Ensure that beam details match those from first event
00114     const PdgIdPair beams = Rivet::beamIds(ge);
00115     const double sqrts = Rivet::sqrtS(ge);
00116     if (!compatible(beams, _beams) || !fuzzyEquals(sqrts, sqrtS())) {
00117       cerr     << "Event beams mismatch: "
00118                << toBeamsString(beams) << " @ " << sqrts/GeV << " GeV" << " vs. first beams "
00119                << this->beams() << " @ " << this->sqrtS()/GeV << " GeV" << endl;
00120       exit(1);
00121     }
00122 
00123 
00124     Event event(ge);
00125     _numEvents++;
00126     // Weights
00127     const double weight = event.weight();
00128     _sumOfWeights += weight;
00129     MSG_DEBUG("Event #" << _numEvents << " weight = " << weight);
00130     #ifdef HEPMC_HAS_CROSS_SECTION
00131     if (ge.cross_section()) {
00132       const double xs = ge.cross_section()->cross_section();
00133       setCrossSection(xs);
00134     }
00135     #endif
00136     foreach (AnaHandle a, _analyses) {
00137       //MSG_DEBUG("About to run analysis " << a->name());
00138       try {
00139         a->analyze(event);
00140       } catch (const Error& err) {
00141         cerr     << "Error in " << a->name() << "::analyze method: "
00142                  << err.what() << endl;
00143         exit(1);
00144       }
00145       //MSG_DEBUG("Finished running analysis " << a->name());
00146     }
00147   }

PdgIdPair beamIds (  )  const

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

Definition at line 397 of file AnalysisHandler.cc.

References AnalysisHandler::beams().

Referenced by AnalysisHandler::analyze(), and Analysis::beamIds().

00397                                            {
00398     return Rivet::beamIds(beams());
00399   }

const ParticlePair& beams (  )  const [inline]

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

Definition at line 126 of file AnalysisHandler.hh.

References AnalysisHandler::_beams.

Referenced by AnalysisHandler::analyze(), AnalysisHandler::beamIds(), Analysis::beams(), AnalysisHandler::init(), and AnalysisHandler::sqrtS().

00126                                       {
00127       return _beams;
00128     }

void commitData (  ) 

Commit the AIDA tree to file.

Deprecated:
When AIDA goes, this goes...

Definition at line 247 of file AnalysisHandler.cc.

References AnalysisHandler::tree().

00247                                    {
00248     tree().commit();
00249   }

double crossSection (  )  const [inline]

Get the cross-section known to the handler.

Definition at line 110 of file AnalysisHandler.hh.

References AnalysisHandler::_xs.

Referenced by Run::crossSection(), and AnalysisHandler::hasCrossSection().

00110                                 {
00111       return _xs;
00112     }

AIDA::IDataPointSetFactory & datapointsetFactory (  ) 

The AIDA histogram factory.

Deprecated:
When AIDA goes, this goes...

Definition at line 361 of file AnalysisHandler.cc.

References AnalysisHandler::_theDataPointSetFactory.

Referenced by Analysis::datapointsetFactory().

00361                                                                  {
00362     return *_theDataPointSetFactory;
00363   }

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

Definition at line 150 of file AnalysisHandler.cc.

References AnalysisHandler::_analyses, AnalysisHandler::_initialised, AnalysisHandler::_normalizeTree(), AnalysisHandler::_numEvents, AnalysisHandler::_theTree, MSG_DEBUG, MSG_INFO, and AnalysisHandler::tree().

00150                                  {
00151     assert(_initialised);
00152     MSG_INFO("Finalising analyses");
00153     foreach (AnaHandle a, _analyses) {
00154       try {
00155         a->finalize();
00156       } catch (const Error& err) {
00157         cerr     << "Error in " << a->name() << "::finalize method: "
00158                  << err.what() << endl;
00159         exit(1);
00160       }
00161     }
00162 
00163     // Print out number of events processed
00164     MSG_INFO("Processed " << _numEvents << " event" << (_numEvents == 1 ? "" : "s"));
00165 
00166     // Change AIDA histos into data point sets
00167     MSG_DEBUG("Converting histograms to scatter plots");
00168     assert(_theTree != 0);
00169     _normalizeTree(tree());
00170 
00171     // Delete analyses
00172     MSG_DEBUG("Deleting analyses");
00173     _analyses.clear();
00174 
00175     // Print out MCnet boilerplate
00176     cout << endl;
00177     cout << "The MCnet usage guidelines apply to Rivet: see http://www.montecarlonet.org/GUIDELINES" << endl;
00178     cout << "Please acknowledge plots made with Rivet analyses, and cite arXiv:1003.0694 (http://arxiv.org/abs/1003.0694)" << endl;
00179   }

Log & getLog (  )  const [private]

Get a logger object.

Definition at line 44 of file AnalysisHandler.cc.

00044                                      {
00045     return Log::getLog("Rivet.Analysis.Handler");
00046   }

bool hasCrossSection (  )  const

Whether the handler knows about a cross-section.

Definition at line 385 of file AnalysisHandler.cc.

References AnalysisHandler::crossSection().

Referenced by Run::processEvent().

00385                                               {
00386     return (!std::isnan(crossSection()));
00387   }

AIDA::IHistogramFactory & histogramFactory (  ) 

The AIDA histogram factory.

Deprecated:
When AIDA goes, this goes...

Definition at line 356 of file AnalysisHandler.cc.

References AnalysisHandler::_theHistogramFactory.

Referenced by Analysis::histogramFactory().

00356                                                            {
00357     return *_theHistogramFactory;
00358   }

void init ( const GenEvent &  event  ) 

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

Definition at line 49 of file AnalysisHandler.cc.

References AnalysisHandler::_analyses, AnalysisHandler::_initialised, AnalysisHandler::_numEvents, AnalysisHandler::_sumOfWeights, AnalysisHandler::analyses(), AnalysisHandler::analysisNames(), AnalysisHandler::beams(), Rivet::beams(), MSG_DEBUG, MSG_WARNING, AnalysisHandler::removeAnalysis(), AnalysisHandler::setRunBeams(), and Rivet::toUpper().

00049                                                {
00050     assert(!_initialised);
00051     setRunBeams(Rivet::beams(ge));
00052     MSG_DEBUG("Initialising the analysis handler");
00053     _numEvents = 0;
00054     _sumOfWeights = 0.0;
00055 
00056     // Check that analyses are beam-compatible, and remove those that aren't
00057     const size_t num_anas_requested = analysisNames().size();
00058     vector<string> anamestodelete;
00059     foreach (const AnaHandle a, _analyses) {
00060       if (!a->isCompatible(beams())) {
00061         //MSG_DEBUG(a->name() << " requires beams " << a->requiredBeams() << " @ " << a->requiredEnergies() << " GeV");
00062         anamestodelete.push_back(a->name());
00063       }
00064     }
00065     foreach (const string& aname, anamestodelete) {
00066       MSG_WARNING("Analysis '" << aname << "' is incompatible with the provided beams: removing");
00067       removeAnalysis(aname);
00068     }
00069     if (num_anas_requested > 0 && analysisNames().size() == 0) {
00070       cerr << "All analyses were incompatible with the first event's beams\n"
00071            << "Exiting, since this probably wasn't intentional!" << endl;
00072       exit(1);
00073     }
00074 
00075     // Warn if any analysis' status is not unblemished
00076     foreach (const AnaHandle a, analyses()) {
00077       if (toUpper(a->status()) == "PRELIMINARY") {
00078         MSG_WARNING("Analysis '" << a->name() << "' is preliminary: be careful, it may change and/or be renamed!");
00079       } else if (toUpper(a->status()) == "OBSOLETE") {
00080         MSG_WARNING("Analysis '" << a->name() << "' is obsolete: please update!");
00081       } else if (toUpper(a->status()).find("UNVALIDATED") != string::npos) {
00082         MSG_WARNING("Analysis '" << a->name() << "' is unvalidated: be careful, it may be broken!");
00083       }
00084     }
00085 
00086     // Initialize the remaining analyses
00087     foreach (AnaHandle a, _analyses) {
00088       MSG_DEBUG("Initialising analysis: " << a->name());
00089       try {
00090         // Allow projection registration in the init phase onwards
00091         a->_allowProjReg = true;
00092         a->init();
00093         //MSG_DEBUG("Checking consistency of analysis: " << a->name());
00094         //a->checkConsistency();
00095       } catch (const Error& err) {
00096         cerr << "Error in " << a->name() << "::init method: " << err.what() << endl;
00097         exit(1);
00098       }
00099       MSG_DEBUG("Done initialising analysis: " << a->name());
00100     }
00101     _initialised = true;
00102     MSG_DEBUG("Analysis handler initialised");
00103   }

void init (  )  [inline]
Deprecated:
Obsolete method, kept only for backwards compatibility

Definition at line 181 of file AnalysisHandler.hh.

Referenced by AnalysisHandler::analyze(), and Run::init().

00181 {}

bool needCrossSection (  )  const

Is cross-section information required by at least one child analysis?

Definition at line 366 of file AnalysisHandler.cc.

References AnalysisHandler::_analyses.

Referenced by Run::processEvent().

00366                                                {
00367     bool rtn = false;
00368     foreach (const AnaHandle a, _analyses) {
00369       if (!rtn) rtn = a->needsCrossSection();
00370       if (rtn) break;
00371     }
00372     return rtn;
00373   }

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.

Definition at line 310 of file AnalysisHandler.cc.

References AnalysisHandler::_numEvents.

Referenced by Analysis::numEvents().

00310 { return _numEvents; }

AnalysisHandler& operator= ( const AnalysisHandler  )  [private]

The assignment operator is private and must never be called. In fact, it should not even be implemented.

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

Remove analyses from the run list using their names.

Definition at line 337 of file AnalysisHandler.cc.

References AnalysisHandler::removeAnalysis().

00337                                                                                             {
00338     foreach (const string& aname, analysisnames) {
00339       removeAnalysis(aname);
00340     }
00341     return *this;
00342   }

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

Remove an analysis from the run list using its name.

Definition at line 204 of file AnalysisHandler.cc.

References AnalysisHandler::_analyses, and MSG_DEBUG.

Referenced by AnalysisHandler::init(), and AnalysisHandler::removeAnalyses().

00204                                                                              {
00205     shared_ptr<Analysis> toremove;
00206     foreach (const AnaHandle a, _analyses) {
00207       if (a->name() == analysisname) {
00208         toremove = a;
00209         break;
00210       }
00211     }
00212     if (toremove.get() != 0) {
00213       MSG_DEBUG("Removing analysis '" << analysisname << "'");
00214       _analyses.erase(toremove);
00215     }
00216     return *this;
00217   }

string runName (  )  const

Get the name of this run.

Definition at line 309 of file AnalysisHandler.cc.

References AnalysisHandler::_runname.

Referenced by Analysis::histoDir().

00309 { return _runname; }

AnalysisHandler & setCrossSection ( double  xs  ) 

Set the cross-section for the process being generated.

Definition at line 376 of file AnalysisHandler.cc.

References AnalysisHandler::_analyses, and AnalysisHandler::_xs.

Referenced by AnalysisHandler::analyze(), Run::init(), and Run::processEvent().

00376                                                              {
00377     _xs = xs;
00378     foreach (AnaHandle a, _analyses) {
00379       a->setCrossSection(xs);
00380     }
00381     return *this;
00382   }

AnalysisHandler& setRunBeams ( const ParticlePair beams  )  [inline]

Set beams for this run.

Definition at line 119 of file AnalysisHandler.hh.

References AnalysisHandler::_beams, Rivet::GeV, MSG_DEBUG, and AnalysisHandler::sqrtS().

Referenced by AnalysisHandler::init().

00119                                                             {
00120       _beams = beams;
00121       MSG_DEBUG("Setting run beams = " << beams << " @ " << sqrtS()/GeV << " GeV");
00122       return *this;
00123     }

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

Definition at line 314 of file AnalysisHandler.cc.

References AnalysisHandler::_sumOfWeights.

00314                                                          {
00315     _sumOfWeights=sum;
00316   }

double sqrtS (  )  const

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

Definition at line 402 of file AnalysisHandler.cc.

References AnalysisHandler::beams().

Referenced by AnalysisHandler::analyze(), AnalysisHandler::setRunBeams(), and Analysis::sqrtS().

00402                                       {
00403     return Rivet::sqrtS(beams());
00404   }

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

Definition at line 311 of file AnalysisHandler.cc.

References AnalysisHandler::_sumOfWeights.

Referenced by Analysis::sumOfWeights().

00311 { return _sumOfWeights; }

AIDA::ITree & tree (  ) 

The AIDA tree object.

Deprecated:
When AIDA goes, this goes...

Definition at line 351 of file AnalysisHandler.cc.

References AnalysisHandler::_theTree.

Referenced by AnalysisHandler::_setupFactories(), AnalysisHandler::commitData(), AnalysisHandler::finalize(), Analysis::tree(), and AnalysisHandler::writeData().

00351                                    {
00352     return *_theTree;
00353   }

void writeData ( const std::string &  filename  ) 

Write the AIDA tree to the named file.

Deprecated:
When AIDA goes, this goes...

Definition at line 252 of file AnalysisHandler.cc.

References AnalysisHandler::tree().

00252                                                         {
00253     tree().commit(filename);
00254   }


Member Data Documentation

ParticlePair _beams [private]

Beams used by this run.

Definition at line 260 of file AnalysisHandler.hh.

Referenced by AnalysisHandler::analyze(), AnalysisHandler::beams(), and AnalysisHandler::setRunBeams().

bool _initialised [private]

Flag to check if init has been called.

Definition at line 263 of file AnalysisHandler.hh.

Referenced by AnalysisHandler::analyze(), AnalysisHandler::finalize(), and AnalysisHandler::init().

size_t _numEvents [private]
std::string _runname [private]

Run name.

Definition at line 248 of file AnalysisHandler.hh.

Referenced by AnalysisHandler::runName().

double _sumOfWeights [private]
shared_ptr<AIDA::IAnalysisFactory> _theAnalysisFactory [private]
AIDA::IDataPointSetFactory* _theDataPointSetFactory [private]

The AIDA data point set factory.

Definition at line 285 of file AnalysisHandler.hh.

Referenced by AnalysisHandler::_setupFactories(), and AnalysisHandler::datapointsetFactory().

AIDA::IHistogramFactory* _theHistogramFactory [private]

The AIDA histogram factory.

Definition at line 282 of file AnalysisHandler.hh.

Referenced by AnalysisHandler::_setupFactories(), and AnalysisHandler::histogramFactory().

AIDA::ITree* _theTree [private]

The AIDA tree object.

Definition at line 279 of file AnalysisHandler.hh.

Referenced by AnalysisHandler::_setupFactories(), AnalysisHandler::finalize(), and AnalysisHandler::tree().

AIDA::ITreeFactory* _theTreeFactory [private]

The AIDA tree factory.

Definition at line 276 of file AnalysisHandler.hh.

Referenced by AnalysisHandler::_setupFactories().

double _xs [private]

Cross-section known to AH.

Definition at line 257 of file AnalysisHandler.hh.

Referenced by AnalysisHandler::crossSection(), and AnalysisHandler::setCrossSection().


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