[Rivet-svn] r1958 - in trunk: bin pyext

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Fri Oct 23 16:31:17 BST 2009


Author: eike
Date: Fri Oct 23 16:31:17 2009
New Revision: 1958

Log:
* fixed chopping of ref histograms ('/REF' isn't stripped from the AIDApath)
* added histopath property to get a '/REF'-stripped path

Modified:
   trunk/bin/chop_bins
   trunk/pyext/lighthisto.py

Modified: trunk/bin/chop_bins
==============================================================================
--- trunk/bin/chop_bins	Fri Oct 23 15:59:22 2009	(r1957)
+++ trunk/bin/chop_bins	Fri Oct 23 16:31:17 2009	(r1958)
@@ -125,8 +125,8 @@
         tree = ET.parse(aidafile)
         for dps in tree.findall("dataPointSet"):
             thishist = lighthisto.Histo.fromDPS(dps)
-            if thishist.fullPath() in bindefs.keys():
-                outhistos.append(thishist.chop(bindefs[thishist.fullPath()]))
+            if thishist.histopath in bindefs.keys():
+                outhistos.append(thishist.chop(bindefs[thishist.histopath]))
             else:
                 outhistos.append(thishist)
         out = open(chopfile, "w")

Modified: trunk/pyext/lighthisto.py
==============================================================================
--- trunk/pyext/lighthisto.py	Fri Oct 23 15:59:22 2009	(r1957)
+++ trunk/pyext/lighthisto.py	Fri Oct 23 16:31:17 2009	(r1958)
@@ -29,8 +29,11 @@
     aidaindent = "  "
     def __init__(self):
         self._bins = []
+        # the leading AIDA path (including /REF) but not the observable name
         self.path = None
+        # the observable name, e.g. d01-x02-y01
         self.name = None
+        # the histogram title
         self.title = None
         self.xlabel = None
         self.ylabel = None
@@ -50,7 +53,16 @@
 
     def fullPath(self):
         return os.path.join(self.path, self.name)
-    fullpath = property(fullPath)
+    fullpath = property(fullPath,
+            doc="Full AIDA path including leading '/REF' and histogram name")
+
+    def histoPath(self):
+        if self.path.startswith("/REF"):
+            return self.fullpath[4:]
+        else:
+            return self.fullpath
+    histopath = property(histoPath,
+            doc="AIDA path but without a leading '/REF'")
 
     def header(self):
         out = "# BEGIN PLOT\n"
@@ -210,9 +222,9 @@
         new.name = dps.get("name")
         new.title = dps.get("title")
         new.path = dps.get("path")
-        # strip /REF from path
-        if new.path.startswith("/REF"):
-            new.path = new.path[4:]
+        # # strip /REF from path
+        # if new.path.startswith("/REF"):
+            # new.path = new.path[4:]
         axes = dps.findall("dimension")
         if (len(axes)==2):
             for a in axes:


More information about the Rivet-svn mailing list