  Despite the fact that the first-order beam dynamics models allow an
approximated evaluation of the beam properties, their contribution is essential
during the conceptual design of an accelerator or beamline. However, during the
commissioning some of their limitations appear in the comparison against
measurements. The extension of the linear model to higher order effects is,
therefore, demanded. In this paper, the effects of particle-matter interaction
have been included in the model of the transport lines in the proton therapy
facility at the Paul Scherrer Institut (PSI) in Switzerland. To improve the
performance of the facility, a more precise model was required and has been
developed with the multi-particle open source beam dynamics code called OPAL
(Object oriented Particle Accelerator Library). In OPAL, the Monte Carlo
simulations of Coulomb scattering and energy loss are performed seamless with
the particle tracking. Beside the linear optics, the influence of the passive
elements (e.g. degrader, collimators, scattering foils and air gaps) on the
beam emittance and energy spread can be analysed in the new model. This allows
for a significantly improved precision in the prediction of beam transmission
and beam properties. The accuracy of the OPAL model has been confirmed by
numerous measurements.
