-
Hi I am currently trying to read some ROOT files generated in Allpix² and am experimenting with
When trying to read the branch into an array I get the following error:
If I use
However, reading the array is extremly slow (~5s for ~0.5MB data). What do I need to fix in order to use For the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
If the object you want to read has pointers within it, then it does not fit in Awkward Array's type system. C++ objects are arbitrary graphs, but objects in Awkward Arrays must be trees. You may be able to read this with You can do it with PyROOT as well by giving ROOT the shared library describing the C++ classes that it should fill (libAllpixObjects.so). This is because PyROOT objects are just proxies pointing to C++ data. That makes the PyROOT solution a little different from Uproot's Uproot can't make use of any C++ libraries (like libAllpixObjects.so) because it doesn't run any C++ code. Awkward Array wouldn't be able to use it, either, because its data model is completely different from C's notion of a In the end, there isn't much that can be done with this data type because it has cross-linking pointers. Awkward Array generalized arrays beyond just numbers, but it hasn't generalized it to the extent of supporting cross-links. (There were some attempts to do that in Awkward 0.x, but they were fragile—didn't work very well—and not in high demand.) This sounds like a perfect job for Julia and UnROOT, but then your project wouldn't be "Pythonic" so much as "Julionic." (What's the right word?) Note: I don't know if UnROOT can read general data types like this one; I'm just saying that it fits the Julia type system, as Julia has an ordinary language's type system and not a specialized DSL for array programming in an interpreted language. |
Beta Was this translation helpful? Give feedback.
If the object you want to read has pointers within it, then it does not fit in Awkward Array's type system. C++ objects are arbitrary graphs, but objects in Awkward Arrays must be trees.
You may be able to read this with
library="np"
, since that turns the data into Python objects (slowly). Python objects are also arbitrary graphs.You can do it with PyROOT as well by giving ROOT the shared library describing the C++ classes that it should fill (libAllpixObjects.so). This is because PyROOT objects are just proxies pointing to C++ data. That makes the PyROOT solution a little different from Uproot's
library="np"
: since Uproot's objects are pure Python, they should be pickleable and I expect…