Fix and releasing parameters in Minuit2Minimizer

Hi all,

I have implemented a class that loads a Minuit2Minimizer and adds variables and in the end performs a minimization. I am performing a minimization on 12 variables with very low statistics and I have noticed that if I try to minimize all 12 variables at once only 2 or 3 of tghem vary and a minimum is “found”.

Therefore I would like to minimize them one by one, fixing the rest. Looking at the Minuit2Minimizer documentation I have not found any function to fix/release existing variables, and the only way I have thought of is to recreate the Minuit2Minimizer instance each time with the fitted values. That doesn’t seem a good idea, so I am probably missing something. Anyone can help me?

Thanks,
Albert

EDIT: I wanted to post this thread in the “Stat and Math Tools” forum. Any way it can be moved?

Hi,

you can use the methods Minuit2Minimizer::SetVariable to set a free variable and Minuit2Minimizer::SetFixedVariable to set a fixed one. If the variable already exists in the minimizer, it will fix or release the existing one.

Best Regards

Lorenzo

Thanks!! As I understand from the docs, I have to provide the “initial” value for the variable, don’t I? I have to get the result from the previous fit and Fix/SetVariable…

Cheers,
Albert

Yes, you need to provide initial value and step size in case of a free variable.
For this one you should use the error from the previous fit

Lorenzo

Hi,

I am having trouble implementing this. If I do

``` fMinuit->SetFixedVariable(0, "const", 1.0); fMinuit->SetLimitedVariable(0, "const", 1.0, 0.1 , 0.8 , 1.2 ); fMinuit->Minimize()```

I get something like:

```Minuit2Minimizer: Minimize with max iterations 10000000 edmval 1 strategy 1 Number of iterations 1 ----------> Iteration 0 FVAL = 1.22733210653 Edm = 1.22733210653 Nfcn = 1 Error matrix change = 1 Parameters : Minuit2Minimizer: Minimum Found FVAL = 1.22733210652623481 Edm = 1.22733210652623481 Nfcn = 1 const = 1 +/- 0.1 ```

It looks like it is still fixed, so I think I am doing something wrong… Any ideas?

Thanks,
Albert

Yes, you are right. This does not work for a problem in Minuit2. I will fix tomorrow in the ROOT trunk

Cheers

Lorenzo

Ok, let me know as soon as this is commited so I can try to build against it, please.

Cheers,
Albert

Hi,

this is now committed for both Minuit2 and TMinuit in the ROOT trunk.
Thank you for reporting this problem
Cheers,

Lorenzo

OK, great!

Now the problem will be to compile the ROOT trunk on my Mac. I have been able to build it (without xrootd) but it breaks when I start it…