Variable size array in TTree

Hello all,

I am trying to do the following :

tree->Branch("EEscsize",&EEscsize,"EEscsize/I"); tree->Branch("ESrechitsize",ESrechitsize,"ESrechitsize[EEscsize]/I"); tree->Branch("ESrechitE",ESrechitE,"ESrechitE[EEscsize][ESrechitsize[EEscsize]]/D");

So essentially I want to define a branch for a tree variable which is 2-D as can be seen
in the above example(ESrechitE) & whose array size is itself a 1-D array(ESrechitsize).

But if I do it this way then it gives me error.
Is there a way to get this working?

Thanks for any help,

Best Regards,

This is not supported by TTree::Branch.
Instead I recommend to create your own class and simply create a top level branch with a pointer to you main class.


Hi Rene,

Many thanks for your reply.
Could you please tell me if there is an example somewhere to do it?

Thanks & Regards,

See $ROOTSYS/test/Event.h and it’s use in the same directory.


Hi Philippe,

thanks a lot for pointing out the reference.
I’ll now have a look at it.

Best Regards,