|
[Rivet-svn] r3298 - in trunk: bin include/Rivet src/Coreblackhole at projects.hepforge.org blackhole at projects.hepforge.orgFri Aug 19 23:00:13 BST 2011
Author: fsiegert Date: Fri Aug 19 23:00:12 2011 New Revision: 3298 Log: Simplify last commit by skipping Run and setting it in AnalysisHandler directly. Modified: trunk/bin/rivet trunk/include/Rivet/AnalysisHandler.hh trunk/include/Rivet/Run.hh trunk/src/Core/AnalysisHandler.cc trunk/src/Core/Run.cc Modified: trunk/bin/rivet ============================================================================== --- trunk/bin/rivet Fri Aug 19 22:25:31 2011 (r3297) +++ trunk/bin/rivet Fri Aug 19 23:00:12 2011 (r3298) @@ -376,6 +376,7 @@ ## Set up analysis handler RUNNAME = opts.RUN_NAME or "" ah = rivet.AnalysisHandler(RUNNAME) +ah.setIgnoreBeams(opts.IGNORE_BEAMS) if opts.ALL_ANALYSES: opts.ANALYSES = all_analyses for a in opts.ANALYSES: @@ -434,7 +435,7 @@ try: if opts.EVENT_TIMEOUT or opts.RUN_TIMEOUT: signal.alarm(min_nonnull(opts.EVENT_TIMEOUT, opts.RUN_TIMEOUT)) - init_ok = run.init(hepmcfile, hepmcfileweight, opts.IGNORE_BEAMS) + init_ok = run.init(hepmcfile, hepmcfileweight) signal.alarm(0) if not init_ok: logging.error("Failed to initialise using event file '%s'... exiting" % hepmcfile) Modified: trunk/include/Rivet/AnalysisHandler.hh ============================================================================== --- trunk/include/Rivet/AnalysisHandler.hh Fri Aug 19 22:25:31 2011 (r3297) +++ trunk/include/Rivet/AnalysisHandler.hh Fri Aug 19 23:00:12 2011 (r3298) @@ -133,6 +133,9 @@ /// Get energy for this run, usually determined from the first event. double sqrtS() const; + /// Setter for _ignoreBeams + void setIgnoreBeams(bool ignore=true); + //@} @@ -182,7 +185,7 @@ /// Initialize a run, with the run beams taken from the example event. - void init(const GenEvent& event, bool ignorebeams=false); + void init(const GenEvent& event); /// Analyze the given \a event. This function will call the @@ -262,6 +265,9 @@ /// Flag to check if init has been called bool _initialised; + /// Flag whether input event beams should be ignored in compatibility check + bool _ignoreBeams; + //@} Modified: trunk/include/Rivet/Run.hh ============================================================================== --- trunk/include/Rivet/Run.hh Fri Aug 19 22:25:31 2011 (r3297) +++ trunk/include/Rivet/Run.hh Fri Aug 19 23:00:12 2011 (r3298) @@ -48,7 +48,7 @@ //@{ /// Set up HepMC file readers (using the appropriate file weight for the first file) - bool init(const std::string& evtfile, double weight=1.0, bool ignorebeams=false); + bool init(const std::string& evtfile, double weight=1.0); /// Open a HepMC GenEvent file (using the appropriate file weight for the first file) bool openFile(const std::string& evtfile, double weight=1.0); Modified: trunk/src/Core/AnalysisHandler.cc ============================================================================== --- trunk/src/Core/AnalysisHandler.cc Fri Aug 19 22:25:31 2011 (r3297) +++ trunk/src/Core/AnalysisHandler.cc Fri Aug 19 23:00:12 2011 (r3298) @@ -17,7 +17,7 @@ AnalysisHandler::AnalysisHandler(const string& runname) : _runname(runname), _numEvents(0), _sumOfWeights(0.0), _xs(-1.0), - _initialised(false) + _initialised(false), _ignoreBeams(false) { _theAnalysisFactory.reset( createAnalysisFactory() ); _setupFactories(); @@ -28,7 +28,7 @@ const string& runname, HistoFormat storetype) : _runname(runname), _numEvents(0), _sumOfWeights(0.0), _xs(-1.0), - _initialised(false) + _initialised(false), _ignoreBeams(false) { cerr << "AnalysisHandler(basefilename, runname, format) constructor is deprecated: " << "please migrate your code to use the one-arg constructor" << endl; @@ -46,7 +46,7 @@ } - void AnalysisHandler::init(const GenEvent& ge, bool ignorebeams) { + void AnalysisHandler::init(const GenEvent& ge) { assert(!_initialised); setRunBeams(Rivet::beams(ge)); MSG_DEBUG("Initialising the analysis handler"); @@ -57,7 +57,7 @@ const size_t num_anas_requested = analysisNames().size(); vector<string> anamestodelete; foreach (const AnaHandle a, _analyses) { - if ((!a->isCompatible(beams())) && (!ignorebeams)) { + if ((!a->isCompatible(beams())) && (!_ignoreBeams)) { //MSG_DEBUG(a->name() << " requires beams " << a->requiredBeams() << " @ " << a->requiredEnergies() << " GeV"); anamestodelete.push_back(a->name()); } @@ -403,5 +403,9 @@ return Rivet::sqrtS(beams()); } + void AnalysisHandler::setIgnoreBeams(bool ignore) { + _ignoreBeams=ignore; + } + } Modified: trunk/src/Core/Run.cc ============================================================================== --- trunk/src/Core/Run.cc Fri Aug 19 22:25:31 2011 (r3297) +++ trunk/src/Core/Run.cc Fri Aug 19 23:00:12 2011 (r3298) @@ -71,7 +71,7 @@ } - bool Run::init(const std::string& evtfile, double weight, bool ignorebeams) { + bool Run::init(const std::string& evtfile, double weight) { if (!openFile(evtfile, weight)) return false; // Read first event to define run conditions @@ -83,7 +83,7 @@ } // Initialise AnalysisHandler with beam information from first event - _ah.init(*_evt, ignorebeams); + _ah.init(*_evt); // Set cross-section from command line if (_xs >= 0.0) {
More information about the Rivet-svn mailing list |