You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 21, 2022. It is now read-only.
There seems to be some inconsistency between the type name know to the streamer on file and the branch type when reading branches automatically created from std::pair members. I am reading a ROOT tree with a simple std::pair<Double_t, Double_t> member split into branches and get the following error:
...
File "uproot/uproot/tree.py", line 248, in _attachstreamer
KeyError: b'pair<Double_t,Double_t>'
However, a streamer for 'pair<double,double>' does exist and can be used to read the .first and .second subranches. I verified this by simply replacing 'Double_t' with 'double' in submembers[base]._fTypeName on line https://github.com/scikit-hep/uproot/blob/master/uproot/tree.py#L248 when encounter this branch.
Man, that's tough: I just get the streamer name as a string, not an object that can be broken down into components like that. In fact, I wonder why the name is different in different streamers...
To do this properly, we'd have to parse the strings as C++ and canonicalize them. (Part of why ROOT I/O needs Cling.) Fortunately, we know they're only types, which cuts out most of the language: types are identifiers, *, <...>, and [].
On the other hand, as long as it's only identifiers that are being mapped, a regular expression that matches at identifier boundaries would be valid— it could never confuse MuDouble_trigger for Double_t, for instance. It should be done once, when the streamers are loaded; that would be less dangerous than doing it in tree.py.
I'll give it a shot and point you to a branch to test. If it works for your file (and passes all the other tests), I'll include it.
There seems to be some inconsistency between the type name know to the streamer on file and the branch type when reading branches automatically created from std::pair members. I am reading a ROOT tree with a simple std::pair<Double_t, Double_t> member split into branches and get the following error:
However, a streamer for 'pair<double,double>' does exist and can be used to read the .first and .second subranches. I verified this by simply replacing 'Double_t' with 'double' in
submembers[base]._fTypeName
on line https://github.com/scikit-hep/uproot/blob/master/uproot/tree.py#L248 when encounter this branch.Is this something that can be fixed by mapping ROOT types to their C equivalents? See https://root.cern.ch/doc/master/RtypesCore_8h_source.html#l00031
The text was updated successfully, but these errors were encountered: