TEfficiency Bayesian Calculations

Dear Root Authors,

I’m trying to understand how the TEfficiency class handles weighted events, in particular how the Bayesian posterior distributions of the efficiency are calculated. There seem to be some inconsistencies between the documentation describing how this is done and the actual code.

According to the documentation, this is the posterior distribution:

Screenshot from 2022-11-03 09-12-53

I managed to derive this myself fairly easily from some of the other formulae in the documentation. This does not behave the way I would expect, increasing the number of events has no effect on the shape of the distribution (it should get narrower as more events means a better estimate of your efficiency).

Looking at the code, the above isn’t the function that’s actually used, this is:

Screenshot from 2022-11-03 09-31-47

This behaves the correct way. Please explain/point me to an explanation of how this is derived.

See lines 2630-2650 of TEfficiency.cxx for where this is coded up in root.

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided

Hi @cjt00 ,

thank you for bringing this up, I think we need @moneta to reply, let’s ping him.


The first formula above is not correct, since it does not take into account the normalisation of the weights. You have:

a = alpha + k
b = beta + n-k

where k is the number of passed events. In case of weighted events what counts is the effective number of entries passed and total.
So the k to be used in the formula for the posterior should be : k = epsilon_obs * N_effective.
From the formula for the number of effective entries (see here) you get this second formula above.


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.