Control of the dose distribution in charged particle therapy