Merging TTrees


I have files given to me with multiple trees. Each tree contains a different block of information for each event (i.e., the trees have different branches). All trees have the same number of entries.

Is there a simple way to collapse all the trees into on output tree? I tried TTree::MergeTrees() but this seems to be expecting the same branches in each tree in the list passed to it.

The reason I want to do this is b/c, as far as I know, the TTree::AddFriend functionality does not work in a PROOF environment. At least, when I tried it, then in the TSelector::Process() I can’t see the branches from friend trees.

So right now, it looks like my only choice is to avoid parallelization altogether :frowning: or merge the trees together.



There is currently no tools to specifically collapse TTree friends into one TTree. One trick you can probably do is to make sure that all the friend trees are (separately) stored in a single file. This will insure that the Proof slave will always have access to all the friends (since they have access to the TFile where the TTree they are looking at is stored).