Restrict Fit Parameters

Hi!

I’m trying to fit a self-defined function (say f) to a data set (TGraphErrors). The function has two parameters, say, p1 and p2.
I want to allow all values of p1 and p2 which are greater than 0, and in addition to that, I want to require p2 > p1.
How can this be done with ROOT?
I am aware of the TF1::SetParLimits() function, but I’m not aware of a possiblity to define a dynamic limit that depends on the other fit parameter.

Any suggestions greatly appreciated.

Regards,
Carsten

Hi,

Defining a contraint on the parameter as a function is not possible. For simple cases a possible solution is to redefine the parameters, for example in your case p2 > p1 you can re-define p2 as p3 = p2-p1 and use p3 > 0

Lorenzo