[Rivet-svn] rivet: 2 new changesets

Rivet Mercurial rivet at projects.hepforge.org
Tue Feb 14 00:15:02 GMT 2017


details:   https://rivet.hepforge.org/hg/rivet/rev/c0c0d41bbc1a
branches:  release-2-5-x
changeset: 5689:c0c0d41bbc1a
user:      Christian Gutschow <chris.g at cern.ch>
date:      Tue Feb 14 00:05:41 2017 +0000
description:
extend make-plots to work with Counter and Value objects

details:   https://rivet.hepforge.org/hg/rivet/rev/3ede721fc330
branches:  release-2-5-x
changeset: 5690:3ede721fc330
user:      Christian Gutschow <chris.g at cern.ch>
date:      Tue Feb 14 00:11:13 2017 +0000
description:
comment maintenance

diffs (truncated from 90 to 50 lines):

--- a/bin/make-plots	Wed Jan 25 13:47:25 2017 +0000
+++ b/bin/make-plots	Tue Feb 14 00:11:13 2017 +0000
@@ -158,6 +158,10 @@
                 elif name == 'HISTO2D':
                     self.histos[path] = Histo2D(f, p=path)
                     self.description['is2dim'] = True
+                elif name == 'COUNTER':
+                    self.histos[path] = Counter(f, p=path)
+                elif name == 'VALUE':
+                    self.histos[path] = Value(f, p=path)
                 elif name == 'FUNCTION':
                     self.functions[path] = Function(f)
 #            elif is_comment(line):
@@ -479,6 +483,10 @@
             for i in inputdata.histos.keys():
                 if not inputdata.histos[i].description.has_key('ConnectGaps'):
                     inputdata.histos[i].description['ConnectGaps'] = inputdata.description['ConnectGaps']
+        # Counter and Value only have dummy x-axis, ticks wouldn't make sense here, so suppress them:
+        if 'Value object' in str(inputdata.histos) or 'Counter object' in str(inputdata.histos):
+          inputdata.description['XCustomMajorTicks'] = ''
+          inputdata.description['XCustomMinorTicks'] = ''
 
     def set_borders(self, inputdata):
         self.set_xmax(inputdata)
@@ -1951,6 +1959,54 @@
 
 
 
+class Value(Histogram):
+
+    def read_input_data(self, f):
+        for line in f:
+            if is_end_marker(line, 'VALUE'):
+                break
+            elif is_comment(line):
+                continue
+            else:
+                line = line.rstrip()
+                m = pat_property.match(line)
+                if m:
+                    prop, value = m.group(1,2)
+                    self.description[prop] = value
+                else:
+                    linearray = line.split()
+                    if len(linearray) == 3:
+                        self.data.append(BinData(0.0, 1.0, linearray[0], [ linearray[1], linearray[2] ])) # dummy x-values
+                    else:
+                        raise Exception('Value does not have the expected number of columns. ' + line)
+
+    # TODO: specialise draw() here


More information about the Rivet-svn mailing list