Automatic determination of primary electron beam parameters in Monte Carlo simulation.