Reopening file and adding more entries to a TTree


There are sometimes user cases, when one doesn’t want to write the whole tree down in a single session, but reopens the file, adds new entries, writes the tree again to the file. The problem is, that at the creation of the TTree one uses Branch(), while for adding entries, one needs to call SetBranchAddress() for all the branches. Is there a way to conveniently reuse the TTree creation routine? Branch() also sets branch addresses, so it does everything (and slightly more) that is needed in the TTree update routine.

Perhaps Branch() could just call/mimic SetBranchAddress if the branch already exists?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.