Geomagnetically trapped, albedo and solar energetic particles: Trajectory analysis and flux reconstruction with PAMELA