Closed martinschwinzerl closed 4 years ago
Thanks so much for the quick fix! It surely solves the https://github.com/SixTrack/sixtracklib/pull/128 MWE already!
$ python reproducing.py
[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
Indeed, half of the particles have been lost in the aperture. They are all marked `state==0`.
Let's track the first drift again after having finished the previous turn:
[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
Yes!! I can confirm it works perfectly fine also in the full SIS100 tracking setup for SixTrackLib+PyHEADTAIL with losses in both, this bug was the source for the issue I had discussed with you earlier! Thanks a million times @martinschwinzerl ! :+1:
Adds tests ensuring the expected behavior based on the minimal reproducible example for issue #128. Adds also missing API to NS(MultiPole)
and sixtrack::MultiPole
required for the tests to actually work.
Attempts to fix the problems encountered in isseu #128 by changing the behavior of the global aperture check and the
track_line
method:by using
state &= ((|x|<LIMIT_X)&&(|y|<LIMIT_Y))
instead of "updating" the state only with the right-hand-side of the expression above, we no longer rely on external logic to ensure that already lost particles are not updated again. I.e. by virtue of the bit-wise&
, particles can only be marked as lost by this methodAdding additional checks at the entry of the
NS(Track_particle_line_objs)
to repel already lost particles, the behaviour of the outer loop intrack_until
is reproduced even though this outer loop is missing in the context oftrack_line
. This should ensure that invokingtrack_line
always skips already lost particles, regardless of the history of the particles and how they have been lost.Feedback & tests would be appreciated