# TEfficiency fit function origin

I wanted to ask about the origin of the function (presumably likelihood) minimized in the TEfficiency fitting. In the code, I see these lines:

``````// binomial formula (forgetting about the factorials)
if (nNum != 0.) {
if (mu > 0.)
f -= nNum * TMath::Log(mu*nDen/nNum);
else
f -= nmax * -1E30; // crossing our fingers
}
if (nDen - nNum != 0.) {
if (1. - mu > 0.)
f -= (nDen - nNum) * TMath::Log((1. - mu)*nDen/(nDen-nNum));
else
f -= nmax * -1E30; // crossing our fingers
}
``````

What I don’t understand is the origin of “nDen/nNum” and “nDen/(nDen-nNum)” in the logarithms.

I could not find any referenced article for where this comes from and my humble derivation of the likelihood formula based on the very brief explanation of the idea behind the fit here: https://root.cern.ch/doc/master/classTBinomialEfficiencyFitter.html gives the logarithms without the quoted expressions.

Could somebody explain the origin of them to me and/or point me to the source of the implemented formulas, please?