diff --git a/src/pineko/check.py b/src/pineko/check.py index 68365ae1..aad141d3 100644 --- a/src/pineko/check.py +++ b/src/pineko/check.py @@ -67,6 +67,31 @@ def check_grid_and_eko_compatible(pineappl_grid, operators, xif): raise ValueError("x grid in pineappl grid and eko operator are NOT compatible!") +def is_fonll_b(fns, lumi): + """Check if the fktable we are computing is a DIS FONLL-B fktable. + + Parameters + ---------- + fns : str + flavor number scheme (from the theory card) + lumi : list(list(tuple)) + luminosity info + + Returns + ------- + : bool + true if the fktable is a FONLL-B DIS fktable + """ + for lists in lumi: + for el in lists: + if not (10 < abs(el[1]) < 17): + # in this case we are sure it is not DIS so for sure it is not FONLL-B + return False + if fns == "FONLL-B": + return True + return False + + def contains_fact(grid): """Check whether factorization scale-variations are available in the pineappl grid. diff --git a/src/pineko/theory.py b/src/pineko/theory.py index e27b4e8c..69091257 100644 --- a/src/pineko/theory.py +++ b/src/pineko/theory.py @@ -351,11 +351,11 @@ def fk(self, name, grid_path, tcard, pdf): xir = tcard["XIR"] xif = tcard["XIF"] ftr = tcard["fact_to_ren_scale_ratio"] - pineappl_grid = pineappl.grid.Grid.read(grid_path) + grid = pineappl.grid.Grid.read(grid_path) if not np.isclose(xir, 1.0): - check.contains_ren(pineappl_grid) + check.contains_ren(grid) if not (np.isclose(xif, 1.0) and np.isclose(ftr, 1.0)): - check.contains_fact(pineappl_grid) + check.contains_fact(grid) # setup data eko_filename = self.ekos_path() / f"{name}.tar" fk_filename = self.fks_path / f"{name}.{parser.EXT}" @@ -364,6 +364,12 @@ def fk(self, name, grid_path, tcard, pdf): rich.print(f"Skipping existing FK Table {fk_filename}") return max_as = 1 + int(tcard["PTO"]) + # Check if we are computing FONLL-B fktable and eventually change max_as + if check.is_fonll_b( + tcard["FNS"], + grid.lumi(), + ): + max_as += 1 max_al = 0 # collect alpha_s # TODO: move this down to evolve.evolve_grid when output contains cards @@ -391,7 +397,7 @@ def fk(self, name, grid_path, tcard, pdf): f"with max_as={max_as}, max_al={max_al}, xir={xir}, xif={xif}", ) _grid, _fk, comparison = evolve.evolve_grid( - pineappl_grid, + grid, eko_filename, fk_filename, max_as, diff --git a/tests/test_check.py b/tests/test_check.py index e7374fa7..4798eae1 100644 --- a/tests/test_check.py +++ b/tests/test_check.py @@ -8,7 +8,6 @@ import pineko.check - class Fake_grid: def __init__(self, order_list): self.orderlist = order_list @@ -49,3 +48,14 @@ def test_contains_ren(): mygrid_nofact = Fake_grid(order_list) with pytest.raises(ValueError): pineko.check.contains_ren(mygrid_nofact) + + +def test_is_fonll_b(): + fns = "FONLL-B" + lumi = [[(1, 11, 3, 4), (3, 11, 5, 6)], [(9, 11, 0, 3), (8, 11, -2, -1)]] + assert pineko.check.is_fonll_b(fns, lumi) is True + lumi.append([(1, 11, 2, 3), (2, 4, 5, 6)]) + assert pineko.check.is_fonll_b(fns, lumi) is False + lumi.pop(-1) + fns = "FONLL-C" + assert pineko.check.is_fonll_b(fns, lumi) is False