Skip to content

Commit a14eb3c

Browse files
Check three convolutions with FF in Python tests
1 parent 8297dfc commit a14eb3c

File tree

2 files changed

+50
-3
lines changed

2 files changed

+50
-3
lines changed

pineappl_py/tests/conftest.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,17 @@ def xfxQ(self, pid, x, q):
7979
def alphasQ(self, q):
8080
return 1.0
8181

82+
# Define the Toy Unpolarized PDF set
83+
def unpolarized_pdf(self, pid, x, q2):
84+
return 1.0
85+
8286
# Define the Toy Polarized PDF set
8387
def polarized_pdf(self, pid, x, q2):
8488
return 2.0
8589

86-
# Define the Toy Unpolarized PDF set
87-
def unpolarized_pdf(self, pid, x, q2):
88-
return 1.0
90+
# Define the Toy Fragmentation set
91+
def ff_set(self, pid, x, q2):
92+
return 3.0
8993

9094

9195
class FakeGrid:

pineappl_py/tests/test_grid.py

+43
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,49 @@ def test_polarized_convolution(
482482
expected_results,
483483
)
484484

485+
def test_three_convolutions_with_ff(
486+
self,
487+
pdf,
488+
download_objects,
489+
gridname: str = "SIHP-PP-POLARIZED-STAR-NLO.pineappl.lz4",
490+
):
491+
expected_results = [
492+
-3.90292729e09,
493+
+3.43682719e11,
494+
-3.58390524e10,
495+
-4.66855347e10,
496+
-2.15171695e09,
497+
+1.57010877e10,
498+
] # Numbers computed using `v1.0.0a2`
499+
500+
grid = download_objects(f"{gridname}")
501+
g = Grid.read(grid)
502+
503+
# Check the Grid convolutions - can be used to construct `grid.convolve`
504+
convolutions = g.convolutions
505+
assert len(convolutions) == 3
506+
# Check the polarization
507+
assert convolutions[0].convolution_types.polarized
508+
assert convolutions[1].convolution_types.polarized
509+
assert not convolutions[2].convolution_types.polarized
510+
# Check if it is timelike
511+
assert not convolutions[0].convolution_types.time_like
512+
assert not convolutions[1].convolution_types.time_like
513+
assert convolutions[2].convolution_types.time_like
514+
# Check that the initial states are protons
515+
assert convolutions[0].pid == 2212
516+
assert convolutions[1].pid == 2212
517+
assert convolutions[2].pid == 211
518+
519+
np.testing.assert_allclose(
520+
g.convolve(
521+
pdg_convs=g.convolutions,
522+
xfxs=[pdf.polarized_pdf, pdf.polarized_pdf, pdf.ff_set],
523+
alphas=pdf.alphasQ,
524+
),
525+
expected_results,
526+
)
527+
485528
def test_many_convolutions(self, fake_grids, pdf, nb_convolutions: int = 3):
486529
"""Test for fun many convolutions."""
487530
expected_results = [

0 commit comments

Comments
 (0)