-
Notifications
You must be signed in to change notification settings - Fork 0
/
IntegrationFunction.h
executable file
·57 lines (40 loc) · 1.18 KB
/
IntegrationFunction.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef INTEGRAL_FUNCTION_H
#define INTEGRAL_FUNCTION_H
#include "TF1.h"
#include "TF2.h"
static int n_gaussLegendreSamplingPoints = 0;
static double *gaussLegendreWeights = nullptr;
static double *gaussLegendreAbscissas = nullptr;
static bool gaussLegendreSamplingPointsGenerated = false;
void generateGaussLegendreSamplingPoint(int n = 20);
class IntegrationFunction
{
private:
double (*function)(double*,double*){ nullptr };
int n_param { 0 };
int n_var { 1 };
TF1 function1D {};
TF2 function2D {};
double integralLowerLimit1 { 0 };
double integralUpperLimit1 { 0 };
double integralLowerLimit2 { 0 };
double integralUpperLimit2 { 0 };
// flags
enum IntegrationType
{
SELF,
ROOT,
ROOT_FAST
};
IntegrationType integrationType { ROOT };
bool useIntegralFast { false };
bool functionInitialized { false };
public:
IntegrationFunction() = default;
IntegrationFunction(int npar, int nvar = 1, bool integralFast = false);
~IntegrationFunction(){}
void setLimits(double a1, double b1, double a2 = 0, double b2 = 0);
void setFunction(double (*f)(double*,double*));
double integrate(double *param);
};
#endif