# ROOT::Math::Minimizer

In my data analysis, I am performing a multidimensional chi-squared minimization. I am trying to fit multiple spectra simultaneously with many different simulated components and am using the ROOT::Math::Minimizer class. I have a few questions regarding this class.

1. What does ROOT::Math::Minimizer:Scan do and how do I call this method? I looked at the documentation page at root.cern.ch/root/htmldoc/ROOT_ … mizer.html, but do not find this particularly helpful. The method call is Scan(unsigned int ivar, unsigned int& nstep, double* x, double* y, double xmin = 0, double xmax = 0). From using other methods in this class (such as SetLimitedVariable), I understand that ivar is the component number but I do not understand what the other variables are. Can someone please explain to me what these variables are, and why xmin and xmax are set to 0 by default. Also, what is the purpose of the Scan method? If you use Scan before the Minimize method, does this make the minimization faster?

2. From what I have read in other threads (for example, the second post in Step size in Minuit, again), the step size you assign a variable is only a rough estimate and that MINUIT will find the optimal step size as the minimization proceeds. I think I already confirmed this for myself in my analysis by printing the parameters during each step of the minimization. For example, all my components start at value 0.5 and have a step size of 0.001. At the beginning of the minimization, for a given component, the first parameter variation would be 0.501, then 0.499, then 0.510047, then 0.0490047, and then the variation would occur for the next parameter. Since 0.510047 and 0.0490047 are different than the step size of 0.001, MINUIT only used 0.001 as a rough estimate. Is this correct?

3. I have noticed that sometimes the minimizer status (ROOT::Math::Minimizer:Status) is 4, which means the minimizer reached its call limit. However, in my script, the number of function calls when initializing the minimizer (ROOT::Math::Minimizer:SetMaxFunctionCalls) is greater than the number of function calls to reach the minimum (ROOT::Math::Minimizer:NCalls) when the minimization is complete. As a real example in one of my minimizations, SetMaxFunctionCalls was 100000000 while NCalls was 647948. The fitting parameters at the end of minimization are very good though and give excellent results with the spectra I am trying to fit. Why is there a discrepancy between ROOT::Math::Minimizer:Status, ROOT::Math::Minimizer:SetMaxFunctionCalls, and ROOT::Math::Minimizer:NCalls?

In case this helps, I have included the following summary after one of my minimizations.
Elapsed Time: 68239 seconds
Number of fit spectra: 3
Number of components: 233
Free and constrained variables: 233
Free variables: 233
Minimizer: Minuit
Max Iterations: 100000000
Max Function Calls (input): 100000000
Max Function Calls (actual): 647948
Tolerance: 0.001
Error Definition: 1
Estimated Distance To Minimum: 1.84234
Status: 4
Minimum Value: 13356.7
fglobal_chi2: 13356.7
fglobal_nBins: 12509

1. I have read many times that the following statement is true: "The minimization will stop when the estimated distance to the minimum is less than 0.001tolerance." However, I do not find this to be the case. Indeed, looking at the output from the above, 1.84234 is not less than 0.001(0.001). For a less complicated fit (again, the results are excellent in terms of fitting spectra), part of the output is
Elapsed Time: 26225 seconds
Number of fit spectra: 1
Number of components: 233
Free and constrained variables: 233
Free variables: 233
Minimizer: Minuit
Max Iterations: 100000000
Max Function Calls (input): 100000000
Max Function Calls (actual): 583330
Tolerance: 0.001
Error Definition: 1
Estimated Distance To Minimum: 0.000498942
Status: 4
Minimum Value: 6612.79
fglobal_chi2: 6612.79
fglobal_nBins: 6322
Again, 0.000498942 is not less than 0.001*(0.001). Can anyone explain this to me?

2. What does ROOT::Math::Minimizer:SetPrecision do? I have not set this in my script and have obtained good results, so I think I am safe with not setting this. I did an experiment with trying different values for the precision from 1e-1 to 1e-20 and the results did not change. Is this a normal experience?

3. Suppose I have a successful minimization, and obtain the parameters and errors using ROOT::Math::Minimizer:X and ROOT::Math::Minimizer:Errors, respectively. Now suppose in my analysis I need to normalize the parameters to unity. Would I be correct in using standard error propagation in determining the error associated with the normalized parameters? That is, would the error associated with, say, parameter 1 be calculated as

(error of normalized parameter 1) = ( (unnormalized parameter 1) / (sum of unnormalized parameters) )*SQRT(((error of unnormalized parameter 1)/(unnormalized parameter 1))^2 + ((error of the sum of unnormalized parameter errors)/(sum of unnormalized parameters))^2)

where (error of the sum of unnormalized parameter errors) = SQRT( (error of unnormalized parameter 1)^2 + (error of unnormalized parameter 2)^2 + …)

1. How are the errors obtained from ROOT::Math::Minimizer:Errors calculated and how are they related to other methods, such are ROOT::Math::Minimizer:GetMinosErrors?

Sorry for so many questions. Since they are all related to the ROOT::Math::Minimizer class, I thought collecting them all in the same thread would be appropriate. Thank you for any help.

1 Like

Hi,

our math expert is unavailable at the moment. We will come back to you as soon as he will be online again.

Cheers,
Danilo