diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 0ff3403a..9ddec0b8 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -25,7 +25,7 @@ jobs: uses: actions/cache@v4 with: path: test-data - key: test-data-v17 + key: test-data-v18 - name: Download test data if: steps.cache-test-data.outputs.cache-hit != 'true' run: | diff --git a/maintainer/download-test-data.sh b/maintainer/download-test-data.sh index 4155e1b1..e5efb244 100755 --- a/maintainer/download-test-data.sh +++ b/maintainer/download-test-data.sh @@ -48,3 +48,4 @@ download 'https://data.nnpdf.science/pineappl/test-data/STAR_WMWP_510GEV_WM-AL-P download 'https://data.nnpdf.science/pineappl/test-data/STAR_WMWP_510GEV_WM-AL-POL_UnpolPDF.tar' download 'https://data.nnpdf.science/pineappl/test-data/ZEUS_2JET_319GEV_374PB-1_DIF_ETQ2_BIN6.pineappl.lz4' download 'https://data.nnpdf.science/pineappl/test-data/ZEUS_2JET_319GEV_374PB-1_DIF_ETQ2_BIN6.tar' +download 'https://data.nnpdf.science/pineappl/test-data/SIHP-PP-POLARIZED-STAR-NLO.pineappl.lz4' diff --git a/maintainer/pineappl-ci/script.sh b/maintainer/pineappl-ci/script.sh index 953f3a43..93b0b26b 100755 --- a/maintainer/pineappl-ci/script.sh +++ b/maintainer/pineappl-ci/script.sh @@ -21,6 +21,8 @@ pdf_sets=( NNPDF40_nlo_as_01180 NNPDF40_nlo_pch_as_01180 NNPDF40_nnlo_as_01180 + NNPDFpol11_100 + MAPFF10NLOPIsum ) apt update diff --git a/pineappl_cli/tests/convolve.rs b/pineappl_cli/tests/convolve.rs index 3822634e..fd646d58 100644 --- a/pineappl_cli/tests/convolve.rs +++ b/pineappl_cli/tests/convolve.rs @@ -186,6 +186,17 @@ const XIR_XIF_STR: &str = "b etal dsig/detal 7 4 4.5 2.7565811e1 "; +const THREE_CONVOLUTIONS_STR: &str = "b pT dsig/dpT (pol) + [GeV] [pb/GeV] +-+-----------------+------------------+-------------- +0 5.108395099639893 6.045444965362549 2.2605116e3 +1 6.045444965362549 6.982494831085205 1.0361301e3 +2 6.982494831085205 7.992245197296143 4.8947508e2 +3 7.992245197296143 8.960753917694092 2.4023939e2 +4 8.960753917694092 9.929026126861572 1.2464463e2 +5 9.929026126861572 11.660773754119873 5.2680349e1 +"; + #[test] fn help() { Command::cargo_bin("pineappl") @@ -409,3 +420,17 @@ fn xir_xif() { .success() .stdout(XIR_XIF_STR); } + +#[test] +fn three_convolutions() { + Command::cargo_bin("pineappl") + .unwrap() + .args([ + "convolve", + "../test-data/SIHP-PP-POLARIZED-STAR-NLO.pineappl.lz4", + "NNPDFpol11_100+p,MAPFF10NLOPIsum+f", + ]) + .assert() + .success() + .stdout(THREE_CONVOLUTIONS_STR); +} diff --git a/pineappl_py/tests/conftest.py b/pineappl_py/tests/conftest.py index ff18abea..62a15146 100644 --- a/pineappl_py/tests/conftest.py +++ b/pineappl_py/tests/conftest.py @@ -79,13 +79,17 @@ def xfxQ(self, pid, x, q): def alphasQ(self, q): return 1.0 + # Define the Toy Unpolarized PDF set + def unpolarized_pdf(self, pid, x, q2): + return 1.0 + # Define the Toy Polarized PDF set def polarized_pdf(self, pid, x, q2): return 2.0 - # Define the Toy Unpolarized PDF set - def unpolarized_pdf(self, pid, x, q2): - return 1.0 + # Define the Toy Fragmentation set + def ff_set(self, pid, x, q2): + return 3.0 class FakeGrid: diff --git a/pineappl_py/tests/test_grid.py b/pineappl_py/tests/test_grid.py index 396574a2..501e0d43 100644 --- a/pineappl_py/tests/test_grid.py +++ b/pineappl_py/tests/test_grid.py @@ -482,6 +482,49 @@ def test_polarized_convolution( expected_results, ) + def test_three_convolutions_with_ff( + self, + pdf, + download_objects, + gridname: str = "SIHP-PP-POLARIZED-STAR-NLO.pineappl.lz4", + ): + expected_results = [ + -3.90292729e09, + +3.43682719e11, + -3.58390524e10, + -4.66855347e10, + -2.15171695e09, + +1.57010877e10, + ] # Numbers computed using `v1.0.0a2` + + grid = download_objects(f"{gridname}") + g = Grid.read(grid) + + # Check the Grid convolutions - can be used to construct `grid.convolve` + convolutions = g.convolutions + assert len(convolutions) == 3 + # Check the polarization + assert convolutions[0].convolution_types.polarized + assert convolutions[1].convolution_types.polarized + assert not convolutions[2].convolution_types.polarized + # Check if it is timelike + assert not convolutions[0].convolution_types.time_like + assert not convolutions[1].convolution_types.time_like + assert convolutions[2].convolution_types.time_like + # Check that the initial states are protons + assert convolutions[0].pid == 2212 + assert convolutions[1].pid == 2212 + assert convolutions[2].pid == 211 + + np.testing.assert_allclose( + g.convolve( + pdg_convs=g.convolutions, + xfxs=[pdf.polarized_pdf, pdf.polarized_pdf, pdf.ff_set], + alphas=pdf.alphasQ, + ), + expected_results, + ) + def test_many_convolutions(self, fake_grids, pdf, nb_convolutions: int = 3): """Test for fun many convolutions.""" expected_results = [