Double Dots in Branch Name of TClonesArray

Hi,

I want to be able to switch on and off branches in my tree output which was created with.
TTree::Branch(TList*). The list contains single objects as well as TClonesArrays(). In order to attach a “.” to the top level branchname that is needed to switch off selectively the branches I use a split level of 100. Like in this dummy-code:

TList *fl1 = new TList();

TClonesArray *fTcab2 = new TClonesArray(“b2”,100);
fTcab2->SetName(“tcab2”);

b2 *fb2 = new b2(“sb2”);
fl1->Add(fb2);
fl1->Add(fTcab2);

TFile* file = TFile::Open(“branch.root”, “RECREATE”);
TTree *fTree = new TTree(“fTree”,“test Tree”);
fTree->Branch(fl1,32000,100);

The single Object looks like wanted but the TClonesArray contains two dots

*Br 8 :tcab2. : tcab2._ *

*Br 9 :tcab2…fUniqueID : fUniqueID[tcab2._] *

–
*Br 10 :tcab2…fBits : fBits[tcab2._] *

This looks strange and I’m not sure if this is how it is wanted, or not.

Best

Christian

…

Change your split level from 100 to the default value 99 and things will work correctly.

Rene

Dear Rene,

That is what I tried before, but since I want to switch off parts of the single objects. (e.g. sb2.fX) I need the dot in the first level . Otherwise (and with multiple single objects of the same type) I will only have access to “fX” for setting the branch Status.

So with
fTree->Branch(fList);
I get no dot in the Single object’s leaves (e.g. fX) , but the correct dot for the TClonesArrays
and with
fTree->Branch(fList,32000,100); I get a dot for the single object’s leaves (e.g. sb2.fX) but two dots for the TClonesArrays (e.g. tcab2…fBits). This only happens for top level branches.

I could set the branches also by hand based on the TList and modify the branch names accordingly. But the TTree::Branch(TCollection*) is just one line of code :slight_smile:

Best

Christian