joheinze/PriNCe

Switch particle IDs to a more widely used definition

Opened this issue · 1 comments

The code currently uses the NEUCOSMA ID convention. This means particels are defined by

  • 0: photon
  • 2-4: pions
  • 5-10: muons (seperate ids for different helicities)
  • 11-16: neutrinos
  • 20,21: electron, positron
  • 50,51: kaons
  • A x 100 + Z: nuclei

This should eventually be moved to a more conventional sheme, e.g. the PDG Monte Carlo numbering scheme (also CRPropa uses).

Unfortunately the indexing sheme is hard coded in several places in the cross_sections and decays modules. E.g. by code sections like this:

for mo, da in self.incl_idcs:
if da >= 100 and get_AZN(da)[0] > get_AZN(mo)[0]:
raise Exception(
'Daughter {0} heavier than mother {1}. Physics??'.format(
da, mo))

Which should rather make used of the PriNCeSpecies class like this:

        for mo, da in self.incl_idcs:
            if da.is_nucleus and da.A > mo.A:
                raise Exception(
                    'Daughter {0} heavier than mother {1}. Physics??'.format(
                        da, mo))

Several similar checks occur throughout the code.
However this affects the cross section class structure, since self.incl_idcs is a dictionary of tuples (and PriNCeSpecies cannot be used as a dictionary key).

The same goes for the used of get_AZN throughout the code, which was not fully adressed in issue #2. This issue is also related to #4 and #6, since the data files contain the NEUCOSMA IDs explicitly

Since this will be somewhat more work, I do not think this issue has to be adressed before publishing the code. So I separated this from issue #2.