A method for calculating the effective charge of ions decelerated in a hot dense plasma