Hello,
I’m trying to use the GSLMCIntegrator class with root 5.26/00d. I call the Integral function with:
double result = integrator->Integral(integrand, ndim, xmin, xmax, params);
but when I print the dimension variable from inside my ‘integrand’ function , it’s always zero. Looking at this function:
void GSLMCIntegrator::SetFunction( GSLMonteFuncPointer f, unsigned int dim, void * p )
{
// method to set the a generic integration function
if(fFunction == 0) fFunction = new GSLMonteFunctionWrapper();
fFunction->SetFuncPointer( f );
fFunction->SetParams ( p );
fDim = dim;
}
fFunction never gets assigned the dimension variable. If I modify the function to be:
void GSLMCIntegrator::SetFunction( GSLMonteFuncPointer f, unsigned int dim, void * p )
{
// method to set the a generic integration function
if(fFunction == 0) fFunction = new GSLMonteFunctionWrapper();
fFunction->SetFuncPointer( f );
fFunction->SetParams ( p );
fFunction->SetDim ( dim ); // <---added this line
fDim = dim;
}
and recompile root, the dimension is received when my function is called. Is there another way to have the variable passed correctly, or do I have to stick with my recompiled version to have access to the variable? Or perhaps I could just access it using the void* params…
Thanks!
-Aaron