Tolerance for TH1::Fit() interface

Is there any way to set Minuit tolerance when simply using TH1::Fit(). not calling minuit directly or through MinuitMinimizer? I can see SetPrecision for TVirtualFitter, but no SetTolerance…

Hi,

TVirtualFitter::SetPrecision refers actually to the tolerance. So you can use it for setting the tolerance, or you can use also, ROOT::Math::MinimizerOptions::SetDefaultTolerance(tol)

Best Regards

Lorenzo

[quote=“moneta”]Hi,

TVirtualFitter::SetPrecision refers actually to the tolerance. So you can use it for setting the tolerance,
[/quote]

As far as I understand, SetPrecision is for SET EPS - numerical accuracy that is determined by minuit. While tolerance is used in calculation of required EDM: 0.001*[tolerance]*UP. I uinderstand that EPS has general impact on fitting, but could you explain where in this formula for EDM EPS is being used?

I am not sure how to make results of this setting work for TH1::Fit(); I tried:

	ROOT::Math::MinimizerOptions::SetDefaultMinimizer("Minuit");
	ROOT::Math::MinimizerOptions::SetDefaultTolerance(10);
	ROOT::Math::MinimizerOptions::SetDefaultMaxIterations(50);

Than I perform a standard TH2D::Fit() with TF2. I can see that MaxIterations set in this way are not respected. They are respected however if I set them with TVirtualFitter. Should I somehow tell TVirtualFitter to make use of MinimizerOptions settings?

Hi,

TVirtualFitter::SetPrecision is equivalent to MinimizerOptions::SetTolerance and it is the tolerance value passed as second argument to MIGRAD
(see wwwasdoc.web.cern.ch/wwwasdoc/minuit/node18.html)

TVirtualFitter::SetMaxIterations is equivalent to MinimizerOptions::SetDefaultMaxFunctionCalls and is the maxcalls value passed as first argument to MIGRAD (i.e. maximum number of function calls)

In addition MinimizerOptions implements also SetPrecision which is equivalent to “SET EPS”. MinimizerOptions::SetMaxIterations does not work for Minuit because there is no API to set it. It will work for eample if you use a GSL minimizer

Best Regards

Lorenzo

[quote=“moneta”]Hi,

TVirtualFitter::SetPrecision is equivalent to MinimizerOptions::SetTolerance and it is the tolerance value passed as second argument to MIGRAD
(see wwwasdoc.web.cern.ch/wwwasdoc/minuit/node18.html)

In addition MinimizerOptions implements also SetPrecision which is equivalent to “SET EPS”.[/quote]

Thanks! Now I understand how it works. However, SetPrecision in one place seting tolerance and in the other place seting EPS may be a little misleading - one would expect in both cases that SetPrecision does the same. Perheps in TVirtualFitter it should also be called SetTolerance? Or at least something should be mentioned in docs :slight_smile:

Hi,

I agree this is a bit misleading, but the class is old and I don’t want to change the behavior for many user. I will update the documentation to make this clearer

Lorenzo