|
[Rivet-svn] r3300 - contribblackhole at projects.hepforge.org blackhole at projects.hepforge.orgSat Aug 20 12:21:02 BST 2011
Author: weyh Date: Sat Aug 20 12:21:01 2011 New Revision: 3300 Log: Cought overflow exception for adding large errors (~divided empty bins). During the sumup, use "inf", at the writeout use 1.e+308, which is in the order of largest available floats. Modified: contrib/aidamerge Modified: contrib/aidamerge ============================================================================== --- contrib/aidamerge Fri Aug 19 23:13:12 2011 (r3299) +++ contrib/aidamerge Sat Aug 20 12:21:01 2011 (r3300) @@ -62,10 +62,20 @@ n = 0 for infile, h in hs.iteritems(): sum_val += h.getBin(i).val - sum_err2 += h.getBin(i).getErr()**2 + try: + sum_err2 += h.getBin(i).getErr()**2 + except OverflowError: + # in case the **2 produces overflow errors + # set sum to 'inf' + sum_err2 = float('inf') n += 1 outhistos[path].getBin(i).val = sum_val / n - outhistos[path].getBin(i).setErr(sqrt(sum_err2) / n) + try: + 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 + outhistos[path].getBin(i).setErr(1.e308) ## Write out merged histos #print sorted(outhistos.values())
More information about the Rivet-svn mailing list |