Closed tamasgal closed 5 years ago
Discussed offline—the conclusion was that the above is a good way of dealing with complex C++ hierarchies that can't be easily (or can't be?) derived from streamers. We didn't find, for instance, anything in TStreamerLoop
that indicated the data should have "pmt"
, "tdc"
, and "tot"
fields.
So not wacky an inefficient! Cheers!
Thanks Jim!
Btw. during the live terminal session you could actually retrieve that superframes has frames and frames have numberOfHits
JDAQHits
.
So I think that maybe providing some kind of message that "JDAQHits structure is required to parse ..." could be helpful in future. But that's just a comment if we pick this issue up again ;)
This is a follow-up on https://github.com/scikit-hep/uproot/issues/407
The main problem is a branch which cannot be parsed automatically and has a streamer called
TStreamerLoop
.I managed to access all the data I need, but it's far from optimal from the users point of few: I need
uproot.asdebug
and additional information about the underlying data structure which needs to be hardcoded.Here is a complete script which is running
uproot v3.10.12
and parses a ROOT file from https://github.com/KM3NeT/km3io/blob/master/tests/samples/jpp_v12.0.0.rootA bit of background information: the data of interest is in the
vector<KM3NETDAQ::JDAQSuperFrame>.buffer
branch and consists of a ragged array ofJDAQHits
which is a simple struct:The actual script with explanations:
As seen, all branches are parsed correctly but the the
.buffer
, which has aTStreamerLoop
streamer.295464 bytes
-6 bytes
offset (don't yet understand why 6, but it works) give295458 bytes
of rawJDAQHit
data, which makes sense, since we know that we have49243 hits
and49243*6 == 295458
Now to parse the data, I extract a flat array of hits and manually slice it into a dictionary
So the problem is now, that it's a flat array of hits, however, they should be grouped the module ID
.numberOfHits
and.id
tells us more:Now the fun part: the first set of hits belong to module (
.id
) ==806451572
, and consists of984 hits
Here is an inefficient loop to fill the hits:
Perfect! But a bit "whacky" and inefficient ;) I am not so familiar with [jr]agged arrays yet, but I am sure one can somehow pass this this structure to the flat array and get it in one shot or something like this? The module IDs are then just encoded by the index and one need another lookup in
.id
or so...