Hi forum,
I am making an efficiency turn-on plot, and I want to see the error bars. I am using the following code
TH1F *h1= new TH1F ("h1", "h1", 125, 0, 250);
TH1F *h2= new TH1F ("h2", "h2", 125, 0, 250);
h1->Sumw2();
h2->Sumw2();
Tree->Draw("met.metcorr>>h1", trigger&&offline);
Tree->Draw("met.metcorr>>h2", offline);
gr = new TGraphAsymmErrors();
gr->BayesDivide(h1,h2,"w");
gr->SetMarkerColor(4);
gr->SetMarkerStyle(7);
gr->Fit(fcurve,"R");
The problem is that even for points where the ratio of the two is 1, the error bars go above 1.0. What would the procedure be to get the errors right (the efficiency cannot be more than 1.0)? I add an example *ps file to show what I mean.
Thank you! l1-turnon.ps (1.66 MB)
For a discussion about the way the errors are computed in TGraphAsymmErrors::BayesDivide, see the publications/papers indicated
in the documentation of this function.
and in the code, see the special cases:
//If either of the errors are 0, set them to 1/10 of the other error
//so that the fitters don't get confused.
if (low==0.0) low=high/10.;
if (high==0.0) high=low/10.;
if (high+mode > 1) high = 1-mode;
I can imagine that if hnum[i] = 0 and hden[i] > 0 the corresponding high error will decrease when increasing hden[i] (6-9 bins), but why does the error go up from 0.00431203 to 00432134 when moving from hden[i] = 4733 to hden[i] = 7117 events (9-10 bins)?
Why does the high error change even if hnum[i] = hden[i] = 0 (0-5 bins)? Why is it stable for 44-45 and 46-48 bins, but with a different value between the two ranges?
Why do I get an ErrorY = ErrorYlow = ErrorYhigh = -1 (8.5267e-312) even if the hnum[i] = 0 and any hden[i] value as in the first bins (49-60 bins)?
Hi,
I agree this doesn’t seem to make sense. Perhaps something is funny with your histograms. Could you post a root file containing them?
Cheers, Andy.
PS - sorry for the delay… I was waiting for my roottalk account and everyone was busy at CHEP, I think.
Hi,
as about 1 month has passed and these where example histos, I am not sure I can exactly reproduce them. At least not immediately.
But because of the output I add in the previous post (2nd and 3rd entries of the cout)