[Rivet-svn] rivet: 2 new changesets

Rivet Mercurial rivet at projects.hepforge.org
Tue Nov 10 16:00:01 GMT 2015


details:   https://rivet.hepforge.org/hg/rivet/rev/643656ba1780
branches:  release-2-4-x
changeset: 4922:643656ba1780
user:      Andy Buckley <andy at insectnation.org>
date:      Tue Nov 10 13:31:58 2015 +0000
description:
Handle 2D histograms better in rivet-cmphistos (since they can't be overlaid)

details:   https://rivet.hepforge.org/hg/rivet/rev/b51cbd27d57d
branches:  release-2-4-x
changeset: 4923:b51cbd27d57d
user:      Andy Buckley <andy at insectnation.org>
date:      Tue Nov 10 15:55:03 2015 +0000
description:
More 2D histogram integration with cmphistos and mkhtml

diffs (truncated from 245 to 50 lines):

--- a/ChangeLog	Wed Nov 04 19:22:30 2015 +0000
+++ b/ChangeLog	Tue Nov 10 15:55:03 2015 +0000
@@ -1,3 +1,7 @@
+2015-11-10  Andy Buckley  <andy.buckley at cern.ch>
+
+	* Handle 2D histograms better in rivet-cmphistos (since they can't be overlaid)
+
 2015-11-05  Andy Buckley  <andy.buckley at cern.ch>
 
 	* Allow comma-separated analysis name lists to be passed to a single -a/--analysis/--analyses option.
--- a/bin/rivet-cmphistos	Wed Nov 04 19:22:30 2015 +0000
+++ b/bin/rivet-cmphistos	Tue Nov 10 15:55:03 2015 +0000
@@ -204,13 +204,37 @@
         raise Exception(msg)
 
 
+def mkOutput(hpath, aos, plot=None, special=None):
+    """
+    Make the .dat file string. We can't use "yoda.writeFLAT(anaobjects, 'foobar.dat')"
+    because the PLOT and SPECIAL blocks don't have a corresponding analysis object.
+    """
+    output = ''
+
+    if plot:
+        output += str(plot)
+
+    if special:
+        output += "\n"
+        output += "# BEGIN SPECIAL %s\n" % h
+        output += special
+        output += "# END SPECIAL\n\n"
+
+    from cStringIO import StringIO
+    sio = StringIO()
+    yoda.writeFLAT(aos, sio)
+    output += sio.getvalue()
+
+    return output
+
+
 def writeOutput(output, h):
     "Choose output file name and dir"
-    hparts = h.strip("/").split("/")
+    hparts = h.strip("/").split("/", 1)
     if opts.HIER_OUTPUT:
         ana = "_".join(hparts[:-1]) if len(hparts) > 1 else "ANALYSIS"
         outdir = os.path.join(opts.OUTDIR, ana)
-        outfile = '%s.dat' % hparts[-1]
+        outfile = '%s.dat' % hparts[-1].replace("/", "_")
     else:


More information about the Rivet-svn mailing list