Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README/README.SELECTOR
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ The Init() member function

The Init() function is called when the selector needs to initialize
a new tree or chain. Typically here the branch addresses of the tree
will be set. It is normaly not necessary to make changes to the generated
will be set. It is normally not necessary to make changes to the generated
code, but the routine can be extended by the user if needed. Init() will
be called many times when running with PROOF.

Expand Down
2 changes: 1 addition & 1 deletion README/ReleaseNotes/v608/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ The following people have contributed to this new version:
Paul Russo, Fermilab,\
Enric Tejedor Saavedra, CERN/SFT,\
Liza Sakellari, CERN/SFT,\
Manuel Tobias Schiller,\
Manuel Tobias Schiller, CERN/LHCb,\
David Smith, CERN/IT,\
Matevz Tadel, UCSD/CMS, Eve,\
Vassil Vassilev, Fermilab/CMS,\
Expand Down
2 changes: 1 addition & 1 deletion gui/gui/src/TGXYLayout.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
// . //
// } //
// //
// Normaly there is one layout hint per widget. Therefore these //
// Normally there is one layout hint per widget. Therefore these //
// can be deleted like in the following example in the desctuctor //
// of the frame: //
// //
Expand Down
19 changes: 13 additions & 6 deletions main/python/cmdLineUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ def rootCp(sourceList, destFileName, destPathSplit, \
##########
# ROOTEVENTSELECTOR

def _copyTreeSubset(sourceFile,sourcePathSplit,destFile,destPathSplit,firstEvent,lastEvent):
def _copyTreeSubset(sourceFile,sourcePathSplit,destFile,destPathSplit,firstEvent,lastEvent,selectionString):
"""Copy a subset of the tree from (sourceFile,sourcePathSplit)
to (destFile,destPathSplit) according to options in optDict"""
retcode = changeDirectory(sourceFile,sourcePathSplit[:-1])
Expand All @@ -767,10 +767,17 @@ def _copyTreeSubset(sourceFile,sourcePathSplit,destFile,destPathSplit,firstEvent
super(ROOT.TNtuple,smallTree).Fill()
else:
smallTree.Fill()
smallTree.Write()
if selectionString:
if isNtuple:
smallSkimmedTree = super(ROOT.TNtuple,smallTree).CopyTree(selectionString)
else:
smallSkimmedTree = smallTree.CopyTree(selectionString)
smallSkimmedTree.Write()
else:
smallTree.Write()
return retcode

def _copyTreeSubsets(fileName, pathSplitList, destFile, destPathSplit, first, last):
def _copyTreeSubsets(fileName, pathSplitList, destFile, destPathSplit, first, last, selectionString):
retcode = 0
destFileName = destFile.GetName()
rootFile = openROOTFile(fileName) \
Expand All @@ -780,12 +787,12 @@ def _copyTreeSubsets(fileName, pathSplitList, destFile, destPathSplit, first, la
for pathSplit in pathSplitList:
if isTree(rootFile,pathSplit):
retcode += _copyTreeSubset(rootFile,pathSplit, \
destFile,destPathSplit,first,last)
destFile,destPathSplit,first,last,selectionString)
if fileName != destFileName: rootFile.Close()
return retcode

def rootEventselector(sourceList, destFileName, destPathSplit, \
compress=None, recreate=False, first=0, last=-1):
compress=None, recreate=False, first=0, last=-1, selectionString=""):
# Check arguments
if sourceList == [] or destFileName == "": return 1
if recreate and destFileName in sourceList:
Expand All @@ -800,7 +807,7 @@ def rootEventselector(sourceList, destFileName, destPathSplit, \
retcode = 0
for fileName, pathSplitList in sourceList:
retcode += _copyTreeSubsets(fileName, pathSplitList, destFile, destPathSplit, \
first, last)
first, last, selectionString)
destFile.Close()
return retcode

Expand Down
6 changes: 5 additions & 1 deletion main/python/rooteventselector.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@

- rooteventselector -c 1 source.root:tree dest.root
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.

- rooteventselector -s "(branch1Value > 100)&&( branch2Value )" source.root:tree dest.root
Copy the tree 'tree' from 'source.root' to 'dest.root' and apply a selection to the output tree.
"""

def execute():
Expand All @@ -40,13 +43,14 @@ 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="")

# Put arguments in shape
sourceList, destFileName, destPathSplit, optDict = cmdLineUtils.getSourceDestListOptDict(parser)

# Process rootEventselector
return cmdLineUtils.rootEventselector(sourceList, destFileName, destPathSplit, \
compress=optDict["compress"], recreate=optDict["recreate"], \
first=optDict["first"], last=optDict["last"])
first=optDict["first"], last=optDict["last"], selectionString=optDict["selection"])

sys.exit(execute())
2 changes: 1 addition & 1 deletion test/periodic/XSReactionDlg.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ XSReactionDlg::~XSReactionDlg()
void
XSReactionDlg::InitColorCombo(TGComboBox *cb)
{
// Normaly this should be filled with color entries!!!
// Normally this should be filled with color entries!!!

cb->AddEntry("Black",0);
cb->AddEntry("Red",1);
Expand Down
2 changes: 1 addition & 1 deletion tree/treeplayer/src/TSelectorEntries.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ Int_t TSelectorEntries::GetEntry(Long64_t entry, Int_t getall)
/// The Init() function is called when the selector needs to initialize
/// a new tree or chain. Typically here the branch addresses and branch
/// pointers of the tree will be set.
/// It is normaly not necessary to make changes to the generated
/// It is normally not necessary to make changes to the generated
/// code, but the routine can be extended by the user if needed.
/// Init() will be called many times when running on PROOF
/// (once per file to be processed).
Expand Down