# How to calculate Efficiency error?

Hi, everyone

I use one detector like Scintillator, Aerogel Cherenkov counter.

When I get the total number of events N and the observed number of passed events k with cut condition, I can define efficiency.

efficiency=k/N

But I don’t know how to calculate Efficiency error.

I think TEfficiency method can calculate this, but I found method using two histogram.

If I have three data set (cut, N, k) instead of histgram.

How do I use TEfficiency and get efficincy error?

Hi,

You can call directly the TEfficiency static functions such as `ClopperPearson` for the frequentist method, where you pass the number of passed (k) and the total number (N) and it returns the upper or lower level of the interval.

For the description of the different method see the general TEfficiency documentation

Lorenzo

Thank you.

First
I tried TEfficinency::ClopperPearson as fallows

``````cout << TEfficiency::ClopperPearson(100, 100,  95, true) << endl;
``````

This return 1.
I think “true” option means upper bounary and efficiency=100/100=1.
So, This means the upper limit (error?) of efficiency is 1+1=2 ?.
I think upper boundary is zero if efficiency =0. I can’t understand this result.

Second
I can’t understand “P(x ≧ passed; total)=(1-level)/2” in document you sent.
Where does “(1-level)/2” term come from?

This is my lack of knowledge about statistics.

Hi,

The function it returns the upper value of the efficiency. In case the central value ( npassed/ntotal) is very close to 1, the upper interval value is then 1 as expected.
The upper/lower error value (computed at 68% confidence level ) are as following:

``````double efficiency = double(k)/N;
double lower_error = efficiency - TEfficiency::ClopperPearson(N, k,  0.683,  false);
double upper_error = TEfficiency::ClopperPearson(N, k,  0.683,  true) - efficiency;
``````

For the second question, `P(x ≧ passed; total)=(1-level)/2` comes from the definition of the upper interval. The probability to get a value outside the confidence interval is `1.-condidence_level`.
Then if you consider only the upper interval and by definition you want equal probability on the lower/upper side, then you divide by a factor 2.

Lorenzo

1 Like