Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check three convolutions involving time-like hadron #329

Merged
merged 7 commits into from
Feb 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
1 change: 1 addition & 0 deletions maintainer/download-test-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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'
2 changes: 2 additions & 0 deletions maintainer/pineappl-ci/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ pdf_sets=(
NNPDF40_nlo_as_01180
NNPDF40_nlo_pch_as_01180
NNPDF40_nnlo_as_01180
NNPDFpol11_100
MAPFF10NLOPIsum
)

apt update
Expand Down
25 changes: 25 additions & 0 deletions pineappl_cli/tests/convolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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);
}
10 changes: 7 additions & 3 deletions pineappl_py/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
43 changes: 43 additions & 0 deletions pineappl_py/tests/test_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down