Cosmix model incorrectly checks if particle within detector

The Cosmix charge_generation model incorrectly checking bounds of particle within detector leading to effectively infinite detector thickness.

Current image using the Cosmix model within pyxel version 2.11.2

image

All trails always end at edge of detector and produce long trails, would expect most trails be short as particles travel through the relatively thin detector.

This seems to be cause by line 269 in models/charge_generation/cosmix/simulation.py

or (0.0 <= particle.position[2] <= (-1 * geo.total_thickness))

which since total_thickness is always positive, will always evaluate to false.

This seems to of been introduced by 778eba21 and looks like the logic was correct prior to this change.

I would suggest changing the line to be

or not (0.0 >= particle.position[2] >= (-1 * geo.total_thickness))

and this produces a more reasonable output

image