|
[Rivet-svn] r2225 - in trunk: bin include/Rivet src/Coreblackhole at projects.hepforge.org blackhole at projects.hepforge.orgThu Jan 21 17:57:15 GMT 2010
Author: fsiegert Date: Thu Jan 21 17:57:14 2010 New Revision: 2225 Log: Allow for multiple HepMC files on command line again. Fixes #377. Modified: trunk/bin/rivet trunk/include/Rivet/Run.hh trunk/src/Core/Run.cc Modified: trunk/bin/rivet ============================================================================== --- trunk/bin/rivet Thu Jan 21 17:24:06 2010 (r2224) +++ trunk/bin/rivet Thu Jan 21 17:57:14 2010 (r2225) @@ -386,7 +386,6 @@ ## Init run based on one event evtfile = HEPMCFILES[0] -logging.info("Reading events from '%s'" % evtfile) if not run.init(evtfile): logging.error("Failed to initialise on event file %s" % evtfile) sys.exit(2) @@ -394,16 +393,21 @@ ## Event loop starttime = time.time() EVTNUM = 0 -while opts.MAXEVTNUM is None or EVTNUM < opts.MAXEVTNUM: - EVTNUM += 1 - logNEvt(EVTNUM, starttime, opts.MAXEVTNUM) - if not run.processEvent(): - logging.warn("Event processing failed for evt #%i!" % (EVTNUM)) - break - if RECVD_KILL_SIGNAL is not None: - break +for file in HEPMCFILES: + logging.info("Reading events from '%s'" % file) + run.openFile(file) if not run.readEvent(): - break + continue + while opts.MAXEVTNUM is None or EVTNUM < opts.MAXEVTNUM: + EVTNUM += 1 + logNEvt(EVTNUM, starttime, opts.MAXEVTNUM) + if not run.processEvent(): + logging.warn("Event processing failed for evt #%i!" % (EVTNUM)) + break + if RECVD_KILL_SIGNAL is not None: + break + if not run.readEvent(): + break logging.info("Finished event loop") run.finalize() Modified: trunk/include/Rivet/Run.hh ============================================================================== --- trunk/include/Rivet/Run.hh Thu Jan 21 17:24:06 2010 (r2224) +++ trunk/include/Rivet/Run.hh Thu Jan 21 17:57:14 2010 (r2225) @@ -45,6 +45,9 @@ /// Set up HepMC file readers bool init(const std::string& evtfile); + /// Open a HepMC GenEvent file + bool openFile(const std::string& evtfile); + /// Read the next HepMC event bool readEvent(); Modified: trunk/src/Core/Run.cc ============================================================================== --- trunk/src/Core/Run.cc Thu Jan 21 17:24:06 2010 (r2224) +++ trunk/src/Core/Run.cc Thu Jan 21 17:57:14 2010 (r2225) @@ -39,9 +39,9 @@ } return true; } - - - bool Run::init(const std::string& evtfile) { + + + bool Run::openFile(const std::string& evtfile) { // Set up HepMC input reader objects if (evtfile == "-") { _io.reset(new HepMC::IO_GenEvent(std::cin)); @@ -54,6 +54,12 @@ Log::getLog("Rivet.Run") << Log::ERROR << "Read error on file " << evtfile << endl; return false; } + return true; + } + + + bool Run::init(const std::string& evtfile) { + if (!openFile(evtfile)) return false; // Read first event to define run conditions bool ok = readEvent();
More information about the Rivet-svn mailing list |