ROOT Version: 6.06.08
Platform: Linux (Debian 9)
Compiler: g++ 4.9
I’m trying to read some custom classes from TTrees and am a bit confused about what should be happening with custom classes that contain TObjArrays and TClonesArrays.
My top level class is an Event, stored in a TTree Branch. The Event class contains a TObjArray of Trigger objects. Each Trigger in turn contains TClonesArrays of various other objects.
Right now to prevent memory leaks I have to set
TBranch::SetAutoDelete(kTrue), or else
delete my event objects between reads. I’m wondering if it’s possible to re-use the existing objects when reading entries from the file. I’ve tried defining and calling
Clear functions that deallocate heap objects and clear the TClonesArrays, but it seems the next
GetEntry still default constructs a new TObjArray of Triggers, rather than using the existing one.
I have read through the guides, the class reference, tutorial scripts and past threads (i see TClonesArray use come up a lot!) but sadly I still don’t have a clear idea of whether this is possible, or if so, how to achieve it.