Fixed a stupid inlining-mistake in the integrator-classes
This commit is contained in:
parent
ce9f98c37d
commit
d95607cf9c
24
src/external/libLFRelaxation/TIntegrator.cpp
vendored
24
src/external/libLFRelaxation/TIntegrator.cpp
vendored
@ -5,12 +5,11 @@
|
||||
Author: Bastian M. Wojek
|
||||
e-mail: bastian.wojek@psi.ch
|
||||
|
||||
2008/12/03
|
||||
2008/12/24
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "TIntegrator.h"
|
||||
#include "TMath.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@ -27,26 +26,5 @@ TIntegrator::~TIntegrator(){
|
||||
fFunc=0;
|
||||
}
|
||||
|
||||
inline double TIntegrator::FuncAtXgsl(double x, void *obj)
|
||||
{
|
||||
return ((TIntegrator*)obj)->FuncAtX(x);
|
||||
}
|
||||
|
||||
double TIntegrator::IntegrateFunc(double x1, double x2)
|
||||
{
|
||||
fFunc = &TIntegrator::FuncAtXgsl;
|
||||
return fIntegrator->Integral(fFunc, (this), x1, x2);
|
||||
}
|
||||
|
||||
|
||||
inline double TIntBesselJ0Exp::FuncAtX(double x) const
|
||||
{
|
||||
return TMath::BesselJ0(TMath::TwoPi()*fPar[0]*x) * TMath::Exp(-fPar[1]*x);
|
||||
}
|
||||
|
||||
|
||||
inline double TIntSinGss::FuncAtX(double x) const
|
||||
{
|
||||
return TMath::Sin(TMath::TwoPi()*fPar[0]*x) * TMath::Exp(-0.5*fPar[1]*fPar[1]*x*x);
|
||||
}
|
||||
|
||||
|
30
src/external/libLFRelaxation/TIntegrator.h
vendored
30
src/external/libLFRelaxation/TIntegrator.h
vendored
@ -5,7 +5,7 @@
|
||||
Author: Bastian M. Wojek
|
||||
e-mail: bastian.wojek@psi.ch
|
||||
|
||||
2008/12/03
|
||||
2008/12/24
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
@ -13,11 +13,14 @@
|
||||
#define _TIntegrator_H_
|
||||
|
||||
#include "Math/GSLIntegrator.h"
|
||||
#include "TMath.h"
|
||||
|
||||
#include<vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
// Integrator base class - the function to be integrated have to be implemented in a derived class
|
||||
|
||||
class TIntegrator {
|
||||
public:
|
||||
TIntegrator();
|
||||
@ -35,6 +38,19 @@ class TIntegrator {
|
||||
mutable double (*fFunc)(double, void *);
|
||||
};
|
||||
|
||||
inline double TIntegrator::FuncAtXgsl(double x, void *obj)
|
||||
{
|
||||
return ((TIntegrator*)obj)->FuncAtX(x);
|
||||
}
|
||||
|
||||
inline double TIntegrator::IntegrateFunc(double x1, double x2)
|
||||
{
|
||||
fFunc = &TIntegrator::FuncAtXgsl;
|
||||
return fIntegrator->Integral(fFunc, (this), x1, x2);
|
||||
}
|
||||
|
||||
// To be integrated: Bessel function times Exponential
|
||||
|
||||
class TIntBesselJ0Exp : public TIntegrator {
|
||||
public:
|
||||
TIntBesselJ0Exp() {}
|
||||
@ -42,6 +58,13 @@ class TIntBesselJ0Exp : public TIntegrator {
|
||||
double FuncAtX(double) const;
|
||||
};
|
||||
|
||||
inline double TIntBesselJ0Exp::FuncAtX(double x) const
|
||||
{
|
||||
return TMath::BesselJ0(TMath::TwoPi()*fPar[0]*x) * TMath::Exp(-fPar[1]*x);
|
||||
}
|
||||
|
||||
// To be integrated: Sine times Gaussian
|
||||
|
||||
class TIntSinGss : public TIntegrator {
|
||||
public:
|
||||
TIntSinGss() {}
|
||||
@ -49,4 +72,9 @@ class TIntSinGss : public TIntegrator {
|
||||
double FuncAtX(double) const;
|
||||
};
|
||||
|
||||
inline double TIntSinGss::FuncAtX(double x) const
|
||||
{
|
||||
return TMath::Sin(TMath::TwoPi()*fPar[0]*x) * TMath::Exp(-0.5*fPar[1]*fPar[1]*x*x);
|
||||
}
|
||||
|
||||
#endif //_TIntegrator_H_
|
||||
|
Loading…
x
Reference in New Issue
Block a user