I've been converting some old Fortran code to C++ and I've run into a bit of a bind. There's a section that involves the cernlib function DGMLT, Gaussian Quadrature for Multiple Integration, which is defined at http://hep.fi.infn.it/cernlib.pdf
I've been scouring online and I can't find a suitable method in ROOT to replicate this process. The few examples of multiple integration functions I've found (ROOT::Math::AdaptiveIntegratorMultiDim()
and the like) don't have any code examples.
Basically, I need some sample code for multiple integration, possibly using ROOT.
Below is a snippet using AdaptiveIntegratorMultiDim::Integral
to compute multidimensional gaussian integrals with dimension
2--15:
for(unsigned int dim=2; dim<kMaxSyst; ++dim){
NdimNormal nDimNormal(dim);
ROOT::Math::Functor func(nDimNormal,dim);
ROOT::Math::IntegratorMultiDim im(func);
volNom = im.Integral(xminNom, xmaxNom);
volSys = im.Integral(xminSys, xmaxSys);
cout<<"dim = "<<dim
<<" : volNom = "<<volNom
<<" , volSys = "<<volSys
<<endl;
}
The class NdimNormal
is an N-dimensional function object,
see its definition in the full code here: gist link.
Note that AdaptiveIntegratorMultiDim::Integral
can only handle
integrals with dimension between 1 and 16. For higher dimensions you might want to consider gsl
.