|
[yoda-svn] yoda: Improvements to yoda.root, and fixes/improvements in ROOTC...YODA Mercurial yoda at projects.hepforge.orgSat Nov 21 22:00:02 GMT 2015
details: https://yoda.hepforge.org/hg/yoda/rev/fd3731363ec2 branches: changeset: 1176:fd3731363ec2 user: Andy Buckley <andy at insectnation.org> date: Sat Nov 21 21:46:04 2015 +0000 description: Improvements to yoda.root, and fixes/improvements in ROOTCnv.h and rootcompat.pyx, leading to new root2yoda script diffs (truncated from 201 to 50 lines): --- a/ChangeLog Wed Nov 18 00:26:39 2015 +0000 +++ b/ChangeLog Sat Nov 21 21:46:04 2015 +0000 @@ -1,3 +1,11 @@ +2015-11-21 Andy Buckley <andy.buckley at cern.ch> + + * Add root2yoda (slow) function. + + * Deprecating yoda.to_root() in favour of yoda.root module, which + contains to_root and to_yoda functions, as well as a ROOT file + walking function. + 2015-11-17 Andy Buckley <andy.buckley at cern.ch> * Map ROOT-to-YODA (as scatter) functions to Python. Phew. --- a/bin/Makefile.am Wed Nov 18 00:26:39 2015 +0000 +++ b/bin/Makefile.am Sat Nov 21 21:46:04 2015 +0000 @@ -14,7 +14,7 @@ ## Data format conversion dist_bin_SCRIPTS += yodacnv yoda2aida yoda2flat aida2yoda aida2flat flat2yoda if ENABLE_ROOT -dist_bin_SCRIPTS += yoda2root +dist_bin_SCRIPTS += yoda2root root2yoda endif endif --- a/bin/yoda2root Wed Nov 18 00:26:39 2015 +0000 +++ b/bin/yoda2root Sat Nov 21 21:46:04 2015 +0000 @@ -26,10 +26,13 @@ of = ROOT.TFile(o, "recreate") analysisobjects = yoda.readYODA(i) filter_aos(analysisobjects, opts.MATCH, opts.UNMATCH) - rootobjects = [yoda.to_root(ao) for ao in analysisobjects.values()] + rootobjects = [yoda.root.to_root(ao) for ao in analysisobjects.values()] ## Protect against "/" in the histogram name, which ROOT does not like for obj in rootobjects: + ## It's possible for the ROOT objects to be null, if conversion failed + if obj is None: + continue ## Split the name on "/" directory separators parts = obj.GetName().split("/") ## Walk down dir tree, making it as we go --- a/include/YODA/ROOTCnv.h Wed Nov 18 00:26:39 2015 +0000 +++ b/include/YODA/ROOTCnv.h Sat Nov 21 21:46:04 2015 +0000 @@ -100,9 +100,20 @@ } + /// Convert a ROOT 1D histogram (excluding TProfile) to a new'd YODA Scatter2D + inline Scatter2D* toNewScatter2D(const TH1& th1, bool scalebywidth=true) {
More information about the yoda-svn mailing list |