[Rivet-svn] rivet: Tweaks to cmphistos variation plot handling implementation

Rivet Mercurial rivet at projects.hepforge.org
Wed Dec 16 10:15:01 GMT 2015


details:   https://rivet.hepforge.org/hg/rivet/rev/3462639a16bb
branches:  release-2-4-x
changeset: 4955:3462639a16bb
user:      Andy Buckley <andy at insectnation.org>
date:      Wed Dec 16 10:02:43 2015 +0000
description:
Tweaks to cmphistos variation plot handling implementation

diffs (truncated from 67 to 50 lines):

--- a/bin/rivet-cmphistos	Tue Dec 15 23:47:06 2015 +0000
+++ b/bin/rivet-cmphistos	Wed Dec 16 10:02:43 2015 +0000
@@ -286,8 +286,9 @@
         for p in aos.keys():
             if p and p not in hpaths:
                 hpaths.append(p)
+            firstaop = aos[p][sorted(aos[p].keys())[0]]
             # TODO: Would be nicer to test via isHisto and dim or similar, or yoda.Scatter/Histo/Profile base classes
-            if type(aos[p][0]) in (yoda.Histo2D, yoda.Profile2D) and p not in h2ds: #< TODO: assumes that there is a canonical index entry [0]
+            if type(firstaop) in (yoda.Histo2D, yoda.Profile2D) and p not in h2ds:
                 h2ds.append(p)
 
     ## Read the reference data from the Rivet search paths and add them
@@ -304,7 +305,8 @@
         ## The analysis objects to be plotted
         anaobjects = []
         ## List of histos to be drawn, to sync the legend and plotted lines
-        drawonly = []
+        mainlines = []
+        varlines = []
         ## Is this a 2D histo?
         is2d = (hpath in h2ds)
         ## Will we be drawing a ratio plot?
@@ -352,7 +354,7 @@
                     ratioreference = '/REF'+hpath
             ## For 1D
             anaobjects.append(refdata)
-            drawonly.append('/REF'+hpath)
+            mainlines.append('/REF'+hpath)
             ## For 2D
             if is2d:
                 s = mkOutput(hpath, [refdata], plot, special)
@@ -366,7 +368,7 @@
                 hmcs = mchistos[infile][hpath]
                 ## For now, just plot all the different variation histograms (reversed, so [0] is on top)
                 # TODO: calculate and plot an appropriate error band, somehow...
-                for i in reversed(hmcs.keys()):
+                for i in sorted(hmcs.keys(), reverse=True):
                     hmc = hmcs[i]
                     ## Default linecolor, linestyle
                     if not is2d:
@@ -383,7 +385,10 @@
                         fullpath += "["+str(i)+"]"
                     hmc.setAnnotation('Path', fullpath)
                     anaobjects.append(hmc)
-                    drawonly.append(fullpath)
+                    if i == 0:
+                        mainlines.append(fullpath)
+                    else:
+                        varlines.append(fullpath)


More information about the Rivet-svn mailing list