Dear all,
I have two 1D histograms h1 ( from 0 to 120 and bin number 14) and h2 (from 5 to 120 and bin number 19).
I want create and fill a third histogram h3 with the content of h1 from x-axis range 0-20 and the content of h2 above 20 to 120.
h1 has 14 bins from 0 to 120
h2 has 19 bins from 5 to 120
You created h3 with 19 bins from 0 to 120 … the range is fine because it include both h1 and h2 but the number of bins is problematic.
Just take bin 1 from h1 and bin 1 from h3: They do not match because h1 has 14 bins and h3 19 …
Thanks for your reply.
Let me modify my problem like this:
TH1D *h1 = new TH1D("h1","",100,0,120);
TH1D *h2 = new TH1D("h2","",100,0,120);
TH1D *h3 = new TH1D("h3","",100,0,120);//they have same bins
h1->FillRandom("pol2",1000);
h2->FillRandom("landau",1000);//just arbitrary functions
Now the question is, how to fill h3 with h1 (using its content from 0 to 20 only) and h2 (using its content from 20 to 120)?