Text this: Determination of energy spectra of proton therapy beams