A new method for measurement of proton beam energies