Abstract
In this paper, we study the beam dynamics of ultrashort electron bunches in an RF photoinjector and propose illumination of temporally shaped laser pulse at the photocathode to restore the distorted electron bunches during particle acceleration.