A narrow, perfectly collimated beam attenuates exponentially with the real linear attenuation coefficient μ (cm⁻¹, tabulated per material and photon energy from NIST XCOM mass-attenuation data) and slab thickness x:
I(x) = I₀ · e^(−μx) (Beer–Lambert, narrow beam)
A real detector behind a shield also picks up photons that Compton-scattered inside the material and still emerged heading roughly forward — they never left the "beam" in the sense that matters for dose. The true transmitted intensity is higher than Beer–Lambert predicts, by the buildup factor B(μx, E):
I_broad(x) = B(μx,E) · I₀ · e^(−μx)
B(μx,E) = 1 + a(E)·(μx)·e^(b(E)·μx) (Berger single-parameter fit)
Thickness here is entered directly in mean free paths (mfp = 1/μ), so μx equals the slider value numerically — the slab's physical thickness in real centimetres is x_mfp / μ(material, E).
This simulator fires individual photons at the slab and, at every small step ds (in mfp units), rolls the interaction probability p = 1 − e^(−ds). On an interaction it samples whether the photon photoelectrically absorbs (removed — more likely at low energy and high Z) or Compton-scatters (keeps going in a new, energy-dependent forward-biased direction, losing some energy each time). A photon that reaches the far face still on its original straight line counts toward the narrow-beam detector; every photon that reaches the far face at all — scattered or not — counts toward the broad-beam detector. Their ratio, averaged over many photons, is the simulated buildup factor, and it is what the a(E), b(E) coefficients above were themselves fit to (per material, at six reference energies, from 150,000-photon batches) — so the formula and the live particle simulation are two views of the same underlying transport model, not independent guesses.
- Material — sets μ (real NIST attenuation data) and the photoelectric-vs-Compton interaction split (much higher photoelectric share in lead, its high Z).
- Photon energy — higher energy means fewer photoelectric absorptions (more forward-scattered survivors, higher B) and a smaller Compton scattering angle per event (more forward-peaked, closer to the real Klein–Nishina trend).
- Slab thickness — in mean free paths; thicker slabs attenuate more in absolute terms but also build up more, since a scattered photon gets more chances to still exit forward before it either backscatters out the front or gets absorbed.
Real-world relevance: this is exactly why reactor and radiotherapy shielding calculations use tabulated buildup factors rather than raw Beer–Lambert — at several mean free paths of water or concrete, the buildup factor can reach into the tens or hundreds, meaning the true dose behind the shield can be an order of magnitude (or more) above the naive e^(−μx) estimate.