diff --git a/src/external/BMWtools/BMWIntegrator.h b/src/external/BMWtools/BMWIntegrator.h index b97cb779..a99c7092 100644 --- a/src/external/BMWtools/BMWIntegrator.h +++ b/src/external/BMWtools/BMWIntegrator.h @@ -49,33 +49,15 @@ using namespace std; */ class T2Integrator { public: - T2Integrator(); - virtual ~T2Integrator(); - virtual double FuncAtX(double, const std::vector &par) const = 0; + T2Integrator() {}; ///< default constructor + virtual ~T2Integrator() {}; ///< default destructor virtual double IntegrateFunc(double, double, const std::vector &par); private: + virtual double FuncAtX(double, const std::vector &par) const = 0; static double FuncAtXgsl(double, void *); - ROOT::Math::GSLIntegrator *fIntegrator; ///< pointer to the GSL integrator }; -/** - *

Constructor of the alternative base class for 1D integrations - * Allocation of memory for an integration using the adaptive 31 point Gauss-Kronrod rule - */ -inline T2Integrator::T2Integrator() { - fIntegrator = new ROOT::Math::GSLIntegrator(ROOT::Math::Integration::kADAPTIVE,ROOT::Math::Integration::kGAUSS31); -} - -/** - *

Destructor of the alternative base class for 1D integrations - * Clean up. - */ -inline T2Integrator::~T2Integrator(){ - delete fIntegrator; - fIntegrator=0; -} - /** *

Method for passing the integrand function value to the integrator. * @@ -106,7 +88,13 @@ inline double T2Integrator::IntegrateFunc(double x1, double x2, const std::vecto pair*> ptrPair; ptrPair.first = (this); ptrPair.second = ∥ - return fIntegrator->Integral(&T2Integrator::FuncAtXgsl, static_cast(&ptrPair), x1, x2); + + ROOT::Math::GSLIntegrator *integrator = new ROOT::Math::GSLIntegrator(ROOT::Math::Integration::kADAPTIVE,ROOT::Math::Integration::kGAUSS31); + double value(integrator->Integral(&T2Integrator::FuncAtXgsl, static_cast(&ptrPair), x1, x2)); + delete integrator; + integrator = 0; + + return value; } @@ -123,8 +111,6 @@ inline double T2Integrator::IntegrateFunc(double x1, double x2, const std::vecto - - /** *

Base class for 1D integrations using the GNU Scientific Library integrator. * The function which should be integrated has to be implemented in a derived class.