Getting leaves from branches in TTrees


I would like to have a piece of information about getting leaves informations in trees.
I’m working on an initial tree, with contain branches, and these branches contain leaves. I want to create a new tree with branches of the first tree, but only the ones I’ve chosen, each containing leaves I’ve chosen too.
At this moment, I succeeded in creating only the branches that I want in a new tree, thanks to a forum topic, but I can’t get leaves informations yet.
The first part of my code is :

TClonesArray* p20Muon = new TClonesArray(“TMBMuon”,10);

TBranch *b_muon=ch->GetBranch(“Muon”);

ch->SetBranchAddress("Muon", &p20Muon);



Has someone an idea about this question?
Thank you in advance,


see example in $ROOTSYS/tutorials/tree/copytree2.C