René Scholte wrote:
>
> Hello ROOTERS,
>
> I want to make a copy of a tree, and want this new tree to be filled with a
> number of last events from the original tree.
>
> Now, as I understand it, the CloneTree(nevents) - function makes a clone of
> a tree (structure) and then fills this new tree with events starting from
> zero to nevents.
> Is this true ?
>
> If so, how can I clone the tree and fill it with a number of last events ?
This one is easy. do
TTree *newTree = oldTree->CloneTree(0);
Int_t nentries = oldTree->GetEntries();
for (Int_t i=nentries-1000;i<nentries;i++) { //to copy last 1000
oldTree->GetEvent(i);
newTree->Fill();
}
Rene Brun
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:34 MET