How can I solve this problem?

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.


but I want to do this after subtracting pedestal.

Here I can subtract pedestal as below.

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


TLeaf *l = h->GetLeaf("ch");
for(in i=0; 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?


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][0]");