Longitudinal phase space tomography of charged particle beams