[yoda-svn] yoda: 2 new changesets

YODA Mercurial yoda at projects.hepforge.org
Sun Feb 19 10:45:01 GMT 2017


details:   https://yoda.hepforge.org/hg/yoda/rev/3dbc8927e715
branches:  release-1-6
changeset: 1329:3dbc8927e715
user:      Holger Schulz <holger.schulz at durham.ac.uk>
date:      Sun Feb 19 10:36:53 2017 +0000
description:
Slight modification to make root2yoda also work with TH1F

details:   https://yoda.hepforge.org/hg/yoda/rev/9afae2cf91b3
branches:  release-1-6
changeset: 1330:9afae2cf91b3
user:      Holger Schulz <holger.schulz at durham.ac.uk>
date:      Sun Feb 19 10:38:41 2017 +0000
description:
Update ChangeLog

diffs (30 lines):

--- a/ChangeLog	Tue Dec 13 15:53:45 2016 +0000
+++ b/ChangeLog	Sun Feb 19 10:38:41 2017 +0000
@@ -1,3 +1,8 @@
+2017-02-19  Holger Schulz <holger.schulz at durham.ac.uk>
+	
+	* Convert TH1F to TH1D in root2flat. Much simpler than duplicating
+        the TH1D stuff in pyext.
+
 2016-12-13  Andy Buckley  <andy.buckley at cern.ch>
 
 	* Version 1.6.6 release.
--- a/bin/root2yoda	Tue Dec 13 15:53:45 2016 +0000
+++ b/bin/root2yoda	Sun Feb 19 10:38:41 2017 +0000
@@ -24,7 +24,15 @@
 import ROOT
 for i, o in in_out:
     rf = ROOT.TFile(i)
-    rootobjects = [obj for (path, obj) in yoda.root.getall(rf)]
+    rootobjects_raw = [obj for (path, obj) in yoda.root.getall(rf)]
+    rootobjects     = [x for x in rootobjects_raw if not isinstance(x, ROOT.TH1F)]
+    th1f            = [x for x in rootobjects_raw if     isinstance(x, ROOT.TH1F)]
+    # Conversion of TH1F into TH1D
+    for ro in th1f:
+        temp = ROOT.TH1D()
+        ro.Copy(temp)
+        rootobjects.append(temp)
+
     analysisobjects = [yoda.root.to_yoda(ro) for ro in rootobjects]
     rf.Close()
 


More information about the yoda-svn mailing list