Different branches having identical data

Hello

I’m trying to create a tree with 9 branches of the same class (spectrometer), but all the branches are identical. I’ve modified the example Rene sent me and thought it was something wrong I did, but testing again the Rene example, it also has the entries identical for all of the detector. it seems that somehow the branches are taking the same address for all the objects. The example is attached in the message. I did not include my files because I splitted them in several files, if I get the solution for the simple example below I can propagate the solution to my case.

Thanks for any help

Luiz
dethit-1.C (1.22 KB)

in the test program, replace
sprintf(bname,“det%d”,i);
by
sprintf(bname,“det%d.”,i);

see meaning of the dot in TTree::Branch

Rene[/code]