Accurate determination of the ionization energy in semiconductor detectors