Dear all,
I want to use ROOT::Math::IntegratorMultiDims to integrate a 2D function, and then in specific with vegas.
There are some things that I am trying to understand, but fail to do so.
My testing code looks like this:
#include "Math/IntegratorMultiDim.h"
#include "Math/Functor.h"
double f2(const double * x) {
return x[0] + x[1];
}
int integralTest() {
const double RESULT = 1.0;
const double ERRORLIMIT = 1E-3;
int status = 0;
ROOT::Math::Functor wf(&f2,2);
double a[2] = {0,0};
double b[2] = {1,1};
ROOT::Math::IntegratorMultiDimOptions opt2;
opt2.SetIntegrator("VEGAS");
opt2.SetDefaultNCalls(200000);
opt2.Print();
std::cout << "Extra options: " << opt2.ExtraOptions() << std::endl;
ROOT::Math::IntegratorMultiDim ig2(ROOT::Math::IntegrationMultiDim::kVEGAS);
std::cout << ig2.Name() << std::endl;
ig2.Options().Print();
// ig2.SetOptions(opt2);
ig2.Options().Print();
ig2.SetFunction(wf);
double val = ig2.Integral(a,b);
std::cout << "VEGAS: integral result is " << val << std::endl;
status += std::fabs(val-RESULT) > ERRORLIMIT;
return status;
}
The default settings for the integrator are
Integrator Type : VEGAS
Absolute tolerance : 0
Relative tolerance : 1e-09
Workspace size : 100000
(max) function calls : 100000
And when I change the DefaultNCalls of the options, this works fine. This then also shows up when I request ig2.Options().Print() from the integrator. However, when I try to load it the options with ig2.SetOptions(opt2), then it reverts back to the default settings. Does anyone know why that is?
Then ig2.Options().Print(); also shows VEGAS specific options, being
VEGAS specific options :
iterations : 5
mode : 1
stage : 0
verbose : -1
alpha : 1.5
By default.
How do I change my integrator specific options? I thought I would have to do opt2.ExtraOptions()->Print(), but opt.ExtraOptions() returns a null pointer.
Any help would be appreciated.
Cheers,
Cas