Skip to content

Commit

Permalink
Move some stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
niclaurenti committed Mar 20, 2024
1 parent 1b6d55b commit 7564d21
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 24 deletions.
26 changes: 10 additions & 16 deletions inc/adani/Convolution.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,30 +105,24 @@ class Convolution : public AbstractConvolution {

class ConvolutedCoefficientFunction : public CoefficientFunction {
public:
ConvolutedCoefficientFunction(Convolution *conv)
: CoefficientFunction(conv->GetCoeffFunc()) {
conv_ = conv;
};
~ConvolutedCoefficientFunction() override{};
ConvolutedCoefficientFunction(CoefficientFunction* coefffunc, AbstractSplittingFunction* splitfunc, const double &abserr = 1e-3, const double &relerr = 1e-3, const int &dim = 1000);
~ConvolutedCoefficientFunction() override;

double MuIndependentTerms(double x, double m2Q2, int nf) const override {
return conv_->Convolute(x, m2Q2, nf);
};
// get method
Convolution* GetConv() const {return conv_;};

double MuIndependentTerms(double x, double m2Q2, int nf) const override;
double MuDependentTerms(
double /*x*/, double /*m2Q2*/, double /*m2mu2*/, int /*nf*/
) const override {
return 0.;
};
double fx(double x, double m2Q2, double m2mu2, int nf) const override {
return MuIndependentTerms(x, m2Q2, nf)
+ MuDependentTerms(x, m2Q2, m2mu2, nf);
}
Value fxBand(double x, double m2Q2, double m2mu2, int nf) const override {
return Value(fx(x, m2Q2, m2mu2, nf));
}
double fx(double x, double m2Q2, double m2mu2, int nf) const override;
Value fxBand(double x, double m2Q2, double m2mu2, int nf) const override;

private:
Convolution *conv_;
Convolution* conv_;

};

//==========================================================================================//
Expand Down
5 changes: 5 additions & 0 deletions inc/adani/HighScaleSplitLogs.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
// (The expressions do not contain the log)
//------------------------------------------------------------------------------------------//

//==========================================================================================//
// class HighScaleSplitLogs
//------------------------------------------------------------------------------------------//

class HighScaleSplitLogs : public CoefficientFunction {
public:
HighScaleSplitLogs(
Expand All @@ -46,6 +50,7 @@ class HighScaleSplitLogs : public CoefficientFunction {
const override;
Value fxBand(double x, double m2Q2, int nf) const;

// division of the total result in the log terms
double LL(double x, int nf) const { return (this->*LL_)(x, nf); }
double NLL(double x, int nf) const { return (this->*NLL_)(x, nf); }
double N2LL(double x, int nf) const { return (this->*N2LL_)(x, nf); }
Expand Down
56 changes: 51 additions & 5 deletions src/Convolution.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ double Convolution::regular_integrand(double z, void *p) {
}

//==========================================================================================//
// AbstractConvolution: integrand of the singular part
// Convolution: integrand of the singular part
//------------------------------------------------------------------------------------------//

double Convolution::singular_integrand(double z, void *p) {
Expand Down Expand Up @@ -127,7 +127,7 @@ double Convolution::singular_integrand(double z, void *p) {
//------------------------------------------------------------------------------------------//

//==========================================================================================//
// AbstractConvolution: regular part
// Convolution: regular part
//------------------------------------------------------------------------------------------//

double Convolution::RegularPart(double x, double m2Q2, int nf) const {
Expand Down Expand Up @@ -163,7 +163,7 @@ double Convolution::RegularPart(double x, double m2Q2, int nf) const {
}

//==========================================================================================//
// AbstractConvolution: singular part
// Convolution: singular part
//------------------------------------------------------------------------------------------//

double Convolution::SingularPart(double x, double m2Q2, int nf) const {
Expand Down Expand Up @@ -200,7 +200,7 @@ double Convolution::SingularPart(double x, double m2Q2, int nf) const {
}

//==========================================================================================//
// AbstractConvolution: local part
// Convolution: local part
//------------------------------------------------------------------------------------------//

double Convolution::LocalPart(double x, double m2Q2, int nf) const {
Expand All @@ -212,6 +212,52 @@ double Convolution::LocalPart(double x, double m2Q2, int nf) const {
- splitfunc_->SingularIntegrated(x / x_max, nf));
}

//==========================================================================================//
// ConvolutedCoefficientFunction: constructor
//------------------------------------------------------------------------------------------//

ConvolutedCoefficientFunction::ConvolutedCoefficientFunction(CoefficientFunction* coefffunc, AbstractSplittingFunction* splitfunc, const double &abserr, const double &relerr, const int &dim) : CoefficientFunction(coefffunc) {

conv_ = new Convolution(coefffunc, splitfunc, abserr, relerr, dim);
}

//==========================================================================================//
// ConvolutedCoefficientFunction: destructor
//------------------------------------------------------------------------------------------//

ConvolutedCoefficientFunction::~ConvolutedCoefficientFunction() {

delete conv_;
}

//==========================================================================================//
// ConvolutedCoefficientFunction: mu independent terms
//------------------------------------------------------------------------------------------//

double ConvolutedCoefficientFunction::MuIndependentTerms(double x, double m2Q2, int nf) const {

return conv_->Convolute(x, m2Q2, nf);
}

//==========================================================================================//
// ConvolutedCoefficientFunction: central value of fx
//------------------------------------------------------------------------------------------//

double ConvolutedCoefficientFunction::fx(double x, double m2Q2, double m2mu2, int nf) const {

return MuIndependentTerms(x, m2Q2, nf)
+ MuDependentTerms(x, m2Q2, m2mu2, nf);
}

//==========================================================================================//
// ConvolutedCoefficientFunction: band of fx
//------------------------------------------------------------------------------------------//

Value ConvolutedCoefficientFunction::fxBand(double x, double m2Q2, double m2mu2, int nf) const {

return Value(fx(x, m2Q2, m2mu2, nf));
}

//==========================================================================================//
// DoubleConvolution: constructor
//------------------------------------------------------------------------------------------//
Expand All @@ -232,7 +278,7 @@ DoubleConvolution::DoubleConvolution(
conv_coeff_ = nullptr;
} else {
conv_coeff_ = new ConvolutedCoefficientFunction(
new Convolution(coefffunc, splitfunc, abserr, relerr, dim)
coefffunc, splitfunc, abserr, relerr, dim
);
convolution_ =
new Convolution(conv_coeff_, splitfunc, abserr, relerr, dim);
Expand Down
29 changes: 28 additions & 1 deletion src/HighScaleSplitLogs.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "adani/HighScaleSplitLogs.h"
#include "adani/Constants.h"
#include "adani/Convolution.h"
#include "adani/SpecialFunctions.h"

#include <cmath>
Expand All @@ -9,6 +8,10 @@
using std::cout;
using std::endl;

//==========================================================================================//
// HighScaleSplitLogs: constructor
//------------------------------------------------------------------------------------------//

HighScaleSplitLogs::HighScaleSplitLogs(
const int &order, const char &kind, const char &channel, const bool &exact,
const bool &revised_approx
Expand Down Expand Up @@ -39,12 +42,20 @@ HighScaleSplitLogs::HighScaleSplitLogs(
SetFunctions();
}

//==========================================================================================//
// HighScaleSplitLogs: destructor
//------------------------------------------------------------------------------------------//

HighScaleSplitLogs::~HighScaleSplitLogs() {
delete massless_;
delete massless_lo_;
delete a_muindep_;
}

//==========================================================================================//
// HighScaleSplitLogs: warning function that prevents from calling fx with Q != mu.
//------------------------------------------------------------------------------------------//

double HighScaleSplitLogs::
fx(double /*x*/, double /*m2Q2*/, double /*m2mu2*/, int /*nf*/) const {
cout << "Error: HighScaleSplitLogs is implemented only in the case mu=Q!"
Expand All @@ -53,10 +64,18 @@ double HighScaleSplitLogs::
exit(-1);
}

//==========================================================================================//
// HighScaleSplitLogs: central value of the band
//------------------------------------------------------------------------------------------//

double HighScaleSplitLogs::fx(double x, double m2Q2, int nf) const {
return fxBand(x, m2Q2, nf).GetCentral();
}

//==========================================================================================//
// HighScaleSplitLogs: warning function that prevents from calling fxBand with Q != mu.
//------------------------------------------------------------------------------------------//

Value HighScaleSplitLogs::
fxBand(double /*x*/, double /*m2Q2*/, double /*m2mu2*/, int /*nf*/) const {
cout << "Error: HighScaleSplitLogs is implemented only in the case mu=Q!"
Expand All @@ -66,6 +85,10 @@ Value HighScaleSplitLogs::
exit(-1);
}

//==========================================================================================//
// HighScaleSplitLogs: band of the total result
//------------------------------------------------------------------------------------------//

Value HighScaleSplitLogs::fxBand(double x, double m2Q2, int nf) const {
double Log = log(m2Q2);
double Log2 = Log * Log;
Expand All @@ -74,6 +97,10 @@ Value HighScaleSplitLogs::fxBand(double x, double m2Q2, int nf) const {
+ N3LL(x, nf);
}

//==========================================================================================//
// HighScaleSplitLogs: function that sets the pointers to the correct function
//------------------------------------------------------------------------------------------//

void HighScaleSplitLogs::SetFunctions() {

if (GetKind() == '2') {
Expand Down
4 changes: 2 additions & 2 deletions tests/test_mc_integral.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ def test_mc_integrals():
for kind in ['2', 'L']:
massive_mc = ad.ExactCoefficientFunction(3, kind, 'g', 1e-3, 1e-3, 1000, 1, 1000000)
massive_nomc = ad.ExactCoefficientFunction(3, kind, 'g', 1e-3, 1e-3, 1000, 0, 25000)
for xi in np.geomspace(1e-2, 1e4, 4, endpoint=True):
for xi in np.geomspace(1e-2, 1e4, 5, endpoint=True):
m2Q2 = 1/xi
xmax = 1. / (1. + 4 * m2Q2)
for x in np.geomspace(1e-5, xmax, 5, endpoint=False):
for nf in range(7):
for nf in range(1, 6 + 1):
res1 = massive_mc.MuDependentTerms(x, m2Q2, m2Q2, nf)
res2 = massive_nomc.MuDependentTerms(x, m2Q2, m2Q2, nf)
np.testing.assert_allclose(res1, res2, rtol=5e-3)
Expand Down

0 comments on commit 7564d21

Please sign in to comment.