\section{The Interaction Length or Mean Free Path} \label{mfp}
\begin{itemize}
\item[1)]
         In a simple material the number of atoms per volume is:
         \[n  = \frac{\mathcal{N}\rho}{A}\]
         where:
         \begin{eqnarray*}
          \mathcal{N} &  & \mbox{Avogadro's number} \\
          \rho        &  & \mbox{density of the medium} \\
          A           &  & \mbox{mass of a mole} 
         \end{eqnarray*}
\item[2)]
         In a compound material the number of atoms per volume of the
	 $i^{th}$ element is:
         \[n_{i}  = \frac{\mathcal{N}\rho w_{i}}{A_{i}}\]
         where:
         \begin{eqnarray*}
          \mathcal{N} &  & \mbox{Avogadro's number} \\
          \rho        &  & \mbox{density of the medium} \\
          w_{i}       &  & \mbox{proportion by mass of the $i^{th}$ element}\\
          A_{i}       &  & \mbox{mass of a mole of the $i^{th}$ element} 
         \end{eqnarray*} 
\item[3)] 
         The {\bf mean free path} of a process, $\lambda$, also called the
	 {\bf interaction length}, can be given in terms of the total cross 
         section : 
         $$
           \lambda(E) =
	   \left( \sum_i \lbrack n_i \cdot \sigma(Z_i,E) \rbrack \right)^{-1}
         $$
         where $\sigma(Z,E)$ is the total cross section per atom of the
         process and $\sum_{i}$ runs over all elements composing the material.
	  
	  $\sum\limits_{i}{\lbrack n_{i} \sigma(Z_{i},E)\rbrack}$ is also 
          called the {\it macroscopic cross section}. The mean free path is the
          inverse of the macroscopic cross section.
\end{itemize}

\noindent
Cross sections per atom and mean free path values are tabulated during 
initialisation.

\section{Determination of the Interaction Point} \label{ip}
The mean free path, $\lambda$, of a particle for a given process depends on the
medium and cannot be used directly to sample the probability of an interaction 
in a heterogeneous detector. The number of mean free paths which a particle 
travels is:

\begin{equation}
\label{int.c}
n_\lambda =\int_{x_1}^{x_2} \frac{dx}{\lambda(x)} ,
\end{equation}
which is independent of the material traversed. If $n_r$ is a random variable 
denoting the number of mean free paths from a given point to the point of 
interaction, it can be shown that $n_r$ has the distribution function:
\begin{equation}
\label{int.d}
P( n_r < n_\lambda ) = 1-e^{-n_\lambda}
\end{equation}
The total number of mean free paths the particle travels before reaching
the interaction point, $n_\lambda$, is sampled at the beginning of the 
trajectory as:
\begin{equation} 
\label{int.e}
n_\lambda = -\log \left ( \eta \right )
\end{equation}   
where $\eta$ is a random number uniformly distributed in the range $(0,1)$.
$n_\lambda$ is updated after each step $\Delta x$ according the formula:
\begin{equation}
\label{int.f}
n'_\lambda=n_\lambda -\frac{\Delta x }{\lambda(x)}
\end{equation}
until the step originating from $s(x) = n_\lambda \cdot \lambda(x)$ is
the shortest and this triggers the specific process.\\

\noindent
The short description given above is the {\em differential approach} to 
particle transport, which is used in most simulation 
codes (\cite{int.egs4},\cite{int.geant3}).
In this approach besides the other ({\em discrete}) processes  
 the continuous energy loss imposes a limit on the stepsize too, because the
cross sections depend of the energy of the particle.
Then it is assumed that the step is small enough so that the particle cross 
sections remain approximately constant during the step.
In principle one must use very small steps in order to insure an accurate 
simulation, but computing time increases as the stepsize decreases. A good 
compromise is to limit the stepsize in Geant4 by not allowing the stopping 
range of the particle to decrease by more than 20 \% during the step. This 
condition works well for particles with kinetic energies $>$ 0.5 MeV, but for 
lower energies it can give very short step sizes.  To cure this problem a lower
limit on the stepsize is also introduced.
  
\section{Updating the Particle Lifetime}

The proper and laboratory times of a particle should be updated after each 
step. 
In the laboratory system:
\begin{equation}
\label{int.n}
  \Delta t_{lab} = 0.5 \Delta x (\frac{1}{v_1} + \frac{1}{v_2}), 
\end{equation} 
where $\Delta x$  is a step traveled by the particle, $v_1$  and $v_2$
are particle velocities at the beginning and at the end of the step
correspondingly.
This expression is a good approximation if the velocity is not allowed to
change too much during the step.


\section{Status of this document}
 09.10.98  created by L. Urb\'an. \\
 27.07.01  minor revisions by M. Maire \\
 01.12.03  integral method subsection added by V. Ivanchenko \\
 12.08.04  splitted and partly moved in introduction by M. Maire  \\
 25.12.06  minor revision by V. Ivanchenko \\
 15.12.08  minor revision by J. Apostolakis \\

\begin{latexonly}

\begin{thebibliography}{99}
\bibitem{int.egs4} W.R. Nelson et al.
 the \textsc{egs4} Code System. SLAC-Report-265, December 1985.

\bibitem{int.geant3}
 G\textsc{eant3} manual, CERN Program Library Long Writeup W5013 (October 1994).

\end{thebibliography}

\end{latexonly}

\begin{htmlonly}

\section{Bibliography}

\begin{enumerate}
\item W.R. Nelson et al.
 the \textsc{egs4} Code System. SLAC-Report-265, December 1985.

\item G\textsc{eant3} manual, CERN Program Library Long Writeup W5013 (October 1994).


\end{enumerate}

\end{htmlonly}
