Measuring spectral distribution of X-rays or of nuclear radiation spectrometry