#include "Math/AdaptiveIntegratorMultiDim.h" #include double f(double *x, double *par){ return par[0]*x[0]+par[1]*x[1]+par[2]*x[2]+x[3]; } int NumericalIntegration() { // Create the function and wrap it //TF2 f("Sin Function", "sin(x) + y", 0, TMath::Pi(), 0, 1); // ROOT::Math::WrappedMultiTF1 wf1(f); ROOT::Math::WrappedParamFunction<> wf( &f, 4, 3); wf.SetParameters(1,2,3); // Create the Integrator /ROOT::Math::AdaptiveIntegratorMultiDim ig; // Set parameters of the integration ig.SetFunction(wf1); ig.SetRelTolerance(0.001); double xmin[] = {1,0,2,0}; double xmax[] = {3,3,4,5}; cout << ig.Integral(xmin, xmax) << endl; return 0; }