TTree/TChain GetEntryNumberWithBestIndex Question


I’ve found the TTree::GetEntryNumberWithBestIndex very useful in dealing with time dependent calibrations. It was another of those what doesn’t ROOT do moments.

I have one question though that I haven’t been able to easily figure out from the source / documentation that I’ve been seeing.

I want to look at the next entry in the index as a sanity check, but I wasn’t sure how to do this easily.

For example. Something like:

tree->BuildIndex(<linux second>)
tree->GetEntryNumberWithBestIndex(<linux second>)

Then I would like to look at the NEXT value in the Index to ensure that the entry I’m getting is the most appropriate calibration data to use.

Any advice with this?



You can play with TTree::GetIndex and TTree::GetIndexValues


This would be a nice thing to add, but my implementation seems to be okay without being able to run through the sorted list.

However, I have taken a look and both GetIndex and GetValues return NULL points. Am I missing something?



TTree::GetIndex and TTree::GetIndexValues has been obsolete for a while. Instead you need to look at this information directly in the index object returned by TTree::GetTreeIndex (and you may have to cast the returned pointer to a TTreeIndex or TChainIndex).