Statistics for Determination of energy spectra of proton therapy beams