Hello, in this macro I plot:
- I get a Th1f from a root file (hExp0)
`
TH1F *hExp0 = (TH1F *)g->Get("GePD");
`
2) I plot also other Th1f (hSim0 and hSim097) getting values from a TTree. And I bin hSim0 and hSim097 using the binning of hExp0, i.e.
TH1F *hSim0 = (TH1F*)hExp0->Clone("htemp0");
hSim0->Reset("M");
TString hString0 = TString::Format("Edep[0] >> htemp0");
t0->Draw(hString0);
...
....
...
TH1F *hSim097 = (TH1F*)hExp0->Clone("htemp097");
hSim097->Reset("M");
TString hString097 = TString::Format("Edep[0] >> htemp097");
t097->Draw(hString097,"","same");
- I get other Th1f from other root file (hBib0) and I plot it.
TH1F *hBib0 = (TH1F *)l->Get("GePD");
- I need to plot the sum hSim0+hSim097+hBib0 (i.e. hSimBib0sum)
TH1F *hSim0sum = (TH1F *)hSim0->Clone("hSim0sum");
if (!(hSim0sum->GetSumw2N() > 0))hSim0sum->Sumw2(kTRUE);
hSim0sum->Add(hSim097,1);
...
...
...
TH1F *hSimBib0sum = (TH1F *)hSim0sum->Clone("hSimBib0sum");
if (!(hSimBib0sum->GetSumw2N() > 0))hSimBib0sum->Sumw2(kTRUE);
hSimBib0sum->Add(hBib0,1);
- I need to plot the ratio between hExp0 and hSimBib0sum (i.e. ratio0).
TH1F *ratio0 = (TH1F *)hExp0->Clone("ratio0");
if (!(ratio0->GetSumw2N() > 0))ratio0->Sumw2(kTRUE);
ratio0->Divide(hSim0sum);
The problem is that hBib0 has a different binning than hExp0 (therefore also different binning than hSim0 and hSim097, because I binned hSim0 and hSim097 using the same binning of hExp0), then I can’t get sum hSim0+hSim097+hBib0 and I can’t have the ratio hExp0/hSimBib0sum.
Is it possible to assign to hBib0 the same binning of hExp0 (as I did for data from the Tree)? Or what should I do to correctly sum and divide histos with different binning?
Thanks
detsumbibratio.cpp (7.9 KB)