Direct recovery of ion beam energy using magnetic electron suppression