[Rivet-svn] r4058 - contrib

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Thu Dec 6 10:47:11 GMT 2012


Author: hoeth
Date: Thu Dec  6 10:47:11 2012
New Revision: 4058

Log:
Add option to sum histograms to aidamerge

Modified:
   contrib/aidamerge

Modified: contrib/aidamerge
==============================================================================
--- contrib/aidamerge	Thu Dec  6 10:41:12 2012	(r4057)
+++ contrib/aidamerge	Thu Dec  6 10:47:11 2012	(r4058)
@@ -22,6 +22,9 @@
 parser = OptionParser(usage="%prog aidafile [aidafile2 ...]")
 parser.add_option("-o", "--outfile", dest="OUTFILE",
                   default="merged.aida", help="file for merged aida output.")
+parser.add_option("-s", "--sum",
+                  action="store_true", dest="performSum", default=False,
+                  help="sum the bin values instead of averaging")
 opts, args = parser.parse_args()
 headerprefix = ""
 
@@ -69,9 +72,12 @@
                 # set sum to 'inf'
                 sum_err2 = float('inf')
             n += 1
-        outhistos[path].getBin(i).val = sum_val / n
+        if (opts.performSum): outhistos[path].getBin(i).val = sum_val
+        else:                 outhistos[path].getBin(i).val = sum_val / n
+
         try:
-            outhistos[path].getBin(i).setErr(sum_err2**0.5 / n)
+            if (opts.performSum): outhistos[path].getBin(i).setErr(sum_err2**0.5 )
+            else:                 outhistos[path].getBin(i).setErr(sum_err2**0.5 / n)
         except OverflowError:
             # to get back to numerics, replace an eventual 'inf' 
             # in sum_err2 with max float available ~1.e+308


More information about the Rivet-svn mailing list