#include #include #include using namespace ROOT::Math; inline double Ball(const double* x) { const double r = sqrt(x[0] * x[0] + x[1] * x[1] + x[2] * x[2]); if (r > 1.0) return 0; return 1.0; } void testIntegral() { WrappedMultiFunction<> func(Ball, 3); const double R = 1; double a[3] = {-R, -R, -R}; double b[3] = {R, R, R}; cout << "exact : " << 4.0 * TMath::Pi() / 3.0 << endl; #define Run(x) \ { IntegratorMultiDim ig(func, IntegrationMultiDim::x, 1e-9, 1e-9) ; cout << #x << " : " << ig.Integral(a, b) << " , error: " << ig.Error() << endl; } Run(kDEFAULT); Run(kADAPTIVE); Run(kVEGAS); Run(kMISER); Run(kPLAIN); }