Third parameter in the function fitFunc

Dear RootTalk,
I’ve a question to fit a function. Habitually I use my fit function with only 2 parameter (x and my parameters)

double fitFunc (double xArray[], double par[])
{
double x = xArray[0];
double f = 0.;
f = myfunction
return f;
}
call by TF1* f = new TF1(“f”, fitFunc, xmin, xmax, npar);

I want to use fitFunc with a third parameter, a condition
double fitFunc (double xArray[], double par[], double mycondition[])
{
}

do you think is it possible to do that ? Can you show me the way ?

Thanks you very much

Hi,

You should make a TF1 using a functor (a C++ object) and then you can use your additional parameter as a data member of the functor object.
See root.cern.ch/root/html/TF1.html#F4 to create the TF1 from a functor object

Best Regards

Lorenzo