Adding branch into a tree

Hi,

I need to add the following branch to a tree:

tree->Branch(“channel0”,&packet[0].energy,“energy/I:pulse[NSAMPLES]/S”)
tree->Branch(“channel1”,&packet[1].energy,“energy/I:pulse[NSAMPLES]/S”)

When I execute my program I get the following error:

Error in TBranch::TBranch: Illegal leaf: 'channel0/energy/I:pulse[NSAMPLES]/S’
Error in TBranch::TBranch: Illegal leaf: ‘channel1/energy/I:pulse[NSAMPLES]/S’

Do anybody knows what is wrong with this?

Cheers,

Seb

Either NSAMPLES must be the name of a branch or you need to replace it with the numerical value within the string (Aka Form(“energy/I:pulse[%s]/S”,NSAMPLES); )

Philippe

Dear ROOT experts,

I get the same error, but the array dimension IS a branch:

fCurrentTree->Branch("Trk_ntracks",&Trk_ntracks, "Trk_ntracks/I");
fCurrentTree->Branch("Trk_helpar",Trk_helpar, "Trk_helpar[Trk_ntracks][5]/F");

What could I do wrong? Thank you so much for any tip.

Cheers,
Slava

EDIT: sorry for this post, the problem has nothing to do with ROOT.
Cheers,
Slava

Hi Slava,

I can not reproduce this problem. Could you send a complete running example showing the issues as well as the exact output/result?

Thanks,
Philippe