Cuts with two different ttrees

Dear experts,

I have two TTrees with different number of entries. What I would like to have a correlation between these two trees in order to plot one variable from one tree with cuts applied on a variable from the other tree.

I try to reproduce below a simplified version of what I have so far:
Double_t x1;
tree1->SetBranchAddress(“x1”, &x1);
Double_t x2;
tree2->SetBranchAddress(“x2”, &x2);
TCut cut = “x1>1.”;
TH1F *hist;
tree2->Draw(“x2>>hist”, cut);

Is there any way I can do this?

Any suggestion is highly welcomed!
Thank you in advance :slight_smile:

Hi @Ailema ,
if the two trees have different number of entries what is the association between entries in tree1 and entries in tree2?

Cheers,
Enrico