Accessing friend tree branches

I’d like to use the nice iterable nature of a tree, but with friends. These friends have branches that have the same name as those in the main tree.

So what I want is something like:

tree = TTree("t", "t")
friendtree = TTree("tf", "tf")

for event in tree:
    print '{0} {1}'.format(event.x,

But this doesn’t work. Can you help please?


that’s going to take a little head-scratching. I’ll need to play with this a bit before having an answer.