Finding the Muon decay length reduced by Ionization loss

1. Dec 9, 2007

mdj

I'm doing a Monte carlo simulation of cosmic ray interactions in the atmosphere, and as part of this I need to calculate how far a decaying particle travels before it decays

In vacuum it would be simple: $$l_D = c \tau \gamma \beta$$ with a probability of traveling the distance l before decay: $$P_D (l) = \frac{1}{l_D} e^{-l/{l_D}}$$

But in practice both $$\gamma$$ and $$\beta$$ depends on l

Where $$\gamma(l) = \gamma_0 + \frac{dE}{dx}(\gamma_0)$$

and $$\frac{dE}{dx}$$ is the Bethe-Bloch formula.

How do I do this smart? any ideas? I suppose that this happens every day in detectors as well...

(The above don't take into account the density variation of the atmosphere, but I got that covered - I think... )