Modeling of glancing incidence X-ray for depth profiling of thin layers