Analysis of the beam bunching produced by a free electron laser