Solar energetic particle events: Trajectory analysis and flux reconstruction with PAMELA