Unable to read a specific leaf

I am trying to read the contents of a leaf in a TTree using python. The tree structure is shown in the screenshot.
I am attaching my code (minus preamble) below:

infile = "CalTest.root"


print("Parsing from ROOT: Starting")
tfile = ROOT.TFile(infile)
tree = tfile.Get("fTree")
nentries = tree.GetEntries()
nev = int(tfile.Get("NumberOfEvents").GetTitle())
print("Entries: " + str(nentries))
print("Simulated number of events: " + str(nev))

for ien in range(nentries):    
  en = tree.GetEntry(ien)
  nst = tree.eventSteps.GetNSteps()
  evid = tree.eventHeader.GetEventID()

  for ist in range(nst):
    st = tree.eventSteps.GetStep(ist)
    st_pID = st.GetParticleID()
    vol = st.GetSensVolID()
    en = st.GetEdep()
    print(vol)

I receive the following error:
Parsing from ROOT: Starting
Entries: 2743
Simulated number of events: 10000
Traceback (most recent call last):
File “/global/u1/a/arreme/legend-swdev-scripts/python/test_MaGe.py”, line 60, in
vol = st.GetSensVolID()
^^^^^^^^^^^^^^^
AttributeError: ‘MGTMCStepData’ object has no attribute ‘GetSensVolID’

I have tried the same code with other leaves and it works (st_pID for eg in the code). Any ideas on how to proceed?
Thank you
Aravind

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.