Hi Cesar,

Yes, Minuit is a fantastic tool to minimize functions and of course it can handle

constrains on the fitting parameters.

Generally speaking it is used by several ROOT classes, like the TH1,2,…

to fit functions to data distributions by minimizing a sum of squares (chisquare, Gaussian data scatter) or a log likelihood function determined by counting/Poisson statistics. These convenient class interfaces do not allow parameter constrains. In that case you will have to define your own function that has to be minimized.

Have a look at a tutorial that uses from the TMinuit class the SetFCN() function, like for instance fit2dHist.C .

In this example a function called “myFCN” is declared and its value is further on minimized as a function of some parameters.

So how to build in constraints ?..

Sticking to this histogram example the function to be minimized is a sum of squares of the difference between the data and a function:

chi2_unconstr = Sum_i=0^n (y_i - f(x_i,a_j))^2 where a_j=0,m are the parameters to be fitted.

In case your parameter constrain can be expressed in a functional form like:

g(a_j) = c, where g is some arbitrary function and c a constant,

You can install this parameter constrain through a Lagrangian multiplier in your fit

chi2_constr = chi2_unconstr + lambda (g(a_j)-c)

So redefine your function with this new fitting parameter lambda. If you have more constraints just add more parameters.

If your constrain has the form g(a_j) <= c, you will enter more difficult territory. If the function to be minimized is quadric in the parameters a_j you can use the quadratic programming implementation in ROOT, see the tutorial portfolio.C

-Eddy