|
[Rivet-svn] r3304 - in branches/2011-07-aida2yoda: . bin include/Rivet pyext/rivet src/Coreblackhole at projects.hepforge.org blackhole at projects.hepforge.orgMon Aug 22 11:58:29 BST 2011
Author: hoeth Date: Mon Aug 22 11:58:29 2011 New Revision: 3304 Log: merge r3298-r3299 from trunk Modified: branches/2011-07-aida2yoda/ChangeLog branches/2011-07-aida2yoda/bin/rivet branches/2011-07-aida2yoda/include/Rivet/AnalysisHandler.hh branches/2011-07-aida2yoda/include/Rivet/Run.hh branches/2011-07-aida2yoda/pyext/rivet/rivetwrap.i branches/2011-07-aida2yoda/src/Core/AnalysisHandler.cc branches/2011-07-aida2yoda/src/Core/Run.cc Modified: branches/2011-07-aida2yoda/ChangeLog ============================================================================== --- branches/2011-07-aida2yoda/ChangeLog Mon Aug 22 11:47:02 2011 (r3303) +++ branches/2011-07-aida2yoda/ChangeLog Mon Aug 22 11:58:29 2011 (r3304) @@ -1,3 +1,8 @@ +2011-08-19 Frank Siegert <frank.siegert at cern.ch> + * More NLO parton level generator friendliness: Don't crash or fail when + there are no beam particles. + * Add --ignore-beams option to skip compatibility check. + 2011-08-09 David Mallows <dave.mallows at gmail.com> * Fix aida2flat to ignore empty dataPointSet Modified: branches/2011-07-aida2yoda/bin/rivet ============================================================================== --- branches/2011-07-aida2yoda/bin/rivet Mon Aug 22 11:47:02 2011 (r3303) +++ branches/2011-07-aida2yoda/bin/rivet Mon Aug 22 11:58:29 2011 (r3304) @@ -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: branches/2011-07-aida2yoda/include/Rivet/AnalysisHandler.hh ============================================================================== --- branches/2011-07-aida2yoda/include/Rivet/AnalysisHandler.hh Mon Aug 22 11:47:02 2011 (r3303) +++ branches/2011-07-aida2yoda/include/Rivet/AnalysisHandler.hh Mon Aug 22 11:58:29 2011 (r3304) @@ -105,6 +105,9 @@ /// Get energy for this run, usually determined from the first event. double sqrtS() const; + /// Setter for _ignoreBeams + void setIgnoreBeams(bool ignore=true); + //@} @@ -154,7 +157,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 @@ -198,6 +201,9 @@ /// Flag to check if init has been called bool _initialised; + /// Flag whether input event beams should be ignored in compatibility check + bool _ignoreBeams; + //@} private: Modified: branches/2011-07-aida2yoda/include/Rivet/Run.hh ============================================================================== --- branches/2011-07-aida2yoda/include/Rivet/Run.hh Mon Aug 22 11:47:02 2011 (r3303) +++ branches/2011-07-aida2yoda/include/Rivet/Run.hh Mon Aug 22 11:58:29 2011 (r3304) @@ -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: branches/2011-07-aida2yoda/pyext/rivet/rivetwrap.i ============================================================================== --- branches/2011-07-aida2yoda/pyext/rivet/rivetwrap.i Mon Aug 22 11:47:02 2011 (r3303) +++ branches/2011-07-aida2yoda/pyext/rivet/rivetwrap.i Mon Aug 22 11:58:29 2011 (r3304) @@ -127,6 +127,7 @@ double sqrtS() const; const ParticlePair& beams() const; const PdgIdPair beamIds() const; + void setIgnoreBeams(bool ignore); std::vector<std::string> analysisNames(); AnalysisHandler& addAnalysis(const std::string& analysisname); AnalysisHandler& addAnalyses(const std::vector<std::string>& analysisnames); Modified: branches/2011-07-aida2yoda/src/Core/AnalysisHandler.cc ============================================================================== --- branches/2011-07-aida2yoda/src/Core/AnalysisHandler.cc Mon Aug 22 11:47:02 2011 (r3303) +++ branches/2011-07-aida2yoda/src/Core/AnalysisHandler.cc Mon Aug 22 11:58:29 2011 (r3304) @@ -14,7 +14,7 @@ AnalysisHandler::AnalysisHandler(const string& runname) : _runname(runname), _numEvents(0), _sumOfWeights(0.0), _xs(-1.0), - _initialised(false) + _initialised(false), _ignoreBeams(false) {} AnalysisHandler::~AnalysisHandler() @@ -26,7 +26,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"); @@ -37,7 +37,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()); } @@ -277,5 +277,9 @@ return Rivet::sqrtS(beams()); } + void AnalysisHandler::setIgnoreBeams(bool ignore) { + _ignoreBeams=ignore; + } + } Modified: branches/2011-07-aida2yoda/src/Core/Run.cc ============================================================================== --- branches/2011-07-aida2yoda/src/Core/Run.cc Mon Aug 22 11:47:02 2011 (r3303) +++ branches/2011-07-aida2yoda/src/Core/Run.cc Mon Aug 22 11:58:29 2011 (r3304) @@ -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 |