Tree branch splitting

Dear rooters,

can someone explain to me how to accomplish splitting of branches in the root tree.

I have a text file, that I am reading line by line and putting into the root tree. For simplicity let’s say it has three columns (X Y and Z)

I want Z to be a leaf of Y and Y to be a sub-branch and a leaf of X. Plus I want to create a new X branch each time X variable changes.

For example:

X Y Z
1 2 3
1 2 4
1 2 5
1 3 4 // new Y sub-branch needed here + new entry in Y leaf
1 3 4
1 3 6
2 1 4// new X branch needed here

I have tried a class with nested vectors and multidimensional arrays but it did not work.

Thank you for all ideas,

Dmitry.

See advice in root.cern.ch/phpBB2/viewtopic.php?p=35509 (i.e. I do not recommend creating that many branches).

Cheers,
Philippe.