From 3d451943eda598be228ba76ef885aa410f104963 Mon Sep 17 00:00:00 2001 From: lawrenceleejr <lawrenceleejr@gmail.com> Date: Mon, 4 Apr 2016 10:05:19 +0200 Subject: [PATCH] rooteventselector only skimming if selection string given. no longer reusing variable smallTree --- main/python/cmdLineUtils.py | 13 ++++++++----- main/python/rooteventselector.py | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/main/python/cmdLineUtils.py b/main/python/cmdLineUtils.py index bc2e5f2dc76..1a801c2f26f 100644 --- a/main/python/cmdLineUtils.py +++ b/main/python/cmdLineUtils.py @@ -767,11 +767,14 @@ def _copyTreeSubset(sourceFile,sourcePathSplit,destFile,destPathSplit,firstEvent super(ROOT.TNtuple,smallTree).Fill() else: smallTree.Fill() - if isNtuple: - smallTree = super(ROOT.TNtuple,smallTree).CopyTree(selectionString) + if selectionString: + if isNtuple: + smallSkimmedTree = super(ROOT.TNtuple,smallTree).CopyTree(selectionString) + else: + smallSkimmedTree = smallTree.CopyTree(selectionString) + smallSkimmedTree.Write() else: - smallTree = smallTree.CopyTree(selectionString) - smallTree.Write() + smallTree.Write() return retcode def _copyTreeSubsets(fileName, pathSplitList, destFile, destPathSplit, first, last, selectionString): @@ -789,7 +792,7 @@ def _copyTreeSubsets(fileName, pathSplitList, destFile, destPathSplit, first, la return retcode def rootEventselector(sourceList, destFileName, destPathSplit, \ - compress=None, recreate=False, first=0, last=-1, selectionString="1"): + compress=None, recreate=False, first=0, last=-1, selectionString=""): # Check arguments if sourceList == [] or destFileName == "": return 1 if recreate and destFileName in sourceList: diff --git a/main/python/rooteventselector.py b/main/python/rooteventselector.py index e874ee40bfe..dfb588bf7dc 100755 --- a/main/python/rooteventselector.py +++ b/main/python/rooteventselector.py @@ -43,7 +43,7 @@ def execute(): parser.add_argument("--recreate", help=cmdLineUtils.RECREATE_HELP, action="store_true") parser.add_argument("-f","--first", type=int, default=0, help=FIRST_EVENT_HELP) parser.add_argument("-l","--last", type=int, default=-1, help=LAST_EVENT_HELP) - parser.add_argument("-s","--selection", default="1") + parser.add_argument("-s","--selection", default="") # Put arguments in shape sourceList, destFileName, destPathSplit, optDict = cmdLineUtils.getSourceDestListOptDict(parser) -- GitLab