Leaf counter error with multi-leaves branch

Using root 5.32.

running this code:

{ int nelem = 2; int myarray[10]; TTree *mytree = new TTree("mytree","mytree"); mytree->Branch("nelem",&nelem,"nelem/I"); mytree->Branch("array",&myarray[0],"var01[nelem]/I:var02[nelem]/I"); }

getting this error:

Error in <TLeafI::GetLen>: Leaf counter is greater than maximum! leaf: 'var01' len: 2 max: 0

why?

Hi,

The best is to You can either create each array in their own branch (the recommended setup): int nelem = 2; int myarray[10]; TTree *mytree = new TTree("mytree","mytree"); mytree->Branch("nelem",&nelem,"nelem/I"); mytree->Branch("var01",&myarray[0],"var01[nelem]/I"); mytree->Branch("var02",&myarray[2],"var02[nelem]/I");

Cheers,
Philippe.