Plot branch with weight from other file

Hi,

i have file1.root, having a TTree. wants to plot a branch from this try and apply weight. but the weight is in the file2.root.
im stuck how to do this. or is there any way to copy the weight branch from file2.root to file1.root?

Thanks

Hi! This looks like a usecase for friend trees, which you can register with TTree::AddFriend().

There is also a tutorial about this.

I hope that helps, if not let me know!

hi thanks but i didnt get it

Which part are you still struggling with? It would be good if you are more specific so I don’t have to tell you things that you already know. For example, do you already know how to plot a branch with a weight from the same file? And how are you using that, e.g. with TTree::Draw() or RDataFrame? The answer will depend on how you are doing the plotting.

Thanks, i know the method to plot a branch with weight i.e TTree::Draw(), where both branch and weight belongs to same TTree. but im unable to apply weight when weight belongs to other tree or other root file.