8.3.2. TCIntEval and TCJitEval

These classes are generaly used when you use the cling root interpreter with Uranie. So they are not detailed here. Their documentation can be find in the C++ version of this documentation, but their uses are very similar to a TPythonEval class.

Using C function in python can be done with the ROOT cling interpreter and the TCIntEval. Suppose you have a C rosenbrock function defined in the UserFunctions.C file as follow.

void rosenbrock(double *in, double *out)
{
    double x, y, d1, d2;
    x = in[0]; y = in[1];
    d1 = (1-x);
    d2 = (y-x*x);
    out[0] = d1*d1 + d2*d2;
}

To use this function in Uranie, you need to load the script, and define the TCIntEVal (a TCJitEval does not work in python interpreter)

ROOT.gROOT.LoadMacro("UserFunctions.C")
fun = Relauncher.TCIntEval("rosenbrock")

It is also possible to simply use a C++ function in python, through the ROOT cling interpreter out of the Relauncher paradigm (for single-purpose estimation for instance). This discussion is already covered in Use a C++ function interactively.