TTreeIndex limits


We are using ROOT v5.18.00c, soon to upgrade to v5.20. We make use of TTreeIndices, where our major index is an unsigned int, and the minor index is also an unsigned int My uneducated read of TTreeIndex is that even though signed values are used to construct the index, we would still produce useful values in this case. Correct?


yes it should work


I am not yet so sure.

Let’s assume a TTree with a minor branch which is of type UInt_t.
And let’s consider the event id 4294967295 (which is -1 if interpreted as a Int_t).

When the index is build, our unsigned int values are first becoming doubles, before they are tranformed into Long64_t. Ok. Our 4294967295 will stay 4294967295.

BUT, when one want to retreive the event and call TTreeIndex::GetEntryNumberWithIndex(),
our 4294967295 is going through the parameter “minor” of type Int_t, where the value becomes -1, and stay -1 when finally transformed into a Long64_t…

Am I wrong ?

Hi David,

You read of the code is correct …



Well, perhaps I can just out and out ask if upcoming versions of ROOT could provide a new abstract class (or extend the existing TVirtualIndex) to support the possibility of major and minor indices which are unsigned int, and perhaps provide for ULong64. In fact, in our case, our major index (our run id) is an unsigned int, but our minor index (an event id within a run) may extend over 32 bits, and it may be stored in a ULong64.

We truly require indices that will work with TChains, and as David has pointed out to me, and as TChainIndex’s own documentation states:
"All the index values in the first tree of the chain must be less then any index value in the second one, and so on."
So if we start dealing with negative values in some cases, we are going to run into trouble.

We are very reluctant to develop an indexing scheme outside of the TVirtualIndex classes, as we will lose the benefits that the TTreeIndex class offers as it is integrated so nicely in the TChains and TTrees.

Do you have any suggestions? A small glimmer of hope would be appreciated right now :slight_smile: