13"""Command line to copy subsets of trees from source ROOT files to new trees on a destination ROOT file"""
20description =
"Copy subsets of trees from source ROOT files"
22FIRST_EVENT_HELP =
"specify the first event to copy"
23LAST_EVENT_HELP =
"specify the last event to copy"
26- rooteventselector source.root:tree dest.root
27 Copy the tree 'tree' from 'source.root' to 'dest.root'.
29- rooteventselector -f 101 source.root:tree dest.root
30 Copy a subset of the tree 'tree' from 'source.root' to 'dest.root'. The new tree contains events from the old tree except the first hundred.
32- rooteventselector -l 100 source.root:tree dest.root
33 Copy a subset of the tree 'tree' from 'source.root' to 'dest.root'. The new tree contains the first hundred events from the old tree.
35- rooteventselector --recreate source.root:tree dest.root
36 Recreate the destination file 'dest.root' and copy the tree 'tree' from 'source.root' to 'dest.root'.
38- rooteventselector -c 1 source.root:tree dest.root
39 Change the compression factor of the destination file 'dest.root' and copy the tree 'tree' from 'source.root' to 'dest.root'. For more information about compression settings of ROOT file, please look at the reference guide available on the ROOT site.
41- rooteventselector -s "(branch1Value > 100)&&( branch2Value )" source.root:tree dest.root
42 Copy the tree 'tree' from 'source.root' to 'dest.root' and apply a selection to the output tree.
44- rooteventselector -e "muon_*" source.root:tree dest.root
45 Copy the tree 'tree' from 'source.root' to 'dest.root' and remove branches matching "muon_*"
47- rooteventselector -e "*" -i "muon_*" source.root:tree dest.root
48 Copy the tree 'tree' from 'source.root' to 'dest.root' and only write branches matching "muon_*"
54 parser.prog =
'rooteventselector'
55 parser.add_argument(
"-c",
"--compress", type=int, help=cmdLineUtils.COMPRESS_HELP)
56 parser.add_argument(
"--recreate", help=cmdLineUtils.RECREATE_HELP, action=
"store_true")
57 parser.add_argument(
"-f",
"--first", type=int, default=0, help=FIRST_EVENT_HELP)
58 parser.add_argument(
"-l",
"--last", type=int, default=-1, help=LAST_EVENT_HELP)
59 parser.add_argument(
"-s",
"--selection", default=
"")
60 parser.add_argument(
"-i",
"--branchinclude", default=
"")
61 parser.add_argument(
"-e",
"--branchexclude", default=
"")
71 compress=optDict[
"compress"], recreate=optDict[
"recreate"], \
72 first=optDict[
"first"], last=optDict[
"last"], \
73 selectionString=optDict[
"selection"], \
74 branchinclude=optDict[
"branchinclude"],\
75 branchexclude=optDict[
"branchexclude"])
76if __name__ ==
"__main__":
rootEventselector(sourceList, destFileName, destPathSplit, compress=None, recreate=False, first=0, last=-1, selectionString="", branchinclude="", branchexclude="")
getParserSourceDest(theHelp, theEpilog="")
Get a commandline parser with the defaults of the commandline utils, a list of source files and a des...
getSourceDestListOptDict(parser, wildcards=True)
Get the list of tuples of sources, create destination name, destination pathSplit and the dictionary ...