[Rivet-svn] r2507 - trunk/bin

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Tue Jun 22 22:22:33 BST 2010


Author: fsiegert
Date: Tue Jun 22 22:22:31 2010
New Revision: 2507

Log:
Allow for free form specification of line color, line style, ... (everything in HISTOGRAM section of .dat file) already on the compare-histos and rivet-mkhtml command lines. This allows for something like e.g. rivet-mkhtml -s Run.1.aida:'Run 1':LineColor=blue:LineStyle=dotted Run.2.aida:'Run 2':LineColor=green

Modified:
   trunk/bin/compare-histos
   trunk/bin/make-plots

Modified: trunk/bin/compare-histos
==============================================================================
--- trunk/bin/compare-histos	Tue Jun 22 21:08:46 2010	(r2506)
+++ trunk/bin/compare-histos	Tue Jun 22 22:22:31 2010	(r2507)
@@ -154,6 +154,7 @@
     ## Get file names and labels
     FILES = []
     FILELABELS = { }
+    FILEOPTIONS = { }
     if opts.RIVETREFS and rivet_data_dirs:
         reffiles = []
         for d in rivet_data_dirs:
@@ -161,12 +162,15 @@
             reffiles += glob.glob(os.path.join(d, "*.aida"))
         args = reffiles + args
     for a in args:
-        path = a
-        label = None
-        if ":" in a:
-            path, label = a.split(":", 1)
+        asplit = a.split(":")
+        path = asplit[0]
         FILES.append(path)
-        FILELABELS[path] = label
+        if len(asplit)>1:
+            FILELABELS[path] = asplit[1]
+        if len(asplit)>2:
+            FILEOPTIONS[path] = []
+        for i in range(2, len(asplit)):
+            FILEOPTIONS[path].append(asplit[i])
 
 
     ## Check that the requested files are sensible
@@ -236,7 +240,7 @@
         for n, h in histos.iteritems():
             if h.isdata and DATAFILES.has_key(n):
                 DATAFILES[n] = f
-            if FILELABELS[f] is not None:
+            if f in FILELABELS:
                 LABELS[f][n] = FILELABELS[f]
             else:
                 if h.isdata:
@@ -401,6 +405,9 @@
                     #if key == 'ErrorBars' and opts.MC_ERRS:
                     #    continue
                     histstr += "%s=%s\n" % (key, val)
+                if hfile in FILEOPTIONS:
+                    for option in FILEOPTIONS[hfile]:
+                        histstr += '%s\n' % option
                 i += 1
             for bin in HISTOS[hfile][name].getBins():
                 xmin, xmax = bin.getXRange()

Modified: trunk/bin/make-plots
==============================================================================
--- trunk/bin/make-plots	Tue Jun 22 21:08:46 2010	(r2506)
+++ trunk/bin/make-plots	Tue Jun 22 22:22:31 2010	(r2507)
@@ -1809,7 +1809,7 @@
     ## Check for no args
     if len(args) == 0:
         logging.error(parser.get_usage())
-        exit(2)
+        sys.exit(2)
 
 #     ## Test for latex and dvips
 #     latex/dvips


More information about the Rivet-svn mailing list