Dynamic array of classes to TTree

I would like to store in the TTree nested structures, something like:

struct a
{
struct *b;
int something;
}
struct b
{
struct *c;
}

Where b and c will point to an arrays of structures. The dimensions of the arrays are not know at the time of writing of the code and will be dynamically allocated.

In general I understand that due to non-continuity writing this kind of structure to TTree (even if I have arrays with known size instead of pointers) is very inconvenient. So I decided to create classes for each structure. However, if I have

class a
{
public:
int val;
a(){val=0;}
}


class b
{
public:
a *obj;
b(){obj = new a[2]; obj[0].val=1;}
}

And initialize TTree branch with

a *obj1 = new a();
t->Branch("test_branch", "a", &obj1, 32000, 99);

Than after writing to the TTree I have inside a branch with “obj” of type “*b”. This does not behave like an array - printing both values of obj[0] and obj[1] .val gives 1. Is there a way to add this kind of nested structures with dynamically allocated arrays of structures to a TTree?

After reading a little bit I realized that TTrees with a custom class cannot be used in PyROOT without a dictionary, and I would like everyone getting a file with the TTree to be able to read it (without compiling additional sources to get the dictionary). So my question turns into a simple and general one: is there any way to store in root TTree nested structures with arrays of structures? Of course, the most basic structures consist only from basic types.