Wrong particle counting in CCollimator with particle-matter interactions
The following discussion from !577 (merged) should be addressed:
-
@ext-calvo_p started a discussion: (+1 comment)
There is an additional problem with particle counting. The cyclotron tracker does not detect the particles that are in the material, and therefore always thrown the exception in
ParallelCyclotronTracker::deleteParticle()
.To reproduce it, just run the input file attached in the issue description. I've just updated it to the current format
The ScatteringPhysics algorithm delete from the bunch the particles that collide with the material. It then performs energy loss and Coulomb scattering calculations. Particles with energy above the threshold are returned to the beam by addBackToBunch
, otherwise, the particles are considered lost.
OpalCycl updates the number of particles in a specific method focused on delete particles, so the local number of particles must coincide with the accumulated particles in all bunches after deletion. Therefore, the particles lost in ScatteringPhysics must be included in the bunch with the proper attribute to be deleted.