-
Hi, struct stepInfo
{
Int_t StepNumber;
std::string VolumeName;
Double_t Position_mm[3];
Double_t ParticleEnergy_keV;
};
struct trackInfo
{
std::string ParticleName;
Int_t TrackID;
std::vector<stepInfo> steps;
};
std::vector<trackInfo> tracks; // TBranch Uproot can load NotImplementedError: memberwise serialization of AsArray I have seen there is an open issue #38 about ROOT memberwise splitting but i wondered if i can force the interpretation, tell uproot what the structure was e.g.: interpretation = uproot.AsDtype(....)
array = uproot_tree['tracks.steps'].array(interpretation) Is this possible? If so how do you actually go about doing this? Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
As is intended by the NotImplementedError message, this is an unsolved problem. It's not just a matter of Uproot failing to recognize the interpretation, in which case I could give you a hand-constructed Here's the central issue on the problem: #38 Here is a first step, in which @kratsg has implemented part of it: #298 And here are two unfinished drafts to go further with it: #314 and #318. If you want to look into this, you can see the raw bytes in one entry (entry uproot_tree['tracks.steps'].debug(i)
uproot_tree['tracks.steps'].debug_array(i) They have docstrings that are also available online here and here. The first is for printing out the bytes in a way that may be helpful for debugging, and the second returns the data as an uninterpreted NumPy array for programmatic access. From what you say about being able to read That's all the information that I can give you right now. Also, if you post your ROOT file here, someone might be able to help you. |
Beta Was this translation helpful? Give feedback.
As is intended by the NotImplementedError message, this is an unsolved problem. It's not just a matter of Uproot failing to recognize the interpretation, in which case I could give you a hand-constructed
Interpretation
that you could apply. It's that we don't have any algorithms written in Python that will deserialize data in that form. (Also, it's not just the fact that two structs and astd::vector
are nested: ROOT can serialize such objects without the "memberwise" option being turned on, and Uproot can read that data. It's this "memberwise" switch that we haven't figured out.)Here's the central issue on the problem: #38
Here is a first step, in which @kratsg has implemented part of it: