I am having trouble accessing a leaf within a branch using pyroot(see attached snapshot to see the tree structure). The current way I am attempting to access the leaf is by the following syntax:
tree = ifile.Get(‘tree’)
nentries = tree.GetEntries()
for ientry in range(nentries):
tree.GetEntry(ientry)
val = tree.gg_plus_ZH125_highZpt.Nominal
Where gg_plus_ZH125_highZpt is a branch and Nominal is the nested leaf in the branch.
I recieve the error: tree has no method gg_plus_ZH125_highZpt. All other branches which do not have further nesting can be accessed in this way just fine.
Is gg_plus_ZH125_highZpt a scalar structure of a container? Because if it is a container then you need to iterate on it.
tree = ifile.Get('tree')
nentries = tree.GetEntries()
for ientry in range(nentries):
tree.GetEntry(ientry)
for p in tree.gg_plus_ZH125_highZpt:
val = p.Nominal
Thanks for the reply. I attempted accessing the nested leaf as you suggest:
for p in tree.gg_plus_ZH125_highZpt:
val = p.Nominal
But I recieve the error: “tree has no attributet gg_plus_ZH125_highZpt”.
I’ve double checked that the input tree does have a branch called gg_plus_ZH125_highZpt. Any ideas why this syntax does not work?