Skip to content

Commit 2dc4d30

Browse files
Infer if a grid is DIS from the number of convolutions
1 parent 69268eb commit 2dc4d30

4 files changed

Lines changed: 24 additions & 29 deletions

File tree

src/pineko/check.py

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -111,43 +111,38 @@ def check_grid_and_eko_compatible(pineappl_grid, operators, xif, max_as, max_al)
111111
raise ValueError("x grid in pineappl grid and eko operator are NOT compatible!")
112112

113113

114-
def is_dis(channels):
114+
def is_dis(convolutions):
115115
"""Check if the fktable we are computing is a DIS fktable.
116116
117117
Parameters
118118
----------
119-
channels : list(list(tuple(list, float)))
120-
object containing the information on the channels. From PineAPPL v1,
121-
the tuple contains two elements. The first is a list containing the
122-
PIDs of the partons. The length of the list coincides with the number
123-
of partons involved, ie for DIS there is only one element, and for a
124-
hadron production in pp collision there are three elements. The 2nd
125-
element is the weight/multiplicative factor.
119+
convolutions: pineappl.grid.convolutions
120+
an object containing the information on the convolution
126121
127122
Returns
128123
-------
129124
bool
130125
true if the fktable is a DIS fktable
131126
"""
132-
return True if len(channels[0][0][0]) == 1 else False
127+
return True if len(convolutions) == 1 else False
133128

134129

135-
def is_fonll_mixed(fns, lumi):
130+
def is_fonll_mixed(fns, convolutions):
136131
"""Check if the fktable we are computing is FONLL-B, FONLL-D or, in general, a mixed FONLL fktable.
137132
138133
Parameters
139134
----------
140135
fns : str
141136
flavor number scheme (from the theory card)
142-
lumi : list(list(tuple))
143-
luminosity info
137+
convolutions: pineappl.grid.convolutions
138+
an object containing the information on the convolution
144139
145140
Returns
146141
-------
147142
bool
148143
true if the fktable is a mixed FONLL DIS fktable
149144
"""
150-
return is_dis(lumi) and fns in ["FONLL-B", "FONLL-D"]
145+
return is_dis(convolutions) and fns in ["FONLL-B", "FONLL-D"]
151146

152147

153148
def is_num_fonll(fns):

src/pineko/evolve.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def write_operator_card(
173173
"""
174174
# Add a +1 to the orders for the difference in convention between nnpdf and pineappl
175175
# NB: This would not happen for nFONLL
176-
is_fns = int(check.is_fonll_mixed(tcard["FNS"], pineappl_grid.channels()))
176+
is_fns = int(check.is_fonll_mixed(tcard["FNS"], pineappl_grid.convolutions))
177177
max_as = 1 + tcard["PTO"] + is_fns
178178
max_al = 1 + tcard["QED"]
179179
# ... in order to create a mask ...

src/pineko/theory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ def fk(self, name, grid_path, tcard, pdfs):
448448
# Check if we are computing FONLL-B fktable and eventually change max_as
449449
if check.is_fonll_mixed(
450450
tcard["FNS"],
451-
grid.channels(),
451+
grid.convolutions,
452452
):
453453
max_as += 1
454454

tests/test_check.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,28 @@ def test_in1d():
1414

1515

1616
def test_is_dis():
17-
dis_fake_lumi = [[([-13], 1.0), ([11], 2.0)]]
18-
nondis_fake_lumi = [[([1, 2], 1.5), ([2, 1], 3.0)]]
17+
dis_fake_lumi = ["UnpolPDF"]
18+
nondis_fake_lumi = ["UnpolPDF", "UnpolPDF"]
1919
assert pineko.check.is_dis(dis_fake_lumi) is True
2020
assert pineko.check.is_dis(nondis_fake_lumi) is False
2121

2222

2323
def test_is_fonll_mixed():
2424
fns = "FONLL-B"
25-
lumi_first = [[([-12], 2.0), ([-13], 5.0)]]
26-
lumi_second = [[([11], 1.0), ([11], 5.0)]]
27-
assert pineko.check.is_fonll_mixed(fns, lumi_first) is True
28-
assert pineko.check.is_fonll_mixed(fns, lumi_second) is True
29-
lumi_crazy = [[([1, 1], 4.0), ([2, 11], 3.0)]]
30-
assert pineko.check.is_fonll_mixed(fns, lumi_crazy) is False
25+
convolutions_first = ["UnpolPDF"]
26+
convolutions_second = ["PolPDF"]
27+
assert pineko.check.is_fonll_mixed(fns, convolutions_first) is True
28+
assert pineko.check.is_fonll_mixed(fns, convolutions_second) is True
29+
convolutions_crazy = ["UnpolPDF", "UnpolFF"]
30+
assert pineko.check.is_fonll_mixed(fns, convolutions_crazy) is False
3131
fns = "FONLL-C"
32-
assert pineko.check.is_fonll_mixed(fns, lumi_first) is False
33-
assert pineko.check.is_fonll_mixed(fns, lumi_second) is False
34-
assert pineko.check.is_fonll_mixed(fns, lumi_crazy) is False
32+
assert pineko.check.is_fonll_mixed(fns, convolutions_first) is False
33+
assert pineko.check.is_fonll_mixed(fns, convolutions_second) is False
34+
assert pineko.check.is_fonll_mixed(fns, convolutions_crazy) is False
3535
fns = "FONLL-D"
36-
assert pineko.check.is_fonll_mixed(fns, lumi_first) is True
37-
assert pineko.check.is_fonll_mixed(fns, lumi_second) is True
38-
assert pineko.check.is_fonll_mixed(fns, lumi_crazy) is False
36+
assert pineko.check.is_fonll_mixed(fns, convolutions_first) is True
37+
assert pineko.check.is_fonll_mixed(fns, convolutions_second) is True
38+
assert pineko.check.is_fonll_mixed(fns, convolutions_crazy) is False
3939

4040

4141
def test_is_num_fonll():

0 commit comments

Comments
 (0)