Questions about fitter changing

Dear rooters,

could you clear my questions about fitter classes?

the core part of my program is quite simple:

      TH1F* counts = new TH1F("counts",
      TF1 *fitFcn = new TF1("fitFcn",
	counts->Fit("fitFcn", "MVRE");

Can I set default fitter before calling counts->Fit ? For example, what do I do if I want use SCAN method from MINUIT2 library (as written in FitPanel, tab “minimization”)?

At previous root versions I used (TVirtualFitter::GetFitter())->SetDefaultFitter(“Minuit2”);
but now (5.21.04) this changes nothing (as i can see from fitter output to console)

How do i change default fitter and fit routine in current root version?

I know about TMinuit, but TVirtualFitter is much more convenient for experiments with root :slight_smile:

Thanks in advance!

P.S. For running my program i use ACLiC but not interpreter mode.

Solution is found experimentally :bulb:
As i mentioned in my 1-st message, this code calls minuit fitter:

but when I use “+VRE” or “VRE” in “Fit” parameters it uses Minuit2 fitter.
Where am I wrong? :open_mouth:
If this is not a bug, may be you should describe this feature in details?
I hope somebody will clear this question after holidays.


if you want to use Minuit2, it is enough you set before calling the Fit method


However, if you use the option “M”, you will force to use Minuit, since this option is not available in Minuit2.

If you find a problem, try to use the latest version, 5.22, and if you still have problems, please let me now

Best Regards


Hello Lorenzo.
Your code also works.
The last questions in this topic:

  1. how do I change default minimization routine (for example, I’d like to try SCAN from minuit2 library)?
  2. can I change strategy for minuit/minuit2 fitters using TVirtualFitter object? if yes, how do I do this?

Thank you for your help!