(C)Collimator does not check for lost particles correctly
Discovered with @nesteruk_k:
The Cyclotron collimator does not check for lost particles correctly.
It first checks if the beam is close to the collimator first in z
and then in r
:
bunch->get_bounds(rmin, rmax);
double r1 = sqrt(rmax(0) * rmax(0) + rmax(1) * rmax(1));
if (rmax(2) >= zstart_m && rmin(2) <= zend_m) {
if ( r1 > rstart_m - 100.0 && r1 < rend_m + 100.0 ){
The check in z
is correct, but the check in r
only checks on the maximum bunch bound (it assumes that the bunch is increasing in radius and that the maximum bound is not skipping the collimator in the next turn).
A similar check as in z
should be implemented instead.