TEfficiency with weighted events

Hello,

I hope you will help me to understand if TEfficiency can be used with weighted events:

[ul]
[li] on the one hand, the class description says: “As the efficiency can be regarded as a parameter of a binomial distribution, the number of passed and total events must always be integer numbers. Therefore a filling with weights is not possible…”
[/li][li] on the other hand, the class has method “void FillWeighted(Bool_t bPassed, Double_t weight, Double_t x, Double_t y = 0, Double_t z = 0)”[/li][/ul]

These two statements seem to contradict each other.

Could you please clarify, if one could use TEfficiency with weighted events?

Actually, I can see one more inconsistency: I do not understand why it is a problem to use weighted events, but it is NOT a problem to add TEfficiency objects - these two also seem to contradict each other. Here is an example:

Double_t x[nEvents], weight[nEvents]; Bool_t passed[nEvents]; // events
Int_t nBins; Double_t * xBins = ...; // some histogram binning
TEfficiency eff;
for(Int_t i=0; i<nEvents; i++)
{
     TEfficiency newEff(Form(eff%i,i), "", nBins, xBins);
     newEff.SetWeight(weight[i]);
     newEff.Fill(passed[i], x[i]);

     if(i==0)
          eff = newEff;
     else
          eff += newEff;
}// end of for

The code above should be equivalent to filling TEfficiency
with weighted events, and so if one can add TEfficiency objects,
then weighted events must be allowed!

Thank you,
Siarhei.

Hi,

Yes, there is support for weighted events, it has been added at a later stage, and this might explains the inconsistency in the documentation. However, keep in mind, that weighted events are an approximation and it is valid if you have a large statistics and if the spread of the weights is not too large. Also the weight distribution should be uncorrelated with the binomial process. Otherwise, you would need to take the distribution of the weights into account and make a full multi-dimensional analysis.
Also, weights are supported in TEfficiency only for the normal approximate method and for the Baysian one, but not for the frequentist interval calculation of the binomial interval (Clopper-Pearson method)

Best Regards

Lorenzo

Dear Lorenzo,

Thank you very much for your reply and the clarification :slight_smile:

I just wanted to add, that it would be very useful to add some day support for confidence intervals in the case of binomial distribution with weighted events. I understand, that reweighting of events is an approximation, but it is still a useful tool to understand/reduce disagreement between data and MC. And many particle physicists estimate/compare efficiency of their cuts for data/MC routinely.

Thank you again,
Siarhei.

Hi Siarhei,

The problem is that in case of weights the distribution is not anymore binomial. It has maybe a similar form, but it is not exactly a binomial, so I am not sure how to get the correct confidence interval in that case.
What is currently done, the interval is computed using a likelihood method in the same way the error is computed when performing a weighted fit. The procedure is explained in the F. James book, “Statistical Methods in Experimental Physics”, 2nd edition, par. 8.5.2

Best Regards

Lorenzo