Higher moments of the energy loss spectrum of swift charged particles penetrating a thin layer of material