TEfficiency::Fit option S not working?

Hi,

I am trying to get a TFitResultPtr from fitting a TEfficiency object.
I am calling
e11_5051->Fit(f2,“S”);
but it returns zero.
Other options (i.e. I or V) seem to have an effect, it’s just S that is not working.

any idea why this is happening?

Tried it in several versions of root, latest is 6.06/02

Thanks,
Yuri

Can you post a small example reproducing your problem ?

Well, it’s just this. I have a TEfficiency object e11_5051 ( and as you can guess from the name, many like it). It looks fine, the errors are ok and the fit is correct. It’s just that when I call

e11_5051->Fit(f2,“S”);

It returns zero.
I can make the fit different with “I” option, so some parameters get through.
Just not “S”.

I can send a root file and the .C file that is my function f2, but the problem should be reproducible in one line. Would you like me to do that, nonetheless?

-y

Ok, I told the expert in that area. He will have a look and let you know if he needs more details.

OK, I made a standalone example, inspired by the description of the TEfficiency class:

TEfficiency* pEff = new TEfficiency("eff","my efficiency;x;#epsilon",20,0,10);
TRandom3 rand3;
double x;
for(int i=0; i<100000; ++i){ x = rand3.Uniform(10); pEff->Fill(rand3.Rndm()<TMath::Gaus(x,5,1),x);}
pEff->Draw();
TF1 * f1 = new TF1("f1","[0]*exp(-0.5*(x-[1])*(x-[1])/[2]/[2])",0,10);
f1->SetParameter(0,1);
f1->SetParameter(1,5);
f1->SetParameter(2,2);
pEff->Fit(f1);
pEff->Fit(f1,"I");
TFitResultPtr rr = pEff->Fit(f1,"S");
rr.Get();

Hi,

Yes, option S is not yet implemented for TEfficieny. Since it is trivial to add, I will do it now.
If you need, as workaround you can use the TBinomialEfficiencyFitter class which is used inside TEfficiency

Thank you for reporting this issue

Best Regards

Lorenzo

Thanks, Lorenzo.

Can you give me a quick line of how to instantiate TBinomialEfficiencyFitter class for my purposes?

oh, never mind. I guess you just want me not to use TEfficiency and use TBinomialEfficiencyFitter directly. I see examples of that on the web pages.

Hi,

The fix for TEfficiency is available in the master.
For using TBinomialEfficiencyFitter, just see the implementation of TEfficiency::Fit
https://root.cern.ch/doc/master/TEfficiency_8cxx_source.html#l02336

Cheers

Lorenzo

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