Retreiving variable length arrays from Trees


I want to be able to retreive a variable length array from a tree. Currently I just create a very large buffer for the array, read the branch into that, and use another branch in the tree to tell me how much of that buffer was filled.

I’m wondering if anyone can think of a tidier way of doing this… is it possible to retreive the branch storing the array size in advance, so I can make sure I allocate a large enough buffer, or read the array into an STL vector, for example?

You can always retrieve the value for the index before hand (using TBranch::GetEntry). You can also retrieve the leaf for the index (if there is one) and call GetMaximum to get the maximum value of the index in the whole tree.