Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue accessing TTree branch directly from my Python interpreter #15

Closed
drinkingkazu opened this issue Aug 27, 2020 · 1 comment
Closed

Comments

@drinkingkazu
Copy link

drinkingkazu commented Aug 27, 2020

Getting a segfault for attempting to access TTree branch in "my usual" way:

$> python
>>> from ROOT import TChain
>>> ch=TChain("EDepSimEvents")
>>> ch.AddFile("tako.root")
>>> ch.GetEntries()
10
>>> ch.GetEntry(0)
>>> ch.Trajectories
<cppyy.gbl.std.vector<TG4Trajectory> object at 0x5b38630>
>>> ch.Trajectories.size()
8737931403336129456
>>> ch.Trajectories.at(0)
 *** Break *** segmentation violation

Maybe there's an incomplete dictionary generated for this object?
Is this not supported in edep-sim?

For a reference, data file is generated using inputs/example.gdml, also available here.
Thanks for your help!

@drinkingkazu
Copy link
Author

Resolved: apparently Trajectories is a public attribute of TG4Event object.
So the following access method works

>>> ch.Event.Trajectories.size()
>>> ch.Event.Trajectories.at(0)

... which respects the scope.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant