Hi, I wanted to create a tree with several branches:

How do I fill the tree for variables for each event, and at the same time variables which are say a sum over one of the event variables?

Thanks Maki

If the number of such variables is small compared to the rest of the event, simply declare these variables like event variables. You will consume a bit more space in the tree.
Otherwise you can store your variables inside a “statistic” object, eg a TH1D
and at the end add this or these objects in the Tree header with eg

tree.GetUserInfo()->Add(myhist); and later when reading the Tree, retrieve this object with

TH1D *myhist = tree.GetUserInfo()->FindObject("histoname");