Friend trees and Skimming

Dear Experts,
I have the following use case:
I have a tree with many branches. I need to recompute some of these branches based on a given systematic variation.
To save space I’m saving only the modified branches to a new tree (let me call this systematic tree) and then loading the original tree as its Friend to access also the unmodified branches.

Now, I need to skim events and save them to a new smaller tree.
Running on the systematic tree and its original friend I select events and write out a skimmed version of the systematic tree.

I was expecting the need of using a TEventList to sync the skimmed systematic tree and the unskimmed original, given they have different number of entries.
However if I simply add the original unskimmed tree as friend of the skimmed systematic tree, I seem to be getting exactly what I expect, the two seem to be in sync.
Is this expected? How is the syncing achieved internally (or maybe I’m just doing something wrong.)
I’m using root 6.06.


Hi Giulio,

I’m not sure to really understand what you describe here, but maybe @pcanal or @Axel can give their opinion…

Cheers, Bertrand.


Please check whether your skimmed tree already contains the friend’s branches. Depending on how you do the skimming this might well be the case.

Cheers, Axel.

Hello Axel,
the skimmed tree has some of the branches of the friend unskimmed tree. Is this what you ask?
Let me clarify when I say skimming I mean cutting events, not branches.

Well - but then you have the skimmed the original friend tree, too, and you don’t need to friend the original friend anymore!

What am I misunderstanding? Maybe it would help if you could either upload file with the trees (original, friend skimmed) or at least post the TTree::Print() output of all three of them.

Cheers, Axel.

Dear Axel,
thanks, I have been revising my code and understood I was doing something wrong. But Still I have a question.

Suppose I have a small tree (fewer entries) derived from a larger tree (more entries) and a TEventList which tells me which entry of the long tree are selected in the small tree.
How can I make the large tree friend of the small tree?

I found that doing:
skimmedLargeTree = largeTree->CopyTree(“1”)

works, but involves a copy of the large tree.
Is there a way to achieve what I want without the CopyTree call?


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.