Deflection of pulsed ion beams by toroidal magnetic fields