Skip to content

Commit

Permalink
Make integrand of convolutions static functions
Browse files Browse the repository at this point in the history
  • Loading branch information
niclaurenti committed Mar 12, 2024
1 parent 564e6c7 commit c2f607e
Show file tree
Hide file tree
Showing 7 changed files with 356 additions and 246 deletions.
22 changes: 12 additions & 10 deletions inc/adani/CoefficientFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@

#include "adani/SplittingFunctions.h"

struct result {
double central;
double higher;
double lower;
class Value {
public:
Value(const double& central, const double& higher, const double& lower) ;


private:
double central;
double higher;
double lower;
};

class CoefficientFunction {
Expand All @@ -18,6 +23,9 @@ class CoefficientFunction {

virtual double fx(const double x, const double m2Q2, const double m2mu2, const int nf) const = 0 ;
virtual double MuIndependentTerms(const double x, const double m2Q2, const int nf) const {return fx(x, m2Q2, 1., nf);} ;
virtual double MuDependentTerms(const double x, const double m2Q2, const double m2mu2, const int nf) const {
return fx(x, m2Q2, m2mu2, nf) - fx(x, m2Q2, 1., nf);
}

// get methods
int GetOrder() const { return order_; } ;
Expand All @@ -29,17 +37,11 @@ class CoefficientFunction {
void SetKind(const char& kind) ;
void SetChannel(const char& channel) ;

// virtual void Set_fx() = 0;

private:
int order_ ; // order = 1, 2, or 3
char kind_ ; // kind_ = '2' for F2 and 'L' for FL
char channel_ ; // channel_ = 'g' for Cg and 'q' for Cq

// TODO: IMPLEMENT POINTER TO THE RIGHT FUNCTION
// protected:
// double (*fx_)(double, double, double, int);

};

#endif
41 changes: 15 additions & 26 deletions inc/adani/Convolutions.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ struct function_params {
double x;
double m2Q2;
int nf;
const AbstractConvolution* conv;
};

class AbstractConvolution {
public:
// AbstractConvolution(const CoefficientFunction& coefffunc, const SplittingFunction& splitfunc, const double& abserr = 1e-3, const double& relerr = 1e-3, const int& dim = 1000);
AbstractConvolution(CoefficientFunction* coefffunc, SplittingFunction* splitfunc, const double& abserr = 1e-3, const double& relerr = 1e-3, const int& dim = 1000);
AbstractConvolution(CoefficientFunction* coefffunc, AbstractSplittingFunction* splitfunc, const double& abserr = 1e-3, const double& relerr = 1e-3, const int& dim = 1000);
~AbstractConvolution() {} ;

double Convolute(double x, double m2Q2, int nf) const ;
Expand All @@ -54,8 +54,8 @@ class AbstractConvolution {
int GetRelerr() const {return relerr_;};
int GetDim() const {return dim_;} ;

// CoefficientFunction* GetCoeffFunc() const {return coefffunc_;};
// SplittingFunction* GetSplitFunc() const {return splitfunc_;};
CoefficientFunction* GetCoeffFunc() const {return coefffunc_;};
AbstractSplittingFunction* GetSplitFunc() const {return splitfunc_;};

// set methods
void SetAbserr(const double& abserr) ;
Expand All @@ -69,38 +69,27 @@ class AbstractConvolution {

protected:
CoefficientFunction *coefffunc_ ;
SplittingFunction *splitfunc_ ;
AbstractSplittingFunction *splitfunc_ ;

};

class Convolution : public AbstractConvolution {
public:
Convolution(CoefficientFunction* coefffunc, SplittingFunction* splitfunc, const double& abserr = 1e-3, const double& relerr = 1e-3, const int& dim = 1000) : AbstractConvolution(coefffunc, splitfunc, abserr, relerr, dim) {} ;
Convolution(CoefficientFunction* coefffunc, AbstractSplittingFunction* splitfunc, const double& abserr = 1e-3, const double& relerr = 1e-3, const int& dim = 1000) : AbstractConvolution(coefffunc, splitfunc, abserr, relerr, dim) {} ;
~Convolution() {} ;

// double Convolute(double x, double m2Q2, int nf) const ;

double RegularPart(double x, double m2Q2, int nf) const override;
double SingularPart(double x, double m2Q2, int nf) const override;
double LocalPart(double x, double m2Q2, int nf) const override;

// friend double regular_integrand(double z, void *p) ;
// friend double singular_integrand(double z, void *p) ;

private:
double regular_integrand(double z, void *p) const ;
double singular_integrand(double z, void *p) const ;

// static double static_regular_integrand(double z, void *params) {
// // Call the member function through the params pointer
// return static_cast<Convolution*>(params)->regular_integrand(z, nullptr);
// }
static double regular_integrand(double z, void *p) ;
static double singular_integrand(double z, void *p) ;

};

class MonteCarloDoubleConvolution : public AbstractConvolution {
public:
MonteCarloDoubleConvolution(CoefficientFunction* coefffunc, SplittingFunction* splitfunc, const double& abserr = 1e-3, const double& relerr = 1e-3, const int& dim = 1000, const int& MCcalls = 25000) ;
MonteCarloDoubleConvolution(CoefficientFunction* coefffunc, AbstractSplittingFunction* splitfunc, const double& abserr = 1e-3, const double& relerr = 1e-3, const int& dim = 1000, const int& MCcalls = 25000) ;
~MonteCarloDoubleConvolution() ;

double RegularPart(double x, double m2Q2, int nf) const override;
Expand All @@ -118,13 +107,13 @@ class MonteCarloDoubleConvolution : public AbstractConvolution {

Convolution* convolution_;

double regular1_integrand(double z[], size_t dim, void *p) const ;
double regular2_integrand(double z[], size_t dim, void *p) const ;
double regular3_integrand(double z, void *p) const ;
static double regular1_integrand(double z[], size_t dim, void *p) ;
static double regular2_integrand(double z[], size_t dim, void *p) ;
static double regular3_integrand(double z, void *p) ;

double singular1_integrand(double z[], size_t dim, void *p) const ;
double singular2_integrand(double z[], size_t dim, void *p) const ;
double singular3_integrand(double z, void *p) const ;
static double singular1_integrand(double z[], size_t dim, void *p) ;
static double singular2_integrand(double z[], size_t dim, void *p) ;
static double singular3_integrand(double z, void *p) ;
};

//==========================================================================================//
Expand Down
10 changes: 9 additions & 1 deletion inc/adani/ExactCoefficientFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ class ExactCoefficientFunction : public CoefficientFunction {
double MuIndependentTerms(const double x, const double m2Q2, const int nf) const override ;
double MuDependentTerms(const double x, const double m2Q2, const double m2mu2, const int nf) const ;

void SetFunctions();

private:

int method_flag_ ;
Expand All @@ -67,7 +69,11 @@ class ExactCoefficientFunction : public CoefficientFunction {
int MCcalls_ ;
int dim_ ;

std::vector<AbstractConvolution*> convolutions_;
double (ExactCoefficientFunction::*mu_indep_)(double, double, int) const;
double (ExactCoefficientFunction::*mu_dep_)(double, double, double, int) const;

std::vector<AbstractConvolution*> convolutions_lmu1;
std::vector<AbstractConvolution*> convolutions_lmu2;

ExactCoefficientFunction* gluon_lo_ ;
ExactCoefficientFunction* gluon_nlo_ ;
Expand Down Expand Up @@ -136,6 +142,8 @@ class ExactCoefficientFunction : public CoefficientFunction {
double C_ps3_MuDep(const double x, const double m2Q2, const double m2mu2, const int nf) const ;
double C_g3_MuDep(const double x, const double m2Q2, const double m2mu2, const int nf) const ;

double ZeroFunction(double x, double m2mu2, int nf) const {return 0.;};

};

#endif
53 changes: 46 additions & 7 deletions inc/adani/SplittingFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ class SplittingFunction : public AbstractSplittingFunction{
SplittingFunction operator*(const double& rhs) const;
friend SplittingFunction operator*(const double& lhs, const SplittingFunction& rhs);

SplittingFunction operator/(const double& rhs) const;

void SetFunctions() ;

// get methods
double GetOrder() const {return order_ ;} ;
char GetEntry1() const {return entry1_;} ;
Expand All @@ -57,6 +61,11 @@ class SplittingFunction : public AbstractSplittingFunction{
char entry1_;
char entry2_;

double (SplittingFunction::*reg_)(double, int) const;
double (SplittingFunction::*sing_)(double, int) const;
double (SplittingFunction::*sing_int_)(double, int) const;
double (SplittingFunction::*loc_)(int) const;

//==========================================================================================//
// Splitting functions O(alpha_s)
// without color factors
Expand Down Expand Up @@ -95,25 +104,44 @@ class SplittingFunction : public AbstractSplittingFunction{
double Pgg1sing_integrated(const double x, const int nf) const ;
double Pgg1loc(const int nf) const ;

double ZeroFunction_x_nf(double x, int nf) const {return 0.;};
double ZeroFunction_nf(int nf) const {return 0.;};

};

class ConvolutedSplittingFunctions : public SplittingFunction {
class ConvolutedSplittingFunctions : public AbstractSplittingFunction {
public:
ConvolutedSplittingFunctions(const int& order, const char& entry1, const char& entry2, const char& entry3);
ConvolutedSplittingFunctions(const int& order, const char& entry1, const char& entry2, const char& entry3, const char& entry4);

char GetEntry3() const {return entry3_;} ;

double Regular(const double x, const int nf) const ;

double Singular(const double x, const int nf) const {return 0.;} ;
double Local(const int nf) const {return 0.;} ;
double SingularIntegrated(const double x, const int nf) const {return 0.;};
double Singular(const double x, const int nf) const override {return 0.;} ;
double Local(const int nf) const override {return 0.;} ;
double SingularIntegrated(const double x, const int nf) const override {return 0.;};

ConvolutedSplittingFunctions operator*(const double& rhs) const;
friend ConvolutedSplittingFunctions operator*(const double& lhs, const ConvolutedSplittingFunctions& rhs);

ConvolutedSplittingFunctions operator/(const double& rhs) const;

void SetFunctions() ;

// get methods
double GetOrder() const {return order_ ;} ;
char GetEntry1() const {return entry1_;} ;
char GetEntry2() const {return entry2_;} ;
char GetEntry3() const {return entry3_;} ;

private:
int order_;
char entry1_;
char entry2_;
char entry3_;
char entry4_;

double (ConvolutedSplittingFunctions::*reg_)(double, int) const;

//==========================================================================================//
// Convolution between the splitting functions Pgg0/Pqq0
Expand All @@ -128,14 +156,25 @@ class ConvolutedSplittingFunctions : public SplittingFunction {
//------------------------------------------------------------------------------------------//

double Pgq0_x_Pqg0(const double x, const int nf) const ;

double ZeroFunction_x_nf(double x, int nf) const {return 0.;};
double ZeroFunction_nf(int nf) const {return 0.;};
};

class Delta : AbstractSplittingFunction {
class Delta : public AbstractSplittingFunction {
public:
Delta() : AbstractSplittingFunction() {};
~Delta() {} ;

double Regular(const double x, const int nf) const {return 0.;};
double Singular(const double x, const int nf) const {return 0.;};
double Local(const int nf) const {return 1.;};
double Local(const int nf) const {return GetMultFact() * 1.;};
double SingularIntegrated(const double x, const int nf) const {return 0.;};

Delta operator*(const double& rhs) const;
friend Delta operator*(const double& lhs, const Delta& rhs);

Delta operator/(const double& rhs) const;
};

#endif
Loading

0 comments on commit c2f607e

Please sign in to comment.