Skip to content

Commit

Permalink
Move functions into private
Browse files Browse the repository at this point in the history
  • Loading branch information
niclaurenti committed Feb 20, 2025
1 parent c292796 commit 53f587e
Show file tree
Hide file tree
Showing 12 changed files with 111 additions and 43 deletions.
26 changes: 13 additions & 13 deletions inc/adani/Convolution.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,14 @@ class Convolution : public AbstractConvolution {
double SingularPart(double x, double m2Q2, int nf) const override;
double LocalPart(double x, double m2Q2, int nf) const override;

private:
static int NumberOfInstances_;
static gsl_error_handler_t *old_handler_;

// support function for the integral. It is static in order to be passed
// to gsl
static double regular_integrand(double z, void *p);
static double singular_integrand(double z, void *p);

private:
static int NumberOfInstances_;
static gsl_error_handler_t *old_handler_;
};

//==========================================================================================//
Expand Down Expand Up @@ -160,6 +160,15 @@ class DoubleConvolution : public AbstractConvolution {
// set methods
void SetMCcalls(const int &MCcalls);

private:
const bool MCintegral_;
int MCcalls_;
gsl_monte_vegas_state *s_;
gsl_rng *r_;

Convolution *convolution_;
ConvolutedCoefficientFunction *conv_coeff_;

// support function for the integral. it is static in order to be passed
// to gsl
static double regular1_integrand(double z[], size_t /*dim*/, void *p);
Expand All @@ -169,15 +178,6 @@ class DoubleConvolution : 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:
const bool MCintegral_;
int MCcalls_;
gsl_monte_vegas_state *s_;
gsl_rng *r_;

Convolution *convolution_;
ConvolutedCoefficientFunction *conv_coeff_;
};

