# How can I solve this problem?

Hello,
I have a question.

I want to see correlation between to channels.
I can make this plot, but I need one more step before it.

Let me explain what data I have and what should I do.

I took data with light, and without light(pedestal), so I have 2 sets of data (2 root files).
In the root file, it has one tree. and this tree has lots of branches and leaves.
Among them, one leaf is histogram array, and each array has thousands of entries(data that taken by sensor and board).
Each array has data of each channels of my sensor.

I want to see the crosstalk between two channels,
and I can do it as below.

``h->Draw("ch[0]:ch[1]");``

but I want to do this after subtracting pedestal.

Here I can subtract pedestal as below.

``````h->Draw("ch[0]>>h0");
hp->Draw("ch[0]>>hp"); (hp is another data set. pedestal.)

or

``````TLeaf *l = h->GetLeaf("ch");
for(in i=0; i<~~~~) {
l->GetBranch()->GetEntry(i);
Float_t sig = l->GetValue(0);
Float_t ped = lp->GetValue(0); (lp is another data set. pedestal.)``````

and put sig and ped in the other histogramsâ€¦
for each channels.
and then subtract it bin by bin. like:

``````for(int j=0; j~~~~) {
Float_t dsig = hsig->GetBinContent(j)
Float_t dped = hped->GetBinContent(j)``````

and get dsig - dped and put this value in another histogram. (SetBinContent(j,dsig-dped)â€¦)

but, in this case, I lost time information of the data.
At first, data was sorted in chronological order.
but subtracted data is sorted in order of magnitude.
I want to make scattered plot using subtracted, and chronologically sorted data.

How can I do this?

Hi,

One thing you can do, is to make the h and hp TTree friend of each other and Draw them together:``` h->AddFriend(hp); h->Draw("ch[0]-hp.ch[0]");```

Cheers,
Philippe.