Adding two trees with weights

Hello experts,
I am trying to add two root trees from different root files using weights. I see that hadd can be used to add two root tress from different files. But I cannot put weight there. Is there any way I can add two trees using different weights?

Thank you,
Arka

Hi Arka,

do you mean “adding” branch by branch 2 trees of N entries and obtain a tree with N entries or chaining two trees of N and M entries into a third one of N+M entries?

Cheers,
D

Hi,
I like to add two trees of N entries (with weights a w1 and w2 respectively) and get a tree of N entries.
Thank you,
Arka

Hi Arka,

The easiest is to make the 2 TTree friend (see TTree::AddFriend) and to use RDataFrame SnapShot capablity to create a new TTree with the branch you want resulting from the calculation you are thinking of.

Cheers,
Philippe.

1 Like

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