New algorithm for studying the effect of self attenuation factor on the efficiency of γ-rays detectors