How to analyse two different branches of two different trees

Hello,

I want to analyse two branches of two different trees with the same branch name.

Analysis of 2 Trees e.g Tree_1, Tree_2. Where, Tree_1 has branches like A1, A2, B1, B2 and Tree_2 has branches like A1, A2, B1, B2. If I want to Analyse (“A1:A1”) then how to do it? Here I want to analyse two different branches of two different trees with the same name.

How is it possible in ROOT?

Thank you in advance.

[quote=“Pree”]Hello,

I want to analyse two branches of two different trees with the same branch name.

Analysis of 2 Trees e.g Tree_1, Tree_2. Where, Tree_1 has branches like A1, A2, B1, B2 and Tree_2 has branches like A1, A2, B1, B2. If I want to Analyse (“A1:A1”) then how to do it? Here I want to analyse two different branches of two different trees with the same name.

How is it possible in ROOT?

Thank you in advance.[/quote]

If you know, how to analyse a branch in a tree, what’s your problem with branches from two trees???

You can make the trees friends to each other:

{
   TFile *f1 = TFile::Open("file1.root");
   TTree *T1 = (TTree*)f1->Get("T1");
   T1->AddFriend("T2", "file2.root");

   TCanvas *c = new TCanvas("c", "c", 0, 0, 800, 800); 
 
   T1->Draw("v01:T2.v01");
}

Thanks.