smash-transport / sparkx

SPARKX - Software Package for Analyzing Relativistic Kinematics in Collision eXperiments
https://smash-transport.github.io/sparkx/
GNU General Public License v3.0
5 stars 0 forks source link

Bug in charge setting for Jetscpe particles #231

Closed Hendrik1704 closed 4 months ago

Hendrik1704 commented 4 months ago

I found a bug in the setting of the charge for Jetscape particles while trying to apply a charged_particles filter. This comes from the fact that we initialize the self.pdg_valid = False at the beginning of the init function. Then we set the quantities of the particles and in the case of a Jetscape particle, we compute the mass, and the charge from the PDG ID. The function for the charge computation has this check:

if not self.pdg_valid:
    return np.nan
return PDGID(self.pdg).charge

Only after the values are set, we set the bool: self.pdg_valid = PDGID(self.pdg).is_valid. This should be done before the function for the charge is called, to not have np.nan returned for every particle. Otherwise, the charge filter can not be used for Jetscape particles.

Hendrik1704 commented 4 months ago

This is fixed in version 1.2.1