cta-observatory / pycorsikaio

Python reader for CORSIKA binary file format
MIT License
9 stars 2 forks source link

Particle description clarification #41

Closed jr-lloyd closed 5 months ago

jr-lloyd commented 5 months ago

Hi, I'm having issues identifying which particle corresponds to each code in the particle array block of the shower. For instance, for a gamma induced shower I get codes of the type "1001, 2001, 3001", which I assume corresponds to photons and electrons. But, for a proton induced shower I get the following: "1041, 1021, 13061, 5531, etc". I'm having trouble using these because they are different from the ones used in CORSIKA and PDG.

Is there some documentation with information about these codes? or is there somewhere in the libraries where to look?

Btw the project is very useful for me currently doing my thesis with SWGO. Thanks in advance for your help!!!

cxwx commented 5 months ago

@jr-lloyd FROM corsika MANUAL corsika id = part. id×1000 + hadr. generation102 × 10 + no. of obs. level so 13061 means id=13 hard gen = 6 obs level = 1

maxnoe commented 5 months ago

@cxwx is correct, you can find the relevent definition in Table 10, page 135 of the CORSIKA manual:

particle_definition

We should maybe add utility functions to extract the single fields in this module.

For the moment, you can use this

def parse_particle_description(description):
     particle_id, rest = np.divmod(description, 1000)
     hadron_generation, obs_level = np.divmod(rest, 10)
     return particle_id, hadron_generation, obs_level

This is valid only for "real" particles, not for the rows that are "additional muon information". These are the ones that have ids 76, 76, 95 and 96

jr-lloyd commented 5 months ago

Thanks to both of you. That works :)