CopyTree and size of a vector branch

Hi,
I tried to think how to solve this but I don’t have any clue… Here is the situation:
I have a tree and I want to make a copy of all the entries where a specific branch (which is a vector) has at least 2 elements:

This is the branch:

*Br 77 :mu_pt : vector<float> * *Entries : 90155 : Total Size= 1310556 bytes File Size = 270653 * *Baskets : 20 : Basket Size= 230400 bytes Compression= 4.84 *

and for each event in the tree I could have 0 or more entry in the mu_pt vector. So I need to write something like this:

TTree* outtree = intree->CopyTree("all events where mu_pt.size()>1");
where intree is the original tree and outtree is the new tree.

How can I do that?
Thanks

Hi,

the method you need is indeed CopyTree: root.cern.ch/doc/master/classTT … 1aa0427e21

For formulating the selection based on the size of a container you can have a look at: root.cern.ch/doc/master/classTT … c468523e45 , in particular “accessing collection objects”.

Cheers,
Danilo

Thanks… it worked