Skip to content

Accessing custom cpp classes with uproot #1301

Answered by jpivarski
moleluca asked this question in Q&A
Discussion options

You must be logged in to vote

Uproot can't use C++ class definitions because it doesn't compile C++ code. ROOT does this either by running Cling to compile a set of C++ class definitions or by loading a library of precompiled code (.so on Linux, .dylib on MacOS, .dll on Windows). But Uproot is only Python.

If you've defined a method det on tracks.clusters that finds the clusters associated with a given track, then this matching would have to be reimplemented in Python (possibly vectorized by NumPy or Awkward Array, so that it's fast). However, that would be much easier to do if the data stored in the file were arrays or std::vectors of integer indexes, rather than full C++ objects.

>>> tree["events/tracks/tracks.clust…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by moleluca
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants