I have a root file which has two trees in it. Using pyroot I’m able to find the correct tree and cycle through the entries in the tree but I can’t access the data in the subdirectories, it gives the error:
AttributeError: 'TTree' object has no attribute 'PVeto.TMCVEvent.fHits.fTime'
The structure is as shown here:
And my current code is:
import ROOT from ROOT import TH1F, TFile, TCanvas, TTree import os MCFile = TFile.Open("BhabhaSCh100kMCDataSingleParticle.root","READ") mcTreeName = "MC" Tree = MCFile.Get(mcTreeName) print "Looking for tree named ",mcTreeName nEntries = Tree.GetEntries() print nEntries for event in range (0, Tree.GetEntries ()): Tree.GetEntry(event) PVetoT = getattr(Tree,"PVeto/TMCVEvent/fHits/fTime")
Any help would be useful. TIA