  Monte Carlo (MC) is generally considered as the most accurate dose
calculation tool for particle therapy. However, a proper description of the
beam particles kinematics is a necessary input for a realistic simulation. Such
a description can be stored in phase space (PS) files for different beam
energies. A PS file contains kinetic information such as energies, positions
and travelling directions for particles traversing a plane perpendicular to the
beam direction. The accuracy of PS files play a critical role in the
performance of the MC method for dose calculations. A PS file can be generated
with a set of parameters describing analytically the beam kinematics. However,
determining such parameters can be tedious and time consuming. Thus, we have
developed an algorithm to obtain those parameters automatically and
efficiently. In this paper, we present such an algorithm and compare dose
calculations using PS automatically generated for the Shanghai Proton and Heavy
Ion Center (SPHIC) with measurements. The gamma-index for comparing calculated
depth dose distributions (DDD) with measurements are above 96.0% with criterion
0.6%/0.6 mm. For each single energy, the mean difference percentage between
calculated lateral spot sizes at 5 different depths and measurements are below
3.5%.
