I'm writing a script to simulate the transport of ion beam in a Thomson Spectrometer. My concern is that the program doesn't allow the passage of higher charge states through out the pinholes that I use to collimate the beam. I mean if I want to simulate a 3 charge states beam of C ions I will have only C+ and C 2+ at the end of the line Similarly if I want to simulate a 6 charge state beam of C ions I will have only C+, C2+ and C3+ at the end of the line. The energy of the particle is calculated assuming a post-acceleration device than E=q*V where V is the voltage of the post-acceleration device. Then I estract a random number in [E, E/10] to calculate the ion velocity as: K_ion=normrnd(Ein_s,Ein_s/10); % Kinetic energy Etot_ion(i)=K_ion+((m_ions*uma1)/uma); % everything is in Mev betasquare_ion(i)=1-(((m_ions*uma1)/(uma*Etot_ion(i)))^2); v_ion(i)=sqrt(betasquare_ion(i)*c^2); Then I select a random number in a certain interval that I use as divergence angle of the beam in order to have the 3 components of v_ion. Finally I solve the equation of motion in a drift sector where I have two pinholes. Is it possible that the higher charge states have such an energy, and velocity, that they are shifted at the boundary of the beam and lost on the pinholes?