#include <AnalysisHandler.hh>
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. | |
AnalysisHandler & | addAnalysis (const std::string &analysisname) |
AnalysisHandler & | removeAnalysis (const std::string &analysisname) |
Remove an analysis from the run list using its name. | |
AnalysisHandler & | addAnalyses (const std::vector< std::string > &analysisnames) |
AnalysisHandler & | removeAnalyses (const std::vector< std::string > &analysisnames) |
Remove analyses from the run list using their names. | |
AnalysisHandler & | addAnalysis (Analysis *analysis) |
Add an analysis to the run list by object. | |
AnalysisHandler & | removeIncompatibleAnalyses (const PdgIdPair &beams) |
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. | |
| |
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) |
Log & | getLog () |
Get a logger object. | |
AnalysisHandler & | operator= (const AnalysisHandler &) |
AnalysisHandler (const AnalysisHandler &) | |
Private Attributes | |
set< AnaHandle, AnaHandleLess > | _analyses |
The collection of Analysis objects to be used. | |
AIDA factory handles | |
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? | |
AnalysisHandler & | setCrossSection (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. | |
AnalysisHandler & | setRunBeams (const ParticlePair &beams) |
Set beams for this run. | |
const ParticlePair & | beams () const |
Get beam IDs for this run, determined from first event. | |
PdgIdPair | beamIds () const |
Get beam IDs for this run, determined from first event. | |
double | sqrtS () const |
Get energy for this run, determined from first event. |
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.
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.
basefilename | the name of the file (no extension) where histograms are to be stored. | |
runname | optional name of this run, prepended to AIDA data paths. | |
storetype | a string indicating to the AIDA analysis factory how to store the histograms. Which strings are allowed depends on actual AIDA implementation used. To output in standard AIDA XML the string is typically "xml". | |
afac | an AIDA analysis factory object. The caller must make sure that the lifetime of the factory object exceeds the AnalysisHandler object. |
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.
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 51 of file AnalysisHandler.cc.
AnalysisHandler | ( | const AnalysisHandler & | ) | [private] |
The copy constructor is private and must never be called. In fact, it should not even be implemented.
void _normalizeTree | ( | AIDA::ITree & | tree | ) | [private] |
Convert any IHistogram1D objects in the AIDA tree to IDataPointSet objects.
Referenced by AnalysisHandler::finalize().
void _setupFactories | ( | ) | [private] |
Do the initialisation of the AIDA analysis factories with no store.
Definition at line 257 of file AnalysisHandler.cc.
References AnalysisHandler::_theAnalysisFactory, AnalysisHandler::_theDataPointSetFactory, AnalysisHandler::_theHistogramFactory, AnalysisHandler::_theTree, AnalysisHandler::_theTreeFactory, and AnalysisHandler::tree().
Referenced by AnalysisHandler::AnalysisHandler().
00257 { 00258 _theTreeFactory = _theAnalysisFactory->createTreeFactory(); 00259 _theTree = _theTreeFactory->create(); 00260 _theHistogramFactory = _theAnalysisFactory->createHistogramFactory(tree()); 00261 _theDataPointSetFactory = _theAnalysisFactory->createDataPointSetFactory(tree()); 00262 }
void _setupFactories | ( | const string & | basefilename, | |
HistoFormat | storetype | |||
) | [private] |
Do the initialisation of the AIDA analysis factories.
Definition at line 238 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().
00238 { 00239 string filename(basefilename), storetypestr(""); 00240 if (storetype == AIDAML) { 00241 if (!endsWith(filename, ".aida")) filename += ".aida"; 00242 storetypestr = "xml"; 00243 } else if (storetype == FLAT) { 00244 if (!endsWith(filename, ".data")) filename += ".data"; 00245 storetypestr = "flat"; 00246 } else if (storetype == ROOT) { 00247 if (!endsWith(filename, ".root")) filename += ".root"; 00248 storetypestr = "root"; 00249 } 00250 _theTreeFactory = _theAnalysisFactory->createTreeFactory(); 00251 _theTree = _theTreeFactory->create(filename, storetypestr, false, true); 00252 _theHistogramFactory = _theAnalysisFactory->createHistogramFactory(tree()); 00253 _theDataPointSetFactory = _theAnalysisFactory->createDataPointSetFactory(tree()); 00254 }
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 347 of file AnalysisHandler.cc.
References AnalysisHandler::addAnalysis().
00347 { 00348 foreach (const string& aname, analysisnames) { 00349 //getLog() << Log::DEBUG << "Adding analysis '" << aname << "'" << endl; 00350 addAnalysis(aname); 00351 } 00352 return *this; 00353 }
AnalysisHandler & addAnalysis | ( | Analysis * | analysis | ) |
Add an analysis to the run list by object.
Definition at line 409 of file AnalysisHandler.cc.
References AnalysisHandler::_analyses, and Analysis::_analysishandler.
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.
Definition at line 179 of file AnalysisHandler.cc.
References AnalysisHandler::_analyses, Log::DEBUG, AnalysisLoader::getAnalysis(), AnalysisHandler::getLog(), and Log::WARNING.
Referenced by AnalysisHandler::addAnalyses().
00179 { 00180 // Check for a duplicate analysis 00181 /// @todo Might we want to be able to run an analysis twice, with different params? 00182 /// Requires avoiding histo tree clashes, i.e. storing the histos on the analysis objects. 00183 foreach (const AnaHandle& a, _analyses) { 00184 if (a->name() == analysisname) { 00185 getLog() << Log::WARNING 00186 << "Analysis '" << analysisname 00187 << "' already registered: skipping duplicate" << endl; 00188 return *this; 00189 } 00190 } 00191 AnaHandle analysis( AnalysisLoader::getAnalysis(analysisname) ); 00192 if (analysis.get() != 0) { // < Check for null analysis. 00193 getLog() << Log::DEBUG << "Adding analysis '" << analysisname << "'" << endl; 00194 analysis->_analysishandler = this; 00195 _analyses.insert(analysis); 00196 } 00197 else { 00198 getLog() << Log::WARNING 00199 << "Analysis '" << analysisname 00200 << "' not found." << endl; 00201 } 00202 return *this; 00203 }
const std::set<AnaHandle, AnaHandleLess>& analyses | ( | ) | const [inline] |
Get the collection of currently registered analyses.
Definition at line 173 of file AnalysisHandler.hh.
References AnalysisHandler::_analyses.
Referenced by AnalysisHandler::init().
00173 { 00174 return _analyses; 00175 }
AIDA::IAnalysisFactory & analysisFactory | ( | ) |
The AIDA analysis factory.
Definition at line 365 of file AnalysisHandler.cc.
References AnalysisHandler::_theAnalysisFactory.
Referenced by Analysis::analysisFactory().
00365 { 00366 return *_theAnalysisFactory; 00367 }
std::vector< std::string > analysisNames | ( | ) | const |
Get a list of the currently registered analyses' names.
Definition at line 338 of file AnalysisHandler.cc.
References AnalysisHandler::_analyses.
Referenced by Run::init(), and AnalysisHandler::init().
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 103 of file AnalysisHandler.cc.
References AnalysisHandler::_analyses, AnalysisHandler::_beams, AnalysisHandler::_initialised, AnalysisHandler::_numEvents, AnalysisHandler::_sumOfWeights, AnalysisHandler::beamIds(), AnalysisHandler::beams(), Rivet::compatible(), Log::DEBUG, Log::ERROR, Rivet::fuzzyEquals(), AnalysisHandler::getLog(), Rivet::GeV, AnalysisHandler::init(), AnalysisHandler::setCrossSection(), AnalysisHandler::sqrtS(), and Rivet::toBeamsString().
Referenced by Run::processEvent().
00103 { 00104 // Call init with event as template if not already initialised 00105 if (!_initialised) { 00106 init(ge); 00107 } 00108 // Proceed with event analysis 00109 assert(_initialised); 00110 // Ensure that beam details match those from first event 00111 const PdgIdPair beams = Rivet::beamIds(ge); 00112 const double sqrts = Rivet::sqrtS(ge); 00113 if (!compatible(beams, _beams) || !fuzzyEquals(sqrts, sqrtS())) { 00114 getLog() << Log::ERROR << "Event beams mismatch: " 00115 << toBeamsString(beams) << " @ " << sqrts/GeV << " GeV" << " vs. first beams " 00116 << this->beams() << " @ " << this->sqrtS()/GeV << " GeV" << endl; 00117 exit(1); 00118 } 00119 00120 00121 Event event(ge); 00122 _numEvents++; 00123 // Weights 00124 const double weight = event.weight(); 00125 _sumOfWeights += weight; 00126 getLog() << Log::DEBUG << "Event #" << _numEvents << " weight = " << weight << endl; 00127 #ifdef HEPMC_HAS_CROSS_SECTION 00128 if (ge.cross_section()) { 00129 const double xs = ge.cross_section()->cross_section(); 00130 setCrossSection(xs); 00131 } 00132 #endif 00133 foreach (AnaHandle a, _analyses) { 00134 //getLog() << Log::DEBUG << "About to run analysis " << a->name() << endl; 00135 try { 00136 a->analyze(event); 00137 } catch (const Error& err) { 00138 getLog() << Log::ERROR << "Error in " << a->name() << "::analyze method: " 00139 << err.what() << endl; 00140 exit(1); 00141 } 00142 //getLog() << Log::DEBUG << "Finished running analysis " << a->name() << endl; 00143 } 00144 }
PdgIdPair beamIds | ( | ) | const |
Get beam IDs for this run, determined from first event.
Definition at line 416 of file AnalysisHandler.cc.
References AnalysisHandler::beams().
Referenced by AnalysisHandler::analyze(), Analysis::beamIds(), and AnalysisHandler::init().
00416 { 00417 return Rivet::beamIds(beams()); 00418 }
const ParticlePair& beams | ( | ) | const [inline] |
Get beam IDs for this run, determined from first event.
Definition at line 153 of file AnalysisHandler.hh.
References AnalysisHandler::_beams.
Referenced by AnalysisHandler::analyze(), AnalysisHandler::beamIds(), Analysis::beams(), and AnalysisHandler::sqrtS().
00153 { 00154 return _beams; 00155 }
void commitData | ( | ) |
Commit the AIDA tree to file.
Definition at line 265 of file AnalysisHandler.cc.
References AnalysisHandler::tree().
00265 { 00266 tree().commit(); 00267 }
double crossSection | ( | ) | const [inline] |
Get the cross-section known to the handler.
Definition at line 136 of file AnalysisHandler.hh.
References AnalysisHandler::_xs.
Referenced by AnalysisHandler::hasCrossSection().
00136 { 00137 return _xs; 00138 }
AIDA::IDataPointSetFactory & datapointsetFactory | ( | ) |
The AIDA histogram factory.
Definition at line 380 of file AnalysisHandler.cc.
References AnalysisHandler::_theDataPointSetFactory.
Referenced by Analysis::datapointsetFactory().
00380 { 00381 return *_theDataPointSetFactory; 00382 }
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 147 of file AnalysisHandler.cc.
References AnalysisHandler::_analyses, AnalysisHandler::_initialised, AnalysisHandler::_normalizeTree(), AnalysisHandler::_numEvents, AnalysisHandler::_theTree, Log::DEBUG, Log::ERROR, AnalysisHandler::getLog(), Log::INFO, and AnalysisHandler::tree().
00147 { 00148 assert(_initialised); 00149 getLog() << Log::INFO << "Finalising analyses" << endl; 00150 foreach (AnaHandle a, _analyses) { 00151 try { 00152 a->finalize(); 00153 } catch (const Error& err) { 00154 getLog() << Log::ERROR << "Error in " << a->name() << "::finalize method: " 00155 << err.what() << endl; 00156 exit(1); 00157 } 00158 } 00159 00160 // Print out number of events processed 00161 getLog() << Log::INFO << "Processed " << _numEvents << " event" << (_numEvents == 1 ? "" : "s") << endl; 00162 00163 // Change AIDA histos into data point sets 00164 getLog() << Log::DEBUG << "Converting histograms to scatter plots" << endl; 00165 assert(_theTree != 0); 00166 _normalizeTree(tree()); 00167 00168 // Delete analyses 00169 getLog() << Log::DEBUG << "Deleting analyses" << endl; 00170 _analyses.clear(); 00171 00172 // Print out MCnet boilerplate 00173 cout << endl; 00174 cout << "The MCnet usage guidelines apply to Rivet: see http://www.montecarlonet.org/GUIDELINES" << endl; 00175 cout << "Please acknowledge plots made with Rivet analyses, and cite arXiv:1003.0694 (http://arxiv.org/abs/1003.0694)" << endl; 00176 }
Log & getLog | ( | ) | [private] |
Get a logger object.
Definition at line 55 of file AnalysisHandler.cc.
Referenced by AnalysisHandler::addAnalysis(), AnalysisHandler::analyze(), AnalysisHandler::finalize(), AnalysisHandler::init(), AnalysisHandler::removeAnalysis(), AnalysisHandler::removeIncompatibleAnalyses(), and AnalysisHandler::setRunBeams().
00055 { 00056 return Log::getLog("Rivet.Analysis.Handler"); 00057 }
bool hasCrossSection | ( | ) | const |
Whether the handler knows about a cross-section.
Definition at line 404 of file AnalysisHandler.cc.
References AnalysisHandler::crossSection().
Referenced by Run::processEvent().
00404 { 00405 return (crossSection() >= 0); 00406 }
AIDA::IHistogramFactory & histogramFactory | ( | ) |
The AIDA histogram factory.
Definition at line 375 of file AnalysisHandler.cc.
References AnalysisHandler::_theHistogramFactory.
Referenced by Analysis::histogramFactory().
00375 { 00376 return *_theHistogramFactory; 00377 }
void init | ( | const GenEvent & | event | ) |
Initialize a run, with the run beams taken from the example event.
Definition at line 60 of file AnalysisHandler.cc.
References AnalysisHandler::_analyses, AnalysisHandler::_initialised, AnalysisHandler::_numEvents, AnalysisHandler::_sumOfWeights, AnalysisHandler::analyses(), AnalysisHandler::analysisNames(), AnalysisHandler::beamIds(), Rivet::beams(), Log::DEBUG, Log::ERROR, AnalysisHandler::getLog(), AnalysisHandler::removeIncompatibleAnalyses(), AnalysisHandler::setRunBeams(), Rivet::toUpper(), and Log::WARN.
00060 { 00061 assert(!_initialised); 00062 setRunBeams(Rivet::beams(ge)); 00063 getLog() << Log::DEBUG << "Initialising the analysis handler" << endl; 00064 _numEvents = 0; 00065 _sumOfWeights = 0.0; 00066 00067 // Check that analyses are beam-compatible 00068 const size_t num_anas_requested = analysisNames().size(); 00069 removeIncompatibleAnalyses(beamIds()); 00070 foreach (const AnaHandle a, analyses()) { 00071 if (toUpper(a->status()) != "VALIDATED") { 00072 getLog() << Log::WARN 00073 << "Analysis '" << a->name() << "' is unvalidated: be careful!" << endl; 00074 } 00075 } 00076 if (num_anas_requested > 0 && analysisNames().size() == 0) { 00077 getLog() << Log::ERROR 00078 << "All analyses were incompatible with the first event's beams\n" 00079 << "Exiting, since this probably isn't intentional!" << endl; 00080 exit(1); 00081 } 00082 00083 foreach (AnaHandle a, _analyses) { 00084 getLog() << Log::DEBUG << "Initialising analysis: " << a->name() << endl; 00085 try { 00086 // Allow projection registration in the init phase onwards 00087 a->_allowProjReg = true; 00088 a->init(); 00089 //getLog() << Log::DEBUG << "Checking consistency of analysis: " << a->name() << endl; 00090 //a->checkConsistency(); 00091 } catch (const Error& err) { 00092 getLog() << Log::ERROR << "Error in " << a->name() << "::init method: " 00093 << err.what() << endl; 00094 exit(1); 00095 } 00096 getLog() << Log::DEBUG << "Done initialising analysis: " << a->name() << endl; 00097 } 00098 _initialised = true; 00099 getLog() << Log::DEBUG << "Analysis handler initialised" << endl; 00100 }
void init | ( | ) | [inline] |
Definition at line 212 of file AnalysisHandler.hh.
Referenced by AnalysisHandler::analyze(), and Run::init().
bool needCrossSection | ( | ) | const |
Is cross-section information required by at least one child analysis?
Definition at line 385 of file AnalysisHandler.cc.
References AnalysisHandler::_analyses.
Referenced by Run::processEvent().
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 329 of file AnalysisHandler.cc.
References AnalysisHandler::_numEvents.
Referenced by Analysis::numEvents().
00329 { 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 356 of file AnalysisHandler.cc.
References AnalysisHandler::removeAnalysis().
00356 { 00357 foreach (const string& aname, analysisnames) { 00358 removeAnalysis(aname); 00359 } 00360 return *this; 00361 }
AnalysisHandler & removeAnalysis | ( | const std::string & | analysisname | ) |
Remove an analysis from the run list using its name.
Definition at line 206 of file AnalysisHandler.cc.
References AnalysisHandler::_analyses, Log::DEBUG, and AnalysisHandler::getLog().
Referenced by AnalysisHandler::removeAnalyses(), and AnalysisHandler::removeIncompatibleAnalyses().
00206 { 00207 shared_ptr<Analysis> toremove; 00208 foreach (const AnaHandle a, _analyses) { 00209 if (a->name() == analysisname) { 00210 toremove.reset( a.get() ); 00211 break; 00212 } 00213 } 00214 if (toremove.get() != 0) { 00215 getLog() << Log::DEBUG << "Removing analysis '" << analysisname << "'" << endl; 00216 _analyses.erase(toremove); 00217 } 00218 return *this; 00219 }
AnalysisHandler & removeIncompatibleAnalyses | ( | const PdgIdPair & | beams | ) |
Remove beam-incompatible analyses from the run list.
Definition at line 222 of file AnalysisHandler.cc.
References AnalysisHandler::_analyses, AnalysisHandler::getLog(), AnalysisHandler::removeAnalysis(), and Log::WARN.
Referenced by AnalysisHandler::init().
00222 { 00223 vector<string> anamestodelete; 00224 foreach (const AnaHandle a, _analyses) { 00225 if (! a->isCompatible(beams)) { 00226 anamestodelete.push_back(a->name()); 00227 } 00228 } 00229 foreach (const string& aname, anamestodelete) { 00230 getLog() << Log::WARN << "Removing incompatible analysis '" 00231 << aname << "'" << endl; 00232 removeAnalysis(aname); 00233 } 00234 return *this; 00235 }
string runName | ( | ) | const |
Get the name of this run.
Definition at line 328 of file AnalysisHandler.cc.
References AnalysisHandler::_runname.
Referenced by Analysis::histoDir().
00328 { return _runname; }
AnalysisHandler & setCrossSection | ( | double | xs | ) |
Set the cross-section for the process being generated.
Definition at line 395 of file AnalysisHandler.cc.
References AnalysisHandler::_analyses, and AnalysisHandler::_xs.
Referenced by AnalysisHandler::analyze(), Run::init(), and Run::processEvent().
AnalysisHandler& setRunBeams | ( | const ParticlePair & | beams | ) | [inline] |
Set beams for this run.
Definition at line 145 of file AnalysisHandler.hh.
References AnalysisHandler::_beams, Log::DEBUG, AnalysisHandler::getLog(), Rivet::GeV, and AnalysisHandler::sqrtS().
Referenced by AnalysisHandler::init().
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 333 of file AnalysisHandler.cc.
References AnalysisHandler::_sumOfWeights.
00333 { 00334 _sumOfWeights=sum; 00335 }
double sqrtS | ( | ) | const |
Get energy for this run, determined from first event.
Definition at line 421 of file AnalysisHandler.cc.
References AnalysisHandler::beams().
Referenced by AnalysisHandler::analyze(), AnalysisHandler::setRunBeams(), and Analysis::sqrtS().
00421 { 00422 return Rivet::sqrtS(beams()); 00423 }
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 330 of file AnalysisHandler.cc.
References AnalysisHandler::_sumOfWeights.
Referenced by Analysis::sumOfWeights().
00330 { return _sumOfWeights; }
AIDA::ITree & tree | ( | ) |
The AIDA tree object.
Definition at line 370 of file AnalysisHandler.cc.
References AnalysisHandler::_theTree.
Referenced by AnalysisHandler::_setupFactories(), AnalysisHandler::commitData(), AnalysisHandler::finalize(), Analysis::tree(), and AnalysisHandler::writeData().
00370 { 00371 return *_theTree; 00372 }
void writeData | ( | const std::string & | filename | ) |
Write the AIDA tree to the named file.
Definition at line 270 of file AnalysisHandler.cc.
References AnalysisHandler::tree().
00270 { 00271 tree().commit(filename); 00272 }
set<AnaHandle, AnaHandleLess> _analyses [private] |
The collection of Analysis objects to be used.
Definition at line 272 of file AnalysisHandler.hh.
Referenced by AnalysisHandler::addAnalysis(), AnalysisHandler::analyses(), AnalysisHandler::analysisNames(), AnalysisHandler::analyze(), AnalysisHandler::finalize(), AnalysisHandler::init(), AnalysisHandler::needCrossSection(), AnalysisHandler::removeAnalysis(), AnalysisHandler::removeIncompatibleAnalyses(), and AnalysisHandler::setCrossSection().
ParticlePair _beams [private] |
Beams used by this run.
Definition at line 291 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 294 of file AnalysisHandler.hh.
Referenced by AnalysisHandler::analyze(), AnalysisHandler::finalize(), and AnalysisHandler::init().
size_t _numEvents [private] |
Number of events seen.
Definition at line 282 of file AnalysisHandler.hh.
Referenced by AnalysisHandler::analyze(), AnalysisHandler::finalize(), AnalysisHandler::init(), and AnalysisHandler::numEvents().
std::string _runname [private] |
Run name.
Definition at line 279 of file AnalysisHandler.hh.
Referenced by AnalysisHandler::runName().
double _sumOfWeights [private] |
Sum of event weights seen.
Definition at line 285 of file AnalysisHandler.hh.
Referenced by AnalysisHandler::analyze(), AnalysisHandler::init(), AnalysisHandler::setSumOfWeights(), and AnalysisHandler::sumOfWeights().
shared_ptr<AIDA::IAnalysisFactory> _theAnalysisFactory [private] |
The AIDA analysis factory.
Definition at line 304 of file AnalysisHandler.hh.
Referenced by AnalysisHandler::_setupFactories(), AnalysisHandler::analysisFactory(), and AnalysisHandler::AnalysisHandler().
AIDA::IDataPointSetFactory* _theDataPointSetFactory [private] |
The AIDA data point set factory.
Definition at line 316 of file AnalysisHandler.hh.
Referenced by AnalysisHandler::_setupFactories(), and AnalysisHandler::datapointsetFactory().
AIDA::IHistogramFactory* _theHistogramFactory [private] |
The AIDA histogram factory.
Definition at line 313 of file AnalysisHandler.hh.
Referenced by AnalysisHandler::_setupFactories(), and AnalysisHandler::histogramFactory().
AIDA::ITree* _theTree [private] |
The AIDA tree object.
Definition at line 310 of file AnalysisHandler.hh.
Referenced by AnalysisHandler::_setupFactories(), AnalysisHandler::finalize(), and AnalysisHandler::tree().
AIDA::ITreeFactory* _theTreeFactory [private] |
The AIDA tree factory.
Definition at line 307 of file AnalysisHandler.hh.
Referenced by AnalysisHandler::_setupFactories().
double _xs [private] |
Cross-section known to AH.
Definition at line 288 of file AnalysisHandler.hh.
Referenced by AnalysisHandler::crossSection(), and AnalysisHandler::setCrossSection().