From e3c9df1852d033f51a2a9461298f05fb4368078b Mon Sep 17 00:00:00 2001 From: niccolo Date: Tue, 12 Mar 2024 18:44:28 +0100 Subject: [PATCH] Implement mathod_flag=0 --- inc/adani/AsymptoticCoefficientFunctions.h | 1 - inc/adani/CoefficientFunction.h | 3 +- inc/adani/Convolutions.h | 42 +++++++++++++++------- inc/adani/HighEnergyCoefficientFunctions.h | 1 - inc/adani/HighScaleCoefficientFunctions.h | 1 - inc/adani/MasslessCoefficientFunctions.h | 1 - inc/adani/SplittingFunctions.h | 1 + src/Convolutions.cc | 29 +++++++++++++-- src/ExactCoefficientFunctions.cc | 19 ++++++++-- 9 files changed, 77 insertions(+), 21 deletions(-) diff --git a/inc/adani/AsymptoticCoefficientFunctions.h b/inc/adani/AsymptoticCoefficientFunctions.h index a37acbb..cc97405 100644 --- a/inc/adani/AsymptoticCoefficientFunctions.h +++ b/inc/adani/AsymptoticCoefficientFunctions.h @@ -24,7 +24,6 @@ class AsymptoticCoefficientFunction : public AbstractHighEnergyCoefficientFunction { public: AsymptoticCoefficientFunction(const int& order, const char& kind, const char& channel, const bool& NLL = true); - // AsymptoticCoefficientFunction() : AsymptoticCoefficientFunction(1, '2', 'g', true) {} ; ~AsymptoticCoefficientFunction() ; double fx(const double x, const double m2Q2, const double m2mu2, const int nf) const ; diff --git a/inc/adani/CoefficientFunction.h b/inc/adani/CoefficientFunction.h index b2f9ab0..dccc70f 100644 --- a/inc/adani/CoefficientFunction.h +++ b/inc/adani/CoefficientFunction.h @@ -18,7 +18,8 @@ class CoefficientFunction { public: CoefficientFunction(const int& order, const char& kind, const char& channel) ; - // CoefficientFunction() : CoefficientFunction(1, '2', 'g') {} ; + CoefficientFunction(CoefficientFunction* coeff) : CoefficientFunction(coeff -> GetOrder(), coeff -> GetKind(), coeff -> GetChannel()) {}; + virtual ~CoefficientFunction() = 0 ; virtual double fx(const double x, const double m2Q2, const double m2mu2, const int nf) const = 0 ; diff --git a/inc/adani/Convolutions.h b/inc/adani/Convolutions.h index 3d054eb..2da892b 100644 --- a/inc/adani/Convolutions.h +++ b/inc/adani/Convolutions.h @@ -31,12 +31,12 @@ #include #include -struct function_params { - double x; - double m2Q2; - int nf; - const AbstractConvolution* conv; -}; +// struct function_params { +// double x; +// double m2Q2; +// int nf; +// const AbstractConvolution* conv; +// }; class AbstractConvolution { public: @@ -89,7 +89,7 @@ class Convolution : public AbstractConvolution { class MonteCarloDoubleConvolution : public AbstractConvolution { public: - MonteCarloDoubleConvolution(CoefficientFunction* coefffunc, AbstractSplittingFunction* 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& method_flag = 1, const int& MCcalls = 25000) ; ~MonteCarloDoubleConvolution() ; double RegularPart(double x, double m2Q2, int nf) const override; @@ -97,16 +97,13 @@ class MonteCarloDoubleConvolution : public AbstractConvolution { double LocalPart(double x, double m2Q2, int nf) const override; // get methods + int GetMethodFlag() const {return method_flag_;}; int GetMCcalls() const {return MCcalls_;}; // set methods + void SetMethodFlag(const int& method_flag) ; void SetMCcalls(const int& MCcalls) ; - private: - int MCcalls_; - - Convolution* convolution_; - 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) ; @@ -114,6 +111,27 @@ class MonteCarloDoubleConvolution : public AbstractConvolution { 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) ; + + private: + int method_flag_; + int MCcalls_; + + Convolution* convolution_; + ConvolutedCoefficientFunction* conv_coeff_; + +}; + +class ConvolutedCoefficientFunction : public CoefficientFunction { + public: + ConvolutedCoefficientFunction(Convolution* conv) : CoefficientFunction(conv -> GetCoeffFunc()) {conv_ = conv;}; + ~ConvolutedCoefficientFunction() {} ; + + double MuIndependentTerms(const double x, const double m2Q2, const int nf) const override {return conv_ -> Convolute(x, m2Q2, nf);}; + // double MuDependentTerms(const double x, const double m2Q2, const double m2mu2, const int nf) const {return 0.;}; + double fx(const double x, const double m2Q2, const double m2mu2, const int nf) const {return MuIndependentTerms(x, m2Q2, nf);}; + private: + Convolution* conv_; + }; //==========================================================================================// diff --git a/inc/adani/HighEnergyCoefficientFunctions.h b/inc/adani/HighEnergyCoefficientFunctions.h index 76fa9b9..4945757 100644 --- a/inc/adani/HighEnergyCoefficientFunctions.h +++ b/inc/adani/HighEnergyCoefficientFunctions.h @@ -32,7 +32,6 @@ class AbstractHighEnergyCoefficientFunction : public CoefficientFunction { public: AbstractHighEnergyCoefficientFunction(const int& order, const char& kind, const char& channel, const bool& NLL = true) ; - // AbstractHighEnergyCoefficientFunction() : AbstractHighEnergyCoefficientFunction(1, '2', 'g', true) {} ; ~AbstractHighEnergyCoefficientFunction() {}; // get methods diff --git a/inc/adani/HighScaleCoefficientFunctions.h b/inc/adani/HighScaleCoefficientFunctions.h index 79190f4..c01bdd1 100644 --- a/inc/adani/HighScaleCoefficientFunctions.h +++ b/inc/adani/HighScaleCoefficientFunctions.h @@ -32,7 +32,6 @@ class HighScaleCoefficientFunction : public CoefficientFunction { public: HighScaleCoefficientFunction(const int& order, const char& kind, const char& channel) ; - // HighScaleCoefficientFunction() : CoefficientFunction() {} ; ~HighScaleCoefficientFunction(); double fx(const double x, const double m2Q2, const double m2mu2, const int nf) const ; diff --git a/inc/adani/MasslessCoefficientFunctions.h b/inc/adani/MasslessCoefficientFunctions.h index 68c4ff2..d93535f 100644 --- a/inc/adani/MasslessCoefficientFunctions.h +++ b/inc/adani/MasslessCoefficientFunctions.h @@ -25,7 +25,6 @@ class MasslessCoefficientFunction : public CoefficientFunction { public: MasslessCoefficientFunction(const int& order, const char& kind, const char& channel) : CoefficientFunction(order, kind, channel) {} ; - // MasslessCoefficientFunction() : CoefficientFunction() {} ; ~MasslessCoefficientFunction() {} ; double fx(const double x, const double m2Q2, const double m2mu2, const int nf) const ; diff --git a/inc/adani/SplittingFunctions.h b/inc/adani/SplittingFunctions.h index 8de5e72..83cedb6 100644 --- a/inc/adani/SplittingFunctions.h +++ b/inc/adani/SplittingFunctions.h @@ -112,6 +112,7 @@ class SplittingFunction : public AbstractSplittingFunction{ class ConvolutedSplittingFunctions : public AbstractSplittingFunction { public: ConvolutedSplittingFunctions(const int& order, const char& entry1, const char& entry2, const char& entry3, const char& entry4); + ~ConvolutedSplittingFunctions() {}; char GetEntry3() const {return entry3_;} ; diff --git a/src/Convolutions.cc b/src/Convolutions.cc index d73429f..3eaf9f0 100644 --- a/src/Convolutions.cc +++ b/src/Convolutions.cc @@ -162,15 +162,33 @@ double Convolution::LocalPart(double x, double m2Q2, int nf) const { } -MonteCarloDoubleConvolution::MonteCarloDoubleConvolution(CoefficientFunction* coefffunc, AbstractSplittingFunction* splitfunc, const double& abserr, const double& relerr, const int& dim, const int& MCcalls) : AbstractConvolution(coefffunc, splitfunc, abserr, relerr, dim) { +MonteCarloDoubleConvolution::MonteCarloDoubleConvolution(CoefficientFunction* coefffunc, AbstractSplittingFunction* splitfunc, const double& abserr, const double& relerr, const int& dim, const int& method_flag, const int& MCcalls) : AbstractConvolution(coefffunc, splitfunc, abserr, relerr, dim) { + SetMethodFlag(method_flag); SetMCcalls(MCcalls); - convolution_ = new Convolution(coefffunc, splitfunc, abserr, relerr, dim); + + if (method_flag == 1) { + convolution_ = new Convolution(coefffunc, splitfunc, abserr, relerr, dim); + conv_coeff_ = nullptr; + } else { + conv_coeff_ = new ConvolutedCoefficientFunction( new Convolution(coefffunc, splitfunc, abserr, relerr, dim) ); + convolution_ = new Convolution(conv_coeff_, splitfunc, abserr, relerr, dim); + } } MonteCarloDoubleConvolution::~MonteCarloDoubleConvolution() { delete convolution_; + delete conv_coeff_; +} + +void MonteCarloDoubleConvolution::SetMethodFlag(const int& method_flag) { + // check dim + if (method_flag != 0 && method_flag != 1) { + cout << "Error: method_flag must be 0 or 1. Got " << method_flag << endl; + exit(-1); + } + method_flag_ = method_flag; } void MonteCarloDoubleConvolution::SetMCcalls(const int& MCcalls) { @@ -242,6 +260,8 @@ double regular3_integrand(double z, void *p) { double MonteCarloDoubleConvolution::RegularPart(double x, double m2Q2, int nf) const { + if (method_flag_ == 0) return convolution_ -> RegularPart(x, m2Q2, nf); + double x_max = 1. / (1. + 4 * m2Q2); struct function_params params = { x, m2Q2, nf, this }; @@ -377,6 +397,9 @@ double singular3_integrand(double z, void *p) { double MonteCarloDoubleConvolution::SingularPart(double x, double m2Q2, int nf) const { + if (method_flag_ == 0) return convolution_ -> SingularPart(x, m2Q2, nf); + + double x_max = 1. / (1. + 4 * m2Q2); struct function_params params = { x, m2Q2, nf, this }; @@ -440,6 +463,8 @@ double MonteCarloDoubleConvolution::SingularPart(double x, double m2Q2, int nf) double MonteCarloDoubleConvolution::LocalPart(double x, double m2Q2, int nf) const { + if (method_flag_ == 0) return convolution_ -> LocalPart(x, m2Q2, nf); + double x_max = 1. / (1. + 4 * m2Q2); return convolution_ -> Convolute(x, m2Q2, nf) * (splitfunc_ -> Local(nf) - splitfunc_ -> SingularIntegrated(x / x_max, nf)); diff --git a/src/ExactCoefficientFunctions.cc b/src/ExactCoefficientFunctions.cc index 7a61463..d6db721 100644 --- a/src/ExactCoefficientFunctions.cc +++ b/src/ExactCoefficientFunctions.cc @@ -385,10 +385,10 @@ double ExactCoefficientFunction::C2_g20(const double x, const double m2Q2) const double ExactCoefficientFunction::C_g21(const double x, const double m2Q2) const { - int nf = 1; + int nf_one = 1; // Put nf to 1 since the nf contribution cancels for any value of nf - return -(convolutions_lmu1[0] -> Convolute(x, m2Q2, nf) + convolutions_lmu1[1] -> Convolute(x, m2Q2, nf) * beta(0, nf)); + return -(convolutions_lmu1[0] -> Convolute(x, m2Q2, nf_one) + convolutions_lmu1[1] -> Convolute(x, m2Q2, nf_one) * beta(0, nf_one)); } //==========================================================================================// @@ -579,3 +579,18 @@ double ExactCoefficientFunction::C_g32(const double x, const double m2Q2, const // - 3. / 2 * beta0 * CL_g1_x_Pgg0(x, m2Q2, nf) // + beta0 * beta0 * CL_g1(x, m2Q2); // } + + +double ExactCoefficientFunction::C_g3_MuDep(const double x, const double m2Q2, const double m2mu2, int nf) const { + + double lmu = log(1. / m2mu2) ; + + return C_g31(x, m2Q2, nf) * lmu + C_g32(x, m2Q2, nf) * lmu * lmu ; +} + +double ExactCoefficientFunction::C_ps3_MuDep(const double x, const double m2Q2, const double m2mu2, int nf) const { + + double lmu = log(1. / m2mu2) ; + + return C_ps31(x, m2Q2, nf) * lmu + C_ps32(x, m2Q2, nf) * lmu * lmu ; +}