Computation of speed distributions for ions in drift tubes