Dear ROOTers,
I am trying to use the TEfficiency class (ROOT 5.28.00) to parametrize a trigger efficiency as a function of two variables
Unfortunately there is no TEfficiency TH2 constructor such as
but I managed to use
Suppose hNL1 is the TH2D histogram corresponding to the “passed” events and hDL1 to the “total” ones, I tried the following:
TEfficiency *tEL1 = new TEfficiency("tEL1", "", hNL1->GetNbinsX(), hNL1->GetXaxis()->GetXmin(), hNL1->GetXaxis()->GetXmax(), hNL1->GetNbinsY(), hNL1->GetYaxis()->GetXmin(), hNL1->GetYaxis()->GetXmax());
for (Int_t i = 1; i <= hNL1->GetNbinsX(); ++i) {
for (Int_t j = 1; j <= hNL1->GetNbinsY(); ++j) {
tEL1->GetPassedHistogram()->SetBinContent(i, j, hNL1->GetBinContent(i, j));
tEL1->GetTotalHistogram()->SetBinContent(i, j, hDL1->GetBinContent(i, j));
}
}
While using CINT everything is fine, if I try to compile this lines I get the following error
which as far as I can understand is due to the fact that GetPassedHistogram() and GetTotalHistogram() return a const object that I cannot modify
My first question is how can I solve this problem? How can I easily create a 2D TEfficiency starting from two TH2D histos?
Next, why there is no 2D TEfficiency constructor?
Moreover, even if the TEfficiency class as it is now can be used to create 2D and 3D objects, why there is only a GetEfficiency(Int_t bin) method and not GetEfficiency(Int_t binx, Int_t biny) and GetEfficiency(Int_t binx, Int_t biny, Int_t binz) ones as well? I know I can use GetBin(Int_t binx, Int_t biny, Int_t binz) to retrieve the global bin number and this is working, but it would be handier
Last question, as I mentioned earlier when using CINT the lines I wrote are working but when I draw the 2D TEfficiency object as tEL1->Draw(“colz”) X and Y axis doesn’t correspond to the created ones according to hNL1 but both ranges goes from 0 to 1
How is that possible?
Thanks,
s.