[Rivet-svn] r3559 - in trunk: . bin data

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Tue Feb 14 16:45:28 GMT 2012


Author: buckley
Date: Tue Feb 14 16:45:28 2012
New Revision: 3559

Log:
bin/compare-histos: Don't attempt to remove bins from MC histos where they aren't found in the ref file, if the ref file is not expt data, or if the new --no-rmgapbins arg is given.

Modified:
   trunk/ChangeLog
   trunk/bin/compare-histos
   trunk/data/rivet-completion

Modified: trunk/ChangeLog
==============================================================================
--- trunk/ChangeLog	Tue Feb 14 16:39:15 2012	(r3558)
+++ trunk/ChangeLog	Tue Feb 14 16:45:28 2012	(r3559)
@@ -4,6 +4,10 @@
 
 2012-02-14  Andy Buckley  <andy.buckley at cern.ch>
 
+	* bin/compare-histos: Don't attempt to remove bins from MC histos
+	where they aren't found in the ref file, if the ref file is not
+	expt data, or if the new --no-rmgapbins arg is given.
+
 	* bin/rivet: Remove the conversion of requested analysis names to
 	upper-case: mixed-case analysis names will now work.
 

Modified: trunk/bin/compare-histos
==============================================================================
--- trunk/bin/compare-histos	Tue Feb 14 16:39:15 2012	(r3558)
+++ trunk/bin/compare-histos	Tue Feb 14 16:45:28 2012	(r3559)
@@ -113,6 +113,9 @@
     parser.add_option("--plotinfodir", dest="PLOTINFODIR", action="append",
                       default=["."], help="directory which may contain plot header information (in addition "
                       "to standard Rivet search paths)")
+    parser.add_option("--no-rmgapbins", dest="RMBINS", action="store_false",
+                      default=True, help="disable attempting to remove 'gap' bins from MC histos when they "
+                      "don't appear in the ref file")
 
     stygroup = OptionGroup(parser, "Plot style")
     stygroup.add_option("--refid", dest="REF_ID",
@@ -467,7 +470,12 @@
 
         if opts.RATIO_DEVIATION:
             paramdefaults["RatioPlotMode"] = "deviation"
+
+        ## Behaviour changes if "ref" data is just another MC file
         if not HISTOS[ref][name].isdata:
+            ## Don't attempt to remove "gap" bins
+            opts.RMBINS = False
+            ## Different ratio plot label (not MC/Data)
             paramdefaults["RatioPlotYLabel"] = "Ratio"
             if opts.RATIO_DEVIATION:
                 paramdefaults["RatioPlotYLabel"] = "Deviation"
@@ -536,14 +544,17 @@
             numskipped = 0
             #print hfile, name, HISTOS[hfile][name].numBins(), HISTOS[ref][name].numBins()
             for ibin, bin in enumerate(HISTOS[hfile][name].getBins()):
-                xmin, xmax = bin.getXRange()
                 ## Skip writing this MC bin if the bin edges don't match, and the MC histo has too many bins
-                if hfile != ref and HISTOS[hfile][name].numBins() > HISTOS[ref][name].numBins():
-                    rxmin, rxmax = HISTOS[ref][name].getBin(ibin-numskipped).getXRange()
-                    if not eq(rxmin, xmin) or not eq(rxmax, xmax):
-                        numskipped += 1
-                        assert(numskipped <= (HISTOS[hfile][name].numBins() - HISTOS[ref][name].numBins()))
-                        continue
+                if opts.RMBINS:
+                    xmin, xmax = bin.getXRange()
+                    #print HISTOS[hfile][name].numBins(), HISTOS[ref][name].numBins()
+                    if hfile != ref and HISTOS[hfile][name].numBins() > HISTOS[ref][name].numBins():
+                        rxmin, rxmax = HISTOS[ref][name].getBin(ibin-numskipped).getXRange()
+                        if not eq(rxmin, xmin) or not eq(rxmax, xmax):
+                            numskipped += 1
+                            #print numskipped, (HISTOS[hfile][name].numBins() - HISTOS[ref][name].numBins())
+                            assert(numskipped <= abs(HISTOS[hfile][name].numBins() - HISTOS[ref][name].numBins()))
+                            continue
                 histstr += '%s\n' % (bin.asFlat())
             histstr += "# END HISTOGRAM\n"
             histstrs.append(histstr)

Modified: trunk/data/rivet-completion
==============================================================================
--- trunk/data/rivet-completion	Tue Feb 14 16:39:15 2012	(r3558)
+++ trunk/data/rivet-completion	Tue Feb 14 16:45:28 2012	(r3559)
@@ -109,6 +109,7 @@
     opts="$opts --all --show-mc-only --show-single --refid"
     opts="$opts --no-plottitle"
     opts="$opts --plotinfodir"
+    opts="$opts --no-rmgapbins"
     opts="$opts --quiet -q --verbose -v"
     if [[ ${cur} == -* ]] ; then
         COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )


More information about the Rivet-svn mailing list