Example of Root macro to copy a subset of a Tree to a new Tree, selecting entries.
Only selected entries are copied to the new Tree. The input file has been generated by the program in $ROOTSYS/test/Event with Event 1000 1 99 1
void copytree3() {
TString dir =
"$ROOTSYS/test/Event.root";
{oldfile =
new TFile(
"$ROOTSYS/test/Event.root");}
else {oldfile =
new TFile(
"./Event.root");}
Event *event = 0;
TFile *newfile =
new TFile(
"small.root",
"recreate");
if (event->GetNtrack() > 605) newtree->
Fill();
event->Clear();
}
delete oldfile;
delete newfile;
}
- Author
- Rene Brun
Definition in file copytree3.C.