[Rivet-svn] r2465 - in trunk: bin data

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Fri May 28 17:19:24 BST 2010


Author: buckley
Date: Fri May 28 17:19:27 2010
New Revision: 2465

Log:
Adding experimental argument to write histograms (in not-quite-right format) every n events

Modified:
   trunk/bin/rivet
   trunk/data/rivet-completion

Modified: trunk/bin/rivet
==============================================================================
--- trunk/bin/rivet	Tue May 25 15:10:24 2010	(r2464)
+++ trunk/bin/rivet	Fri May 28 17:19:27 2010	(r2465)
@@ -105,6 +105,8 @@
                   help="give an optional run name, to be prepended as a 'top level directory' in histo paths")
 parser.add_option("-H", "--histo-file", dest="HISTOFILE",
                   default="Rivet.aida", help="specify the output histo file path")
+parser.add_option("--histo-interval", dest="HISTO_WRITE_INTERVAL", type=int,
+                  default=None, help="specify how often histograms are written in #events [experimental]")
 parser.add_option("-x", "--cross-section", dest="CROSS_SECTION",
                   default=None, metavar="XS",
                   help="specify the signal process cross-section in pb")
@@ -395,19 +397,22 @@
 
 ## Event loop
 starttime = time.time()
-EVTNUM = 0
+evtnum = 0
 for fileidx in range(len(HEPMCFILES)):
     logging.info("Reading events from '%s'" % HEPMCFILES[fileidx])
-    while opts.MAXEVTNUM is None or EVTNUM < opts.MAXEVTNUM:
-        EVTNUM += 1
-        logNEvt(EVTNUM, starttime, opts.MAXEVTNUM)
+    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))
+            logging.warn("Event processing failed for evt #%i!" % evtnum)
             break
         if RECVD_KILL_SIGNAL is not None:
             break
         if not run.readEvent():
             break
+        if opts.HISTO_WRITE_INTERVAL is not None:
+            if evtnum % opts.HISTO_WRITE_INTERVAL == 0:
+                ah.writeData(opts.HISTOFILE)
     if fileidx < len(HEPMCFILES)-1:
         run.openFile(HEPMCFILES[fileidx+1])
         if not run.readEvent():

Modified: trunk/data/rivet-completion
==============================================================================
--- trunk/data/rivet-completion	Tue May 25 15:10:24 2010	(r2464)
+++ trunk/data/rivet-completion	Fri May 28 17:19:27 2010	(r2465)
@@ -10,7 +10,7 @@
 
     opts="--help --verbose --quiet --version --nevts --cross-section"
     opts="$opts --analysis --runname --list-analyses --show-analysis"
-    opts="$opts --histo-file"
+    opts="$opts --histo-file --histo-interval"
     opts="$opts -a -A -n -h -x -H -l -V -Q"
     if [[ ${cur} == -* ]] ; then
         #if test -x "$(which rivet)"; then
@@ -29,7 +29,7 @@
             COMPREPLY=( $(compgen -W "$anas" -- ${cur}) )
             return 0
         elif [[ ${cur} == "--analysis=" || \
-            ${cur} == "--show-analysis=" ]] ; then 
+            ${cur} == "--show-analysis=" ]] ; then
             COMPREPLY=( $(compgen -W "$anas" --) )
             return 0
         fi


More information about the Rivet-svn mailing list