How to write a branch directory?

Hi,
As far as I understood, I think the problem is more simple than the case you mention (TTree: creating a sub-branch of a branch from scratch)

Indeed, my point was to created nested branches, while here it simply question of a standard branch.
The answer is most likely in the TBranch or TTree::Branch documentation.

In the code (from chatgpt ???) it is not clear how the leaves are defined and how their address is set (to the members of the muon object (struct / class ?).

I guess the class needs to be known by ROOT (included in the dictionnary).
But I did not try that, I usually split data in basic type leaves…

Cheers.
Jérôme