Skip to content
Snippets Groups Projects
Commit 1ad7a348 authored by Scott Snyder's avatar Scott Snyder Committed by Frank Winklmeier
Browse files

PyUtils: Don't sort branches in diff_root.

PyUtils: Don't sort branches in diff_root.

Sorting the branches in the order defined by RootFileDumper takes a considerable
amount of time.  However, the branch ordering is irrelevant for diff_root.
Disable the sorting in that case.
parent 2b45d7ac
No related branches found
No related tags found
No related merge requests found
......@@ -231,7 +231,7 @@ class RootFileDumper(object):
return
def dump(self, tree_name, itr_entries, leaves=None, retvecs=False):
def dump(self, tree_name, itr_entries, leaves=None, retvecs=False, sortleaves=True):
ROOT = import_root()
import AthenaPython.PyAthena as PyAthena
......@@ -275,6 +275,11 @@ class RootFileDumper(object):
else:
itr_entries = range(itr_entries)
list_ = list
map_ = map
str_ = str
isinstance_ = isinstance
for ientry in itr_entries:
hdr = ":: entry [%05i]..." % (ientry,)
#print (hdr)
......@@ -320,8 +325,12 @@ class RootFileDumper(object):
))
self.allgood = False
print (err)
for o in sorted(vals, key = lambda x: '.'.join(s for s in x[0] if isinstance(s, str))):
n = list(map(str, o[0]))
if sortleaves:
viter = sorted(vals, key = lambda x: '.'.join(s for s in x[0] if isinstance_(s, str_)))
else:
viter = vals
for o in viter:
n = list_(map_(str_, o[0]))
v = o[1]
yield tree_name, ientry, n, v
......
......@@ -413,8 +413,8 @@ def main(args):
itr_entries_new = itr_entries
branches = sorted(branches)
old_dump_iter = fold.dump(args.tree_name, itr_entries_old, branches, True)
new_dump_iter = fnew.dump(args.tree_name, itr_entries_new, branches, True)
old_dump_iter = fold.dump(args.tree_name, itr_entries_old, branches, True, False)
new_dump_iter = fnew.dump(args.tree_name, itr_entries_new, branches, True, False)
def leafname_fromdump(entry):
if entry is None:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment