From d71ac51abfa98ddaca5fb46e52b9b4cb15c7f2bb Mon Sep 17 00:00:00 2001 From: Radonirinaunimi Date: Mon, 18 Nov 2024 21:36:05 +0100 Subject: [PATCH] Exposes `pineappl.convolutions.Conv.pid` for `validphys` --- pineappl_py/src/convolutions.rs | 7 +++++++ pineappl_py/tests/test_fk_table.py | 3 +++ pineappl_py/tests/test_grid.py | 3 +++ 3 files changed, 13 insertions(+) diff --git a/pineappl_py/src/convolutions.rs b/pineappl_py/src/convolutions.rs index c7a0f050..57251c37 100644 --- a/pineappl_py/src/convolutions.rs +++ b/pineappl_py/src/convolutions.rs @@ -70,6 +70,13 @@ impl PyConv { convtype: self.conv.conv_type(), } } + + /// Return the PID of this convolution. + #[getter] + #[must_use] + pub const fn pid(&self) -> i32 { + self.conv.pid() + } } /// Register submodule in parent. diff --git a/pineappl_py/tests/test_fk_table.py b/pineappl_py/tests/test_fk_table.py index dbf32740..8a7b7cdb 100644 --- a/pineappl_py/tests/test_fk_table.py +++ b/pineappl_py/tests/test_fk_table.py @@ -153,6 +153,9 @@ def test_polarized_convolution( assert not convolutions[0].conv_type.time_like assert not convolutions[1].conv_type.polarized assert not convolutions[1].conv_type.time_like + # Check that the initial states are protons + assert convolutions[0].pid == 2212 + assert convolutions[1].pid == 2212 # Convolution object of the 1st hadron - Polarized h1 = ConvType(polarized=True, time_like=False) diff --git a/pineappl_py/tests/test_grid.py b/pineappl_py/tests/test_grid.py index 6a5a88fb..0a1ad2ce 100644 --- a/pineappl_py/tests/test_grid.py +++ b/pineappl_py/tests/test_grid.py @@ -340,6 +340,9 @@ def test_polarized_convolution( assert not convolutions[0].conv_type.time_like assert not convolutions[1].conv_type.polarized assert not convolutions[1].conv_type.time_like + # Check that the initial states are protons + assert convolutions[0].pid == 2212 + assert convolutions[1].pid == 2212 # Convolution object of the 1st hadron - Polarized h1 = ConvType(polarized=True, time_like=False)