Is it possible to set cut according to tracklength?

I’m simulating the interaction when electrons hit a tungsten target embedded in a magnetic field. The problem I met is, that when secondary low-energy electrons are created with momentum perpendicular to the field, they would keep circling in the field, making the event looping forever. The first solution that came into my mind is looking for a way to stop tracking the electron when the tracklength is over a specific value. Or maybe are there any other solutions to this issue?
I’m looking forward to your kind suggestions. :slight_smile: