From 95971817cb7a04acd9fc9ffd69ed979bff4ea2aa Mon Sep 17 00:00:00 2001 From: ibrahmkocaa Date: Wed, 15 Jul 2026 12:24:31 +0300 Subject: [PATCH] Fix ParticleHP fission nubar evaluated at wrong energy in const getters GetMean/GetPrompt/GetDelayed(G4double) are const, so the interpolating non-const G4ParticleHPVector::GetY(G4double) is not viable on the const member vectors. Overload resolution falls back to GetY(G4int) const via an implicit double->int conversion and the yield is read as table point floor(E) instead of nubar(E), i.e. the thermal value at all reactor energies (2.4254 for U-235, G4NDL 4.7.1). All ParticleHP fission multiplicities come from these getters through G4ParticleHPFSFissionFS::SampleNeutronMult. On the Godiva benchmark (ICSBEP HEU-MET-FAST-001) this costs about 6300 pcm: keff goes from 0.9362 +/- 0.0024 to 0.9969 +/- 0.0025 with this change (benchmark 1.0000 +/- 0.0010), and the measured nubar(E) rises with energy again. Reach the interpolating lookup through const_cast; behavior of the non-const path is unchanged. --- .../include/G4ParticleHPParticleYield.hh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/source/processes/hadronic/models/particle_hp/include/G4ParticleHPParticleYield.hh b/source/processes/hadronic/models/particle_hp/include/G4ParticleHPParticleYield.hh index 8857a17f15b..717fca32f83 100644 --- a/source/processes/hadronic/models/particle_hp/include/G4ParticleHPParticleYield.hh +++ b/source/processes/hadronic/models/particle_hp/include/G4ParticleHPParticleYield.hh @@ -105,11 +105,18 @@ class G4ParticleHPParticleYield } } + // The interpolating G4ParticleHPVector::GetY(G4double) overload is + // non-const, so on the const-qualified member vectors below overload + // resolution used to fall back silently to GetY(G4int) const via an + // implicit double->int conversion: the fission neutron yield was read + // as "y of table point floor(E)" - i.e. the thermal nubar for all + // reactor-relevant energies - instead of nubar(E). The const_casts + // restore the energy-interpolating lookup. inline G4double GetMean(G4double anEnergy) const { if (simpleMean) { - return theSimpleMean.GetY(anEnergy); + return const_cast(theSimpleMean).GetY(anEnergy); } return theMean.GetValue(anEnergy); } @@ -121,7 +128,7 @@ class G4ParticleHPParticleYield { return theSpontPrompt; } - return thePrompt.GetY(anEnergy); + return const_cast(thePrompt).GetY(anEnergy); } inline G4double GetDelayed(G4double anEnergy) const @@ -131,7 +138,7 @@ class G4ParticleHPParticleYield { return theSpontDelayed; } - return theDelayed.GetY(anEnergy); + return const_cast(theDelayed).GetY(anEnergy); } inline G4double GetDecayConstant(G4int i) const