-
Hi.
I attach both the script and the input file. Any help would be much appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
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 >>> tree["events/tracks/tracks.clusters"].typename
'std::vector<Tracking::Cluster>[]'
>>> tree["events/tracks/tracks.clusters"].interpretation
AsObjects(AsArray(True, False, AsVector(False, Model_Tracking_3a3a_Cluster), ())) Instead of |
Beta Was this translation helpful? Give feedback.
-
Hi.
Thank you for the prompt and detailed response.
Best regards
…On Tue, 24 Sept 2024 at 17:26, Jim Pivarski ***@***.***> wrote:
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.clusters"].typename'std::vector<Tracking::Cluster>[]'>>> tree["events/tracks/tracks.clusters"].interpretationAsObjects(AsArray(True, False, AsVector(False, Model_Tracking_3a3a_Cluster), ()))
Instead of std::vector<Tracking::Cluster>[] (which has been serialized in
a format Uproot doesn't recognize, #38
<#38>), if you had
std::vector<std::vector<int>> where the integers are positions of the
clusters in their arrays, then it would be easier to write that logic as an Awkward
Array slice
<https://awkward-array.org/doc/main/reference/generated/ak.Array.html#ak.Array.__getitem__>
on the Python side.
—
Reply to this email directly, view it on GitHub
<#1301 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALEDZGCKJ3XXFYOQTK3WD6TZYGAEDAVCNFSM6AAAAABOYOB47WVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTANZUGA3DQNI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
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
ontracks.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 orstd::vectors
of integer indexes, rather than full C++ objects.