Free-electron-laser gain degradation and electron-beam quality.