CRPropa / CRPropa3

CRPropa is a public astrophysical simulation framework for propagating extraterrestrial ultra-high energy particles. https://crpropa.github.io/CRPropa3/
https://crpropa.desy.de
GNU General Public License v3.0
65 stars 66 forks source link

Possible fix for wrong secondary masses of photons and neutrinos #484

Closed LeanderSchlegel closed 2 months ago

LeanderSchlegel commented 2 months ago

Dear all,

with this PR we try to fix #483. @lukasmerten, @JulienDoerner and me discussed it and introduced a new function particleMass(int id) in ParticleMass.cpp to fix the bug by calling it in setId(int newId) in ParticleState.cpp. It gives all particles other than nuclei or electrons/positrons a zero rest-mass and could possibly be extended for other particles when needed.

lukasmerten commented 2 months ago

Looks good to me. Let's wait for more comments otherwise I will merge in the next days.

LeanderSchlegel commented 2 months ago

Thank you very much for your feedback! As suggested by Julien and in discussion with him, I added two small tests in testCore, one extending the test of addSecondary to also check their masses and one new test, covering the new function particleMass(int id).