I am slowly changing my old habits from accessing my TTrees through TTree::SetBranchAddress/… to using this nice TTreeReader object introduced in recent ROOT versions.
However, some of the trees I am using nowadays contain array-type leaves indexed by an unsigned int: e.g.
Unfortunately, it seems I cannot access them using a TTreeReaderArray (which I believe expects the index to be a signed int):
[quote]Error in TTreeReaderValueBase::CreateProxy(): The branch value_branch contains data of type unsigned int. It cannot be accessed by a TTreeReaderValue
[/quote]
I was wondering whether it was possible to somehow specify the index type, or if this feature is still to be implemented/if I need to revert to the old accessing method for this specific set of trees/if I need to reproduce all my trees using signed-int indexed branches?
great to hear you are migrating your various analysis and data processing setups to TTreeReader!
As you noticed, TTreeReader imposes correctness of types read: if you store in a branch an integer, you will be forced to read it with a TTreeReaderValue templated with “int”. This is by design: we want to avoid ambiguities (and bad segfaults) when reading a tree.
For what concerns reading arrays or collections an opportunity would be also to leverage the TTreeReaderArray class (root.cern.ch/doc/v606/classTTre … Array.html).
In ROOT 5, the “variable size of the array” MUST be a 32 bit “signed integer” leaf (an “Int_t”).
Probably the same holds in ROOT 6 (I guess Philippe would need to comment on this issue).
I do not think this (and previous) comment is related to the original post but the situation is analogous in ROOT6: the size of a variable size array is expressed by an integer.
(But actually, silently, we accept unsigned sizes. I have an unmerged branch on my disk that’s trying to fix that for the TTreeReader. All that’s missing is a test and time…)