Determination of the longitudinal profile of a focused Nd:YAG Gaussian beam from second-harmonic generation in a thin KTP crystal.