Algorithm for inversion of photoluminescent Bragg curves in lithium fluoride applied to the analysis of proton beam energy spectra