Determination of thin foil thickness inhomogeneities by analysis of ion beam energy loss spectra