I am filling two branches in a TTree, one with an event-wise object and one with a particle-wise object (TClonesArray). Each branch contains several TLeaf.
Everything works, but since I have to run this code over large datasets in a controlled environment, the CPU usage and the memory allocation are too high if I do it like this.
The fastest way that I was thinking to solve this in order to avoid to reconfigure all my output objects, would be not to store several TLeaf that i donāt need.
Is this possible? Basically, to keep only certain TLeaf after filling the tree (or before that).
Before reconfiguring your files, you should investigate if you actually need to read all the data, doing partial read (only a few branches) is one of the main āfeatureā of a TTree.
Thank you for your replies.
I fill each branch with an object. In the case of the track branch, the object is a TClonesArray type that has several observables in it, and when I fill the tree, this branch has several TLeaf, one for each observable.
As you suggested, I donāt need to read all the TLeaf, but I donāt want them filled at runtime neither. What I would need is to fill the branch with the same object, and what Iām looking for is a way to get rid of all the TLeaf that I donāt need, before the tree is filled.
If you know at compile time, you can actually mark of the āuninterestingā data member as being transient. (Alternatively you might be able to remove the uninteresting sub-branches from the list of branches of its parent before starting to Fill)