[yoda-svn] yoda: pyext/yoda/rootcompat.pyx: Fix ordering of TH1 vs. TProfil...

YODA Mercurial yoda at projects.hepforge.org
Fri May 12 12:00:02 BST 2017


details:   https://yoda.hepforge.org/hg/yoda/rev/791a95f4453e
branches:  release-1-6
changeset: 1336:791a95f4453e
user:      Andy Buckley <andy at insectnation.org>
date:      Fri May 12 11:47:21 2017 +0100
description:
pyext/yoda/rootcompat.pyx: Fix ordering of TH1 vs. TProfile conversion -- TProfile *is* a TH1, so we have to test for the more specific type-match first. Thanks to Dmitry Kalinkin for the patch.

diffs (29 lines):

--- a/ChangeLog	Tue May 02 12:29:45 2017 +0100
+++ b/ChangeLog	Fri May 12 11:47:21 2017 +0100
@@ -1,3 +1,10 @@
+2017-05-12  Andy Buckley  <andy.buckley at cern.ch>
+
+	* pyext/yoda/rootcompat.pyx: Fix ordering of TH1 vs. TProfile
+	conversion -- TProfile *is* a TH1, so we have to test for the more
+	specific type-match first. Thanks to Dmitry Kalinkin for the
+	patch.
+
 2017-05-02  Andy Buckley  <andy.buckley at cern.ch>
 
 	* Add static Reader methods to match the Writer ones.
--- a/pyext/yoda/rootcompat.pyx	Tue May 02 12:29:45 2017 +0100
+++ b/pyext/yoda/rootcompat.pyx	Fri May 12 11:47:21 2017 +0100
@@ -39,10 +39,10 @@
 
 def to_yoda(root_obj, widthscale=True):
     cdef croot.TObject* ptr = py_to_root(root_obj)
-    if isinstance(root_obj, ROOT.TH1D):
+    if isinstance(root_obj, ROOT.TProfile):
+        return _TP1toS2(<croot.TProfile*>ptr)
+    elif isinstance(root_obj, ROOT.TH1D):
         return _TH1toS2(<croot.TH1D*>ptr, widthscale)
-    elif isinstance(root_obj, ROOT.TProfile):
-        return _TP1toS2(<croot.TProfile*>ptr)
     # elif isinstance(root_obj, ROOT.TGraph):
     #     return _TG1toS2(<croot.TGraph*>ptr)
     elif isinstance(root_obj, ROOT.TH2D):


More information about the yoda-svn mailing list