You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be interesting to read files written using the rest-for-physics framework. Currently this is not possible as Uproot is unable to produce a valid interpretation of many branches. In principle, even though the TTree is writen using custom classes, the relevant branches are fully split so it should be possible to read them. They were readable in the past with uproot but this stopped working at some point (most likely due to changes in rest-for-physics).
Some branches are readable as shown in the example below, while some are not. In particular I would be interested in reading the Geant4 data from branhes such as TRestGeant4EventBranch/fTracks/fTracks.fHits.fY in the EventTree.
The Geant4 data is stored in a branch named TRestGeant4EventBranch in the EventTreeTTree. This branch is fully split. Using custom classes and dictionaries we replicated the hierarchical structure of a Geant4 simulation (Event > Track > Hit). Here is the source code for these classes.
The code snippet below uses the new fsspec url chain to open a zip file since GitHub doesn't allow uploading root files directly. It needs uproot >= 5.2.0 (currently pre-release version).
zip_urlpath = "https://github.com/scikit-hep/uproot5/files/12334414/simulation.anaylsis.zip"
root_filename = "simulation.anaylsis.root"
tree_name = "EventTree"
with uproot.open(f"zip://{root_filename}:{tree_name}::{zip_urlpath}") as tree:
print(tree.keys())
for key in ["TRestGeant4EventBranch/TRestEvent/TObject/fUniqueID",
"TRestGeant4EventBranch/TRestEvent/fSubRunOrigin"]:
branch = tree[key]
data = branch.array()
# other keys do not work (unknown interpretation)
for key in ["TRestGeant4EventBranch/fPrimaryEnergies", ]:
branch = tree[key]
data = branch.array()
I'll tag @jgalan in case he wants to follow this up.
The text was updated successfully, but these errors were encountered:
It would be interesting to read files written using the
rest-for-physics
framework. Currently this is not possible as Uproot is unable to produce a valid interpretation of many branches. In principle, even though theTTree
is writen using custom classes, the relevant branches are fully split so it should be possible to read them. They were readable in the past with uproot but this stopped working at some point (most likely due to changes inrest-for-physics
).Some branches are readable as shown in the example below, while some are not. In particular I would be interested in reading the Geant4 data from branhes such as
TRestGeant4EventBranch/fTracks/fTracks.fHits.fY
in theEventTree
.The Geant4 data is stored in a branch named
TRestGeant4EventBranch
in theEventTree
TTree
. This branch is fully split. Using custom classes and dictionaries we replicated the hierarchical structure of a Geant4 simulation (Event > Track > Hit). Here is the source code for these classes.This issue is related to #936.
The code snippet below uses the new
fsspec
url chain to open a zip file since GitHub doesn't allow uploading root files directly. It needs uproot>= 5.2.0
(currently pre-release version).I'll tag @jgalan in case he wants to follow this up.
The text was updated successfully, but these errors were encountered: