How NOT to fill separate branch in TTree?

I have a TTree with some branches. What if for some single entry I want to fill all branches except one chosen? How do I do this? Note that it can happen that for next entry I want to fill that branch.


ROOT doesn’t support that (unless you can live with different numbers of entries in different branches).

What you probably want to do is to have that branch store an “optional” type, e.g. T* (points to a T or nullptr), vector<T> (which is one T or nothing), or (since recent versions of ROOT) unique_ptr<T>.

Cheers, Axel.

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