Reconstruction of the photon distribution in a micromaser