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.
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 theself.pdg_valid = False
at the beginning of theinit
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: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 havenp.nan
returned for every particle. Otherwise, the charge filter can not be used for Jetscape particles.