Re: Clone Tree with selection

Rene Brun (Rene.Brun@cern.ch)
Mon, 03 May 1999 17:18:25 +0000


Olivier Meplan wrote:
>
> Hi Rooters!
>
> Is it possible to make a clone of a tree T in a new Tree T with a
> selection given like in the TTree::Draw function ?
>
> Olivier Meplan

Hi Olivier,
I suggest you look at the tutorials/copytree and copytree2 macros
to get some inspiration. These two macros use TTree::CloneTree.
The default is to copy all entries. Specify
TTree *newtree = oldtree->CloneTree(0);
then loop on all entries, and fill the newtree with the selected entries
only.
See example of loop at the end of TTree::CloneTree.

Rene Brun