In PyROOT the branches are generally already set for you, as data members of the TTree object.
So for example:
# Assume TFile myrootfile contains a tree called mytree
# Assume the tree called mytree has a branch called foo
t = myrootfile.Get("mytree")
t.GetEntry(0)
print t.foo # This will print the value of foo in entry 0.
problem with builtin types is that the python ones are not addressable (well, technically they are, but common numbers are cached and so you risk e.g. changing the value of 0., so that isn’t recommended). You either need a double member variable in a struct (using ROOT.AddressOf; see example A.2.2) or array.array(‘d’, [0.]) from module array. I forget whether ROOT.Double works (which is an addressable type derived from the builtin Python float), but don’t think so.
Beyond that, SetBranchAddress() has been pythonized and should be able to figure out most of what you hand to it.
(Oh, and in PyPy, the neat python access runs at native C++ speed, but no-one is interested in that.)
yes, I know. And that makes one. More to the point, mgmt higher-up is not interested. So as-is and as far as I’m concerned, the message is to use C++, rather than twiddling details in python, if TTree looping performance is paramount.