//==========================================================================================//
Expand Down
4 changes: 2 additions & 2 deletions inc/adani/ExactCoefficientFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ class ExactCoefficientFunction : public CoefficientFunction {
Value
fxBand(double x, double m2Q2, double m2mu2, int nf) const override;

void SetFunctions();

private:
double (ExactCoefficientFunction::*mu_indep_)(
double, double, int
Expand Down Expand Up @@ -92,6 +90,8 @@ class ExactCoefficientFunction : public CoefficientFunction {

Delta *delta_;

void SetFunctions();

//==========================================================================================//
// Exact massive coefficient functions
// O(as)
Expand Down
4 changes: 2 additions & 2 deletions inc/adani/HighEnergyCoefficientFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ class HighEnergyCoefficientFunction
Value
fxBand(double x, double m2Q2, double m2mu2, int nf) const override;

void SetFunctions();

private:
double (HighEnergyCoefficientFunction::*LL_)(
double, double, double
Expand All @@ -83,6 +81,8 @@ class HighEnergyCoefficientFunction
double, double, double, int
) const;

void SetFunctions();

//==========================================================================================//
// High energy coefficient functions
// O(as^2)
Expand Down
4 changes: 2 additions & 2 deletions inc/adani/HighScaleCoefficientFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ class HighScaleCoefficientFunction : public CoefficientFunction {
double x, double m2Q2, double m2mu2, int nf
) const;

void SetFunctions();

private:
Value (HighScaleCoefficientFunction::*fx_)(
double, double, double, int
Expand All @@ -65,6 +63,8 @@ class HighScaleCoefficientFunction : public CoefficientFunction {
MasslessCoefficientFunction *massless_as3_;
MatchingCondition *a_muindep_;

void SetFunctions();

//==========================================================================================//
// High scale (Q^2 >> m^2) coefficient
// functions O(as)
Expand Down
4 changes: 2 additions & 2 deletions inc/adani/HighScaleSplitLogs.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ class HighScaleSplitLogs : public CoefficientFunction {
double N2LL(double x, int nf) const { return (this->*N2LL_)(x, nf); }
Value N3LL(double x, int nf) const { return (this->*N3LL_)(x, nf); }

void SetFunctions();

private:
MasslessCoefficientFunction *massless_as1_;
MasslessCoefficientFunction *massless_;
Expand All @@ -80,6 +78,8 @@ class HighScaleSplitLogs : public CoefficientFunction {
double (HighScaleSplitLogs::*N2LL_)(double, int) const;
Value (HighScaleSplitLogs::*N3LL_)(double, int) const;

void SetFunctions();

//==========================================================================================//
// Gluon channel, F2
//------------------------------------------------------------------------------------------//
Expand Down
27 changes: 20 additions & 7 deletions inc/adani/MasslessCoefficientFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,15 @@ class MasslessCoefficientFunction : public CoefficientFunction {
);
~MasslessCoefficientFunction() override{};

double fx(
double x, double /*m2Q2*/, double /*m2mu2*/, int nf
) const override;
[[deprecated(
"This function is deprecated and should not be used since it "
"depends on the MuDependent terms that are not implemented. It "
"will throw a NotImplementedException. Call "
"MasslessCoefficientFunction::MuIndependentTerms(double x, int nf) "
"for the mu-independent terms"
)]] double
fx(double /*x*/, double /*m2Q2*/, double /*m2mu2*/, int /*nf*/
) const override;

[[deprecated("This function is deprecated and should not be used since "
"MasslessCoefficientFunction do not depend on m^2/Q^2!. "
Expand All @@ -53,14 +59,21 @@ class MasslessCoefficientFunction : public CoefficientFunction {
double /*x*/, double /*m2Q2*/, double /*m2mu2*/, int /*nf*/
) const override;

Value
fxBand(double x, double m2Q2, double m2mu2, int nf) const override;

void SetFunctions();
[[deprecated(
"This function is deprecated and should not be used since it "
"depends on the MuDependent terms that are not implemented. It "
"will throw a NotImplementedException. Call "
"MasslessCoefficientFunction::MuIndependentTerms(double x, int nf) "
"for the mu-independent terms"
)]] Value
fxBand(double /*x*/, double /*m2Q2*/, double /*m2mu2*/, int /*nf*/)
const override;

private:
double (MasslessCoefficientFunction::*mu_indep_)(double, int) const;

void SetFunctions();

//==========================================================================================//
// Massless coefficient functions
// O(as)
Expand Down
6 changes: 3 additions & 3 deletions inc/adani/MatchingCondition.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ class MatchingCondition {
char GetEntry2() const { return entry2_; };
string GetVersion() const { return version_; };

void CheckEntry(char entry) const;
void CheckVersion(string version) const;

Value MuIndependentNfIndependentTerm(double x) const;
vector<double> NotOrdered(double x) const;

Expand All @@ -52,6 +49,9 @@ class MatchingCondition {
const char entry2_;
const string version_;

void CheckEntry(char entry) const;
void CheckVersion(string version) const;

//==========================================================================================//
// Matching conditions O(as)
//------------------------------------------------------------------------------------------//
Expand Down
8 changes: 4 additions & 4 deletions inc/adani/SplittingFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ class SplittingFunction : public AbstractSplittingFunction {
// Integral from 0 to x of the Singular part
double SingularIntegrated(double x, int nf) const override;

void SetFunctions();

// get methods
double GetOrder() const { return order_; };
char GetEntry1() const { return entry1_; };
Expand All @@ -87,6 +85,8 @@ class SplittingFunction : public AbstractSplittingFunction {
double (SplittingFunction::*sing_int_)(double, int) const;
double (SplittingFunction::*loc_)(int) const;

void SetFunctions();

//==========================================================================================//
// Splitting functions O(as)
// without color factors
Expand Down Expand Up @@ -160,8 +160,6 @@ class ConvolutedSplittingFunctions : public AbstractSplittingFunction {
// Integral from 0 to x of the Singular part
double SingularIntegrated(double x, int nf) const override;

void SetFunctions();

// get methods
double GetOrder1() const { return order1_; };
char GetEntry1() const { return entry1_; };
Expand All @@ -185,6 +183,8 @@ class ConvolutedSplittingFunctions : public AbstractSplittingFunction {

SplittingFunction *Pgg0_;

void SetFunctions();

//==========================================================================================//
// Convolution between the splitting functions Pgg0/Pqq0
// and Pgq0
Expand Down
4 changes: 2 additions & 2 deletions inc/adani/ThresholdCoefficientFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ class ThresholdCoefficientFunction : public CoefficientFunction {

double BetaIndependentTerms(double x, double m2Q2, double m2mu2) const;

void SetFunctions();

private:
// TODO: fx is the sum of a beta-dependent term and a beta-independent
// in this way there is some repeated code. Split the pointers into
Expand All @@ -60,6 +58,8 @@ class ThresholdCoefficientFunction : public CoefficientFunction {

ExactCoefficientFunction *exact_as1_;

void SetFunctions();

//==========================================================================================//
// Threshold (s -> 4m^2) coefficient
// functions O(as)
Expand Down
1 change: 1 addition & 0 deletions inc/adani/adani.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "adani/Constants.h"
#include "adani/Convolution.h"
#include "adani/ExactCoefficientFunction.h"
#include "adani/Exceptions.h"
#include "adani/HighEnergyCoefficientFunction.h"
#include "adani/HighScaleCoefficientFunction.h"
#include "adani/HighScaleSplitLogs.h"
Expand Down
45 changes: 43 additions & 2 deletions pywrap/pywrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,12 @@ PYBIND11_MODULE(_core, m) {
& HighScaleSplitLogs::fx,
py::arg("x"), py::arg("m2Q2"), py::arg("nf")
)
.def(
"fx",
(double(HighScaleSplitLogs::*)(double, double, double, int) const)
& HighScaleSplitLogs::fx,
py::arg("x"), py::arg("m2Q2"), py::arg("m2mu2"), py::arg("nf")
)
.def("LL", &HighScaleSplitLogs::LL, py::arg("x"), py::arg("nf"))
.def("NLL", &HighScaleSplitLogs::NLL, py::arg("x"), py::arg("nf"))
.def("N2LL", &HighScaleSplitLogs::N2LL, py::arg("x"), py::arg("nf"))
Expand All @@ -399,6 +405,12 @@ PYBIND11_MODULE(_core, m) {
(Value(HighScaleSplitLogs::*)(double, double, int) const)
& HighScaleSplitLogs::fxBand,
py::arg("x"), py::arg("m2Q2"), py::arg("nf")
)
.def(
"fxBand",
(Value(HighScaleSplitLogs::*)(double, double, double, int) const)
& HighScaleSplitLogs::fxBand,
py::arg("x"), py::arg("m2Q2"), py::arg("m2mu2"), py::arg("nf")
);

// MasslessCoefficientFunction
Expand All @@ -415,8 +427,34 @@ PYBIND11_MODULE(_core, m) {
& MasslessCoefficientFunction::MuIndependentTerms,
py::arg("x"), py::arg("nf")
)
.def("MuDependentTerms", &MasslessCoefficientFunction::MuDependentTerms)
.def("fx", &MasslessCoefficientFunction::fx);
.def(
"MuIndependentTerms",
(double(MasslessCoefficientFunction::*)(double, double, int) const)
& MasslessCoefficientFunction::MuIndependentTerms,
py::arg("x"), py::arg("m2Q2"), py::arg("nf")
)
.def(
"MuDependentTerms",
(double(MasslessCoefficientFunction::*)(double, double, double, int)
const)
& MasslessCoefficientFunction::MuDependentTerms,
py::arg("x"), py::arg("m2Q2"), py::arg("m2mu2"), py::arg("nf")
)
.def(
"fx",
(double(MasslessCoefficientFunction::*)(double, double, double, int)
const)
& MasslessCoefficientFunction::fx,
py::arg("x"), py::arg("m2Q2"), py::arg("m2mu2"), py::arg("nf")
)
.def(
"fxBand",
(Value(MasslessCoefficientFunction::*)(double, double, double, int)
const)
& MasslessCoefficientFunction::fxBand,
py::arg("x"), py::arg("m2Q2"), py::arg("m2mu2"), py::arg("nf")
);
;

// SplittingFunction
py::class_<SplittingFunction>(m, "SplittingFunction")
Expand Down Expand Up @@ -510,4 +548,7 @@ PYBIND11_MODULE(_core, m) {
"fxBand", &ThresholdCoefficientFunction::fxBand, py::arg("x"),
py::arg("m2Q2"), py::arg("m2mu2"), py::arg("nf")
);

// Exceptions
// m.def("throw_exception", &throw_exception);
}
21 changes: 17 additions & 4 deletions src/MasslessCoefficientFunction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,16 @@ MasslessCoefficientFunction::MasslessCoefficientFunction(
//------------------------------------------------------------------------------------------//

double MasslessCoefficientFunction::fx(
double x, double /*m2Q2*/, double /*m2mu2*/, int nf
double /*x*/, double /*m2Q2*/, double /*m2mu2*/, int /*nf*/
) const {
throw NotImplementedException(
"this function is deprecated and should not be used since it depends "
"on the MuDependent terms that are not implemented. Call "
"MasslessCoefficientFunction::MuIndependentTerms(double x, int nf) for "
"the mu-independent terms",
__PRETTY_FUNCTION__
);
// return MuIndependentTerms(x, nf) + MuDependentTerms(x, m2Q2, m2mu2, nf);
return MuIndependentTerms(x, nf);
}

//==========================================================================================//
Expand Down Expand Up @@ -77,9 +83,16 @@ double MasslessCoefficientFunction::MuIndependentTerms(double x, int nf) const {
//------------------------------------------------------------------------------------------//

Value MasslessCoefficientFunction::fxBand(
double x, double m2Q2, double m2mu2, int nf
double /*x*/, double /*m2Q2*/, double /*m2mu2*/, int /*nf*/
) const {
return Value(fx(x, m2Q2, m2mu2, nf));
throw NotImplementedException(
"this function is deprecated and should not be used since it depends "
"on the MuDependent terms that are not implemented. Call "
"MasslessCoefficientFunction::MuIndependentTerms(double x, int nf) for "
"the mu-independent terms",
__PRETTY_FUNCTION__
);
// return Value(fx(x, m2Q2, m2mu2, nf));
}

//==========================================================================================//
Expand Down

0 comments on commit 53f587e

Please sign in to comment.