Skip to content

Commit

Permalink
Change un po de robba
Browse files Browse the repository at this point in the history
  • Loading branch information
niclaurenti committed Mar 28, 2024
1 parent 7255a05 commit 55de6cb
Show file tree
Hide file tree
Showing 13 changed files with 57 additions and 40 deletions.
4 changes: 2 additions & 2 deletions examples/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ int main() {
int nf = 4;

ApproximateCoefficientFunction F2g(
3, '2', 'g', true, "improved", 1e-3, 1e-3, 1000, false, 25000
3, '2', 'g', true, "abmp", 1e-3, 1e-3, 1000, false, 25000
);
ApproximateCoefficientFunction FLg(
3, 'L', 'g', true, "improved", 1e-3, 1e-3, 1000, false, 25000
3, 'L', 'g', true, "abmp", 1e-3, 1e-3, 1000, false, 25000
);
ApproximateCoefficientFunction F2q(
3, '2', 'q', true, "exact", 1e-3, 1e-3, 1000, false, 25000
Expand Down
4 changes: 2 additions & 2 deletions examples/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
nf = 4
m = 4.92

F2g = ad.ApproximateCoefficientFunction(3, '2', 'g', True, "improved", 1e-3, 1e-3, 1000, False, 25000)
FLg = ad.ApproximateCoefficientFunction(3, 'L', 'g', True, "improved", 1e-3, 1e-3, 1000, False, 25000)
F2g = ad.ApproximateCoefficientFunction(3, '2', 'g', True, "abmp", 1e-3, 1e-3, 1000, False, 25000)
FLg = ad.ApproximateCoefficientFunction(3, 'L', 'g', True, "abmp", 1e-3, 1e-3, 1000, False, 25000)
F2q = ad.ApproximateCoefficientFunction(3, '2', 'q', True, "exact", 1e-3, 1e-3, 1000, False, 25000)
FLq = ad.ApproximateCoefficientFunction(3, 'L', 'q', True, "exact", 1e-3, 1e-3, 1000, False, 25000)

Expand Down
4 changes: 2 additions & 2 deletions inc/adani/ApproximateCoefficientFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class ApproximateCoefficientFunction : public AbstractApproximate {
ApproximateCoefficientFunction(
const int &order, const char &kind, const char &channel,
const bool &NLL = true,
const string &highscale_version = "original",
const string &highscale_version = "klmv",
const double &abserr = 1e-3, const double &relerr = 1e-3,
const int &dim = 1000, const bool &MCintegral = false,
const int &MCcalls = 25000
Expand Down Expand Up @@ -122,7 +122,7 @@ class ApproximateCoefficientFunctionKLMV : public AbstractApproximate {
public:
ApproximateCoefficientFunctionKLMV(
const int &order, const char &kind, const char &channel,
const string &highscale_version = "original",
const string &highscale_version = "klmv",
const bool &lowxi = false, const double &abserr = 1e-3,
const double &relerr = 1e-3, const int &dim = 1000,
const bool &MCintegral = false, const int &MCcalls = 25000
Expand Down
2 changes: 1 addition & 1 deletion inc/adani/AsymptoticCoefficientFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class AsymptoticCoefficientFunction
public:
AsymptoticCoefficientFunction(
const int &order, const char &kind, const char &channel,
const bool &NLL = true, const string &highscale_version = "original"
const bool &NLL = true, const string &highscale_version = "klmv"
);
~AsymptoticCoefficientFunction();

Expand Down
2 changes: 1 addition & 1 deletion inc/adani/HighScaleCoefficientFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class HighScaleCoefficientFunction : public CoefficientFunction {
public:
HighScaleCoefficientFunction(
const int &order, const char &kind, const char &channel,
const string &version = "original"
const string &version = "klmv"
);
~HighScaleCoefficientFunction() override;

Expand Down
2 changes: 1 addition & 1 deletion inc/adani/HighScaleSplitLogs.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class HighScaleSplitLogs : public CoefficientFunction {
public:
HighScaleSplitLogs(
const int &order, const char &kind, const char &channel,
const string &version = "original"
const string &version = "klmv"
);
~HighScaleSplitLogs() override;

Expand Down
2 changes: 1 addition & 1 deletion output/output_grid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ int main(int argc, char **argv) {
if (channel == 'q')
hs_version = "exact";
else
hs_version = "improved";
hs_version = "abmp";

ApproximateCoefficientFunction Approx =
ApproximateCoefficientFunction(3, kind, channel, true, hs_version);
Expand Down
2 changes: 1 addition & 1 deletion output/output_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
mufrac = runcard["mufrac"]
v = runcard.get("v", 0)

hs_version = "exact" if runcard["channel"][1] == 'q' else "improved"
hs_version = "exact" if runcard["channel"][1] == 'q' else "abmp"
appr = adani.ApproximateCoefficientFunction(3, runcard["channel"][0], runcard["channel"][1], True, hs_version, 1e-3, 1e-3, 1000, False, 25000)

def function_to_exe_in_parallel(pair):
Expand Down
10 changes: 5 additions & 5 deletions pywrap/pywrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ PYBIND11_MODULE(_core, m) {
const string &, const double &, const double &, const int &,
const bool &, const int &>(),
py::arg("order"), py::arg("kind"), py::arg("channel"),
py::arg("NLL") = true, py::arg("highscale_version") = "original",
py::arg("NLL") = true, py::arg("highscale_version") = "klmv",
py::arg("abserr") = 1e-3, py::arg("relerr") = 1e-3,
py::arg("dim") = 1000, py::arg("MCintegral") = false,
py::arg("MCcalls") = 25000
Expand Down Expand Up @@ -85,7 +85,7 @@ PYBIND11_MODULE(_core, m) {
const bool &, const double &, const double &, const int &,
const bool &, const int &>(),
py::arg("order"), py::arg("kind"), py::arg("channel"),
py::arg("highscale_version") = "original", py::arg("lowxi") = false,
py::arg("highscale_version") = "klmv", py::arg("lowxi") = false,
py::arg("abserr") = 1e-3, py::arg("relerr") = 1e-3,
py::arg("dim") = 1000, py::arg("MCintegral") = false,
py::arg("MCcalls") = 25000
Expand Down Expand Up @@ -118,7 +118,7 @@ PYBIND11_MODULE(_core, m) {
const int &, const char &, const char &, const bool &,
const string &>(),
py::arg("order"), py::arg("kind"), py::arg("channel"),
py::arg("NLL") = true, py::arg("highscale_version") = "original"
py::arg("NLL") = true, py::arg("highscale_version") = "klmv"
)
.def(
"MuIndependentTerms",
Expand Down Expand Up @@ -251,7 +251,7 @@ PYBIND11_MODULE(_core, m) {
.def(
py::init<const int &, const char &, const char &, const string &>(),
py::arg("order"), py::arg("kind"), py::arg("channel"),
py::arg("version") = "original"
py::arg("version") = "klmv"
)
.def(
"MuIndependentTerms",
Expand All @@ -276,7 +276,7 @@ PYBIND11_MODULE(_core, m) {
.def(
py::init<const int &, const char &, const char &, const string &>(),
py::arg("order"), py::arg("kind"), py::arg("channel"),
py::arg("version") = "original"
py::arg("version") = "klmv"
)
.def(
"fx", (double(HighScaleSplitLogs::*)(double, double, int) const)
Expand Down
35 changes: 26 additions & 9 deletions src/MatchingCondition.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,22 @@ MatchingCondition::MatchingCondition(
entry2_ = entry2;

// check version
if (version != "exact" && version != "improved" && version != "original"
if (version != "exact" && version != "abmp" && version != "klmv"
&& version != "abbdvss") {
cout << "Error: version must be 'exact', 'improved', 'abbdvss' or "
"'original'! Got "
cout << "Error: version must be 'exact', 'abmp', 'abbdvss' or "
"'klmv'! Got "
<< version << endl;
exit(-1);
}

if (entry2 == 'q' && (version == "improved" || version == "abbdvss")) {
cout << "Error: quark channel doesn't have 'improved' or 'abbdvss' "
if (entry2 == 'g' && version == "exact") {
cout << "Error: aQg channel doesn't have 'exact' version!"
<< endl;
exit(-1);
}

if (entry2 == 'q' && (version == "abmp" || version == "abbdvss")) {
cout << "Error: aQq channel doesn't have 'abmp' or 'abbdvss' "
"version!"
<< endl;
exit(-1);
Expand All @@ -67,13 +73,17 @@ Value MatchingCondition::MuIndependentNfIndependentTerm(double x) const {
if (entry2_ == 'q') {
if (version_ == "exact")
return Value(a_Qq_PS_30(x, 0));
else {
else if (version_ == "klmv") {
higher = a_Qq_PS_30(x, 1);
lower = a_Qq_PS_30(x, -1);
central = 0.5 * (higher + lower);
if (higher < lower)
return Value(central, lower, higher);
return Value(central, higher, lower);
} else {
cout << "Error: something has gone wrong in MatchingCondition::MuIndependentNfIndependentTerm"
<< endl;
exit(-1);
}
} else {
int low_id;
Expand All @@ -84,10 +94,17 @@ Value MatchingCondition::MuIndependentNfIndependentTerm(double x) const {
// This version doesn't have an uncertainty band
// so returning the same value three times
return Value(a_Qg_30(x, 2));
else if (version_ == "improved")
// abmp = Alekhin, Blumlein, Moch, Placakyte
else if (version_ == "abmp")
low_id = -1;
else
// klmv = Kawamura, Lo Presti, Moch, Vogt
else if (version_ == "klmv")
low_id = -12;
else {
cout << "Error: something has gone wrong in MatchingCondition::MuIndependentNfIndependentTerm"
<< endl;
exit(-1);
}

higher = a_Qg_30(x, 1);
lower = a_Qg_30(x, low_id);
Expand Down Expand Up @@ -121,7 +138,7 @@ vector<double> MatchingCondition::NotOrdered(double x) const {
if (version_ == "exact") {
central = a_Qg_30(x, 0);
return { central, central, central };
} else if (version_ == "improved")
} else if (version_ == "abmp")
low_id = -1;
else
low_id = -12;
Expand Down
14 changes: 7 additions & 7 deletions tests/test_approx_coeff_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def test_mudependent_terms():
for abserr in [1e-3]:
relerr = abserr
massive = ad.ExactCoefficientFunction(order, kind, channel, abserr, relerr, dim, mf, MCcalls)
app = ad.ApproximateCoefficientFunction(order, kind, channel, True, "original", abserr, relerr, dim, mf, MCcalls)
app = ad.ApproximateCoefficientFunction(order, kind, channel, True, "klmv", abserr, relerr, dim, mf, MCcalls)
x = np.geomspace(1e-5, 1., 5, endpoint=True)
for xi in np.geomspace(1e-2, 1e4, 4, endpoint=True):
for nf in [4, 5]:
Expand Down Expand Up @@ -52,7 +52,7 @@ def test_as2_muindep_oldversion():
def test_as3_muindep_oldversion():
for channel in ['g', 'q']:
for kind in ['2', 'L']:
highscale_version = "exact" if channel == 'q' else "improved"
highscale_version = "exact" if channel == 'q' else "abmp"
app = ad.ApproximateCoefficientFunction(3, kind, channel,True, highscale_version)
for xi in np.geomspace(1e-2, 1e2, 10):
m2Q2 = 1/xi
Expand Down Expand Up @@ -107,7 +107,7 @@ def test_mudep_as2_oldversion():
def test_mudep_as3_oldversion():
for channel in ['g', 'q']:
for kind in ['2', 'L']:
highscale_version = "exact" if channel == 'q' else "improved"
highscale_version = "exact" if channel == 'q' else "abmp"
for mf in [False]:
app = ad.ApproximateCoefficientFunction(3, kind, channel, True, highscale_version, 1e-3, 1e-3, 1000, mf, 25000)
for xi in np.geomspace(1e-2, 1e2, 10):
Expand All @@ -134,7 +134,7 @@ def test_mudep_as3_oldversion():

def test_klmv_as2():
for channel in ['g', 'q']:
app = ad.ApproximateCoefficientFunctionKLMV(2, '2', channel, "improved")
app = ad.ApproximateCoefficientFunctionKLMV(2, '2', channel, "abmp")
for xi in np.geomspace(1e-2, 1e2, 10):
m2Q2 = 1/xi
for x in np.geomspace(1e-5, 1, 10):
Expand All @@ -156,7 +156,7 @@ def test_klmv_as2():

def test_klmv_as3():
for channel in ['g', 'q']:
hs_version = "improved" if channel == 'g' else 'exact'
hs_version = "abmp" if channel == 'g' else 'exact'
app = ad.ApproximateCoefficientFunctionKLMV(3, '2', channel, hs_version)
for xi in np.geomspace(1e-2, 1e2, 10):
m2Q2 = 1/xi
Expand All @@ -180,7 +180,7 @@ def test_klmv_as3():

def test_klmv_paper_as3():
for channel in ['g', 'q']:
app = ad.ApproximateCoefficientFunctionKLMV(3, '2', channel, "original")
app = ad.ApproximateCoefficientFunctionKLMV(3, '2', channel, "klmv")
for xi in np.geomspace(1e-2, 1e2, 10):
m2Q2 = 1/xi
for x in np.geomspace(1e-5, 1, 10):
Expand All @@ -202,7 +202,7 @@ def test_klmv_paper_as3():
np.testing.assert_allclose(lower, tmp.GetLower(), rtol=1e-7)

def test_klmv_lowxi_as3():
app = ad.ApproximateCoefficientFunctionKLMV(3, '2', 'g', "original", True)
app = ad.ApproximateCoefficientFunctionKLMV(3, '2', 'g', "klmv", True)
for xi in np.geomspace(1e-2, 1e2, 10):
m2Q2 = 1/xi
for x in np.geomspace(1e-5, 1, 10):
Expand Down
6 changes: 3 additions & 3 deletions tests/test_asy.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def test_as2():
def test_as3():
for kind in ['2', 'L']:
for channel in ['g', 'q']:
hs_version = "exact" if channel == 'q' else "improved"
hs_version = "exact" if channel == 'q' else "abmp"
asy = ad.AsymptoticCoefficientFunction(3, kind, channel, True, hs_version)
for m2Q2 in np.geomspace(1e-2, 1e4, 10):
for m2mu2 in np.geomspace(1e-2, 1e4, 10):
Expand All @@ -47,8 +47,8 @@ def test_asy():
for channel in ['g', 'q']:
if order == 1 and channel == 'q':
continue
for hs_version in ["exact", "improved", "original"]:
if channel == 'q' and hs_version == "improved":
for hs_version in ["exact", "abmp", "klmv"]:
if channel == 'q' and hs_version == "abmp":
continue
if channel == 'g' and hs_version == "exact":
continue
Expand Down
10 changes: 5 additions & 5 deletions tests/test_high_scale.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_as2_oldadani():
def test_as3_oldadani():
for kind in ['2', 'L']:
for channel in ['g', 'q']:
version = "exact" if channel == 'q' else "improved"
version = "exact" if channel == 'q' else "abmp"
hs = ad.HighScaleCoefficientFunction(3, kind, channel, version)
for x in np.geomspace(1e-5, 1., 100, endpoint=False):
for m2Q2 in np.geomspace(1e-4, 1e-2, 10):
Expand All @@ -52,8 +52,8 @@ def test_as3_oldadani():
def test_splitlogs_vs_highscale():
for kind in ['2', 'L']:
for channel in ['g', 'q']:
for hs_version in ["exact", "improved", "original"]:
if channel == 'q' and hs_version == "improved":
for hs_version in ["exact", "abmp", "klmv"]:
if channel == 'q' and hs_version == "abmp":
continue
if channel == 'g' and hs_version == "exact":
continue
Expand All @@ -75,8 +75,8 @@ def test_splitlogs_vs_highscale():
def test_split_logs():
for kind in ['2', 'L']:
for channel in ['g', 'q']:
for hs_version in ["exact", "improved", "original"]:
if channel == 'q' and hs_version == "improved":
for hs_version in ["exact", "abmp", "klmv"]:
if channel == 'q' and hs_version == "abmp":
continue
if channel == 'g' and hs_version == "exact":
continue
Expand Down

0 comments on commit 55de6cb

Please sign in to comment.