Minimization of a function with non-numerical objects

ROOT people,

I am trying to minimize an arbitrary function with root. Normally the functional form one tries to minimize is something like this:

double myfunc(double *x, double *par).

However, what if you have a general function which is based on some objects? You can imagine a function which has a some internal object. In this case your function could look like this:

double myfunc(double *x, double *par, MyObject *obj1, MyObject *obj2).

Can someone point me to documentation of how I can create an instance of such a function and then find the value of x where the function is a minimum?

Thanks.

See maybe “A general C++ function object (functor) with parameters” in the TF1 class description and the ${ROOTSYS}/tutorials/math/exampleFunctor.C and ${ROOTSYS}/tutorials/math/multidimSampling.C tutorials.

This worked perfectly.

Thank you so much.