\section{Computing the Mean Energy Loss} \label{en_loss}
 
Energy loss processes are very similar for \(e+/e-\) , \(\mu+/\mu-\) and
charged hadrons, so a common description for them was a natural choice in 
Geant4.  Any energy loss process must calculate the continuous and discrete
energy loss in a material.  Below a given energy threshold the energy loss 
is continuous and above it the energy loss is simulated by the explicit 
production of secondary particles -  gammas, electrons, and positrons. 

\subsection{Method}

Let
\[\frac{d\sigma(Z,E,T)}{dT}\]
be the differential cross-section per atom (atomic number $Z$) for the ejection
of a secondary particle with kinetic energy $T$ by an incident particle of 
total energy $E$ moving in a material of density $\rho$.  The value of the 
{\em kinetic energy cut-off} or {\em production threshold} is denoted by 
$T_{cut}$.  Below this threshold the soft secondaries ejected are simulated as 
continuous energy loss by the incident particle, and above it they are 
explicitly generated.  The mean rate of energy loss is given by:
\begin{equation}
\label{comion.a}
\frac{dE_{soft}(E,T_{cut})}{dx} = n_{at} \cdot
 \int_{0}^{T_{cut}} \frac{d \sigma (Z,E,T)}{dT} T \: dT  
\end{equation}
where $n_{at}$ is the number of atoms per volume in the material. 
The total cross section per atom for the ejection of a secondary of 
energy \linebreak $T > T_{cut}$ is
\begin{equation}
\label{comion.b}
\sigma (Z,E,T_{cut})
= \int_{T_{cut}}^{T_{max}}\frac{d \sigma (Z,E,T)} {dT} \: dT \,
\end{equation}
where $T_{max}$ is the maximum energy transferable to the secondary particle.

\noindent
If there are several processes providing energy loss for a given particle, then
the total continuous part of the energy loss is the sum:
\begin{equation}
\label{comion.c}
\frac{dE_{soft}^{tot}(E,T_{cut})}{dx} = \sum_i{\frac{dE_{soft,i}(E,T_{cut})}{dx}}.
\end{equation}
These values are pre-calculated during the initialization phase of {\sc Geant4}
and stored in the $dE/dx$ table. Using this table the ranges of the particle in
given materials are calculated and stored in the $Range$ table. The $Range$ 
table is then inverted to provide the $InverseRange$ table.  At run time, 
values of the particle's continuous energy loss and range are obtained using 
these tables. Concrete processes contributing to the energy loss are not 
involved in the calculation at that moment. In contrast, the production of 
secondaries with kinetic energies above the production threshold is sampled 
by each concrete energy loss process. 

The default energy interval for these tables extends from 100 eV to 100 TeV and
the default number of bins is 120. For muon energy loss processes models are 
valid for higher energies and this interval can be extended up to 1000 PeV. 
Note that this extension should be done for all three processes which 
contribute to muon energy loss.

\subsection{Implementation Details}

Common calculations are performed in the class $G4VEnergyLossProcess$ in which 
the following public methods are implemented:
\begin{itemize}
\item
PrintInfoDefinition;
\item
PreparePhysicsTable;
\item
BuildPhysicsTable;
\item
AlongStepDoIt;
\item
PostStepDoIt;
\item
StorePhysicsTable;
\item
RetrievePhysicsTable;
\item
MeanFreePath;
\item
GetContinuousStepLimit;
\item
SampleSubCutSecondaries;
\item
GetDEDXDispersion;
\item
AlongStepGetPhysicalInteractionLength;
\item
PostStepGetPhysicalInteractionLength;
\item
MicroscopicCrossSection;
\item
AddEmModel;
\item
SetEmModel;
\item
UpdateEmModel;
\item
SetFluctModel;
\item
BuildDEDXTable;
\item
BuildLambdaTable;
\end{itemize}
There are many Get/Set and other accessors methods implemented for this base class.
Any derive class need to have an implementation of pure virtual methods:
\begin{itemize}
\item
IsApplicable;
\item
PrintInfo;
\item
InitialiseEnergyLossProcess;
\end{itemize}
This interface is used by the following processes:
\begin{itemize}
\item
G4eIonisation;
\item
G4eBremsstrahlung;
\item
G4hIonisation;
\item
G4hhIonisation;
\item
G4ionIonisation;
\item
G4ionGasIonisation;
\item
G4mplIonisation;
\item
G4MuIonisation;
\item
G4MuBremsstrahlung;
\item
G4ePolarizedBremsstrahlung;
\item
G4ePolarizedIonisation.
\end{itemize}
These processes mainly provide initialization and also some generic functions like
$AlongStepDoIt$ and $PostStepDoIt$. The physics models are 
implemented using the $G4VEmModel$ interface. Because a model is defined to
be active over a given energy range and for a defined set of $G4Region$s,
an energy loss process can have one or several models defined for a particle 
and $G4Region$. The following models from {\it standard, lowenergy, highenergy, and polarisation} 
libraries are available for above list of processes: 
\begin{itemize}
\item
G4BetheBlochModel;
\item
G4BetheBlochNoDeltaModel;
\item
G4BraggModel;
\item
G4BraggIonModel;
\item
G4BraggNoDeltaModel;
\item
G4eBremmstrahlungModel;
\item
G4eBremmstrahlungRelModel;
\item
G4ePolarizedBremsstrahlungModel;
\item
G4hBremsstrahlungModel;
\item
G4hPairProductionMOdel;
\item
G4IonParametrisedLossModel;
\item
G4mplIonisationModel;
\item
G4MollerBhabhaModel;
\item
G4MuBetheBlochModel;
\item
G4MuBremmstrahlungModel;
\item
G4MuPairProductionModel;
\item
G4PAIModel;
\item
G4PAIPhotonModel;
\item
G4PenelopeIonisationModel;
\item
G4PolarizedMollerBhabhaModel.
\end{itemize}
 
\subsubsection{Step-size Limit Due to Continuous Energy Loss}

Continuous energy loss imposes a limit on the step-size because of the 
energy dependence of the cross sections. It is generally assumed in MC programs
\cite{enloss.G3}  
that the cross sections are approximately constant along a step, i.e. 
the step size should be small enough, so that the change in cross section along 
 the step is also small.  In principle one must
use very small steps in order to insure an accurate simulation, however 
the computing time increases as the step-size decreases. 

The exact solution
is available inside Geant4 Standard EM package 
(see next chapter \ref{integral}) but
is is not implemented yet for all physics processes.
A good compromise is
to limit the step-size by not allowing the stopping range of the particle to
decrease by more than $\sim$ 20 \% during the step. This condition works well for
particles with kinetic energies $>$ 1 MeV, but for lower energies it gives 
too short step-sizes, so must be relaxed. 
To solve this problem a lower limit on the step-size was introduced. A smooth
{\em StepFunction}, with 2 parameters, controls the step size. At high energy
the maximum step size is defined by Step/Range $\sim \alpha_R$ (parameter {\em dRoverRange}). 
By default $\alpha_R = 0.2$. As the particle travels the maximum step 
size decreases gradually until the range becomes lower than $\rho_R$ 
(parameter {\em finalRange}). Default {\em finalRange} $\rho_R = 1 mm$. 
For the case of a particle range $R > \rho_R$ 
the {\em StepFunction} provides limit for the step size $\Delta S_{lim}$
by the following formula:
\begin{equation}
\label{comion.d}
\Delta S_{lim} = \alpha_R R + \rho_R (1- \alpha_R ) \left(2-\frac{\rho_R}{R} \right).
\end{equation}
In the opposite case of a small range $\Delta S_{lim} = R$.
The figure below shows the ratio step/range as a function of range if step limitation 
is determined only by the expression (\ref{comion.d}).
\begin{center}
\includegraphics*
[width=\textwidth,height=0.4\textheight,draft=false]
                             {electromagnetic/utils/steplimit.eps}
\end{center}
\noindent
The parameters of {\em StepFunction} can be
overwritten using an UI command:\\
\\
{\it /process/eLoss/StepFunction 0.2 1 mm}

\subsubsection{Energy Loss Computation}

The computation of the {\em mean energy loss} after a given step is done
by using the $dE/dx$, $Range$, and $InverseRange$ tables. The $dE/dx$ table 
is used if the energy deposition  ($\Delta T$) 
is less than allowed limit $\Delta T < \xi T_0$, 
where $\xi$ is $linearLossLimit$ parameter  (by default $\xi = 0.01$), 
$T_0$ is the  kinetic energy of the particle.  In that case
\begin{equation}
  \Delta T = \frac{dE}{dx}\Delta s,
\end{equation}
where $\Delta T$ is the energy loss, $\Delta s$ is the {\it true step length}.
When a larger percentage of energy is lost, the mean loss 
can be written as
\begin{equation}
  \Delta T = T_0 - f_T(r_0- \Delta s)
\end{equation}
where \(r_0\)    the range           at the beginning of the step,
       the function \(f_T(r)\) is the inverse of the $Range$ table (i.e. it
       gives the kinetic energy of the particle for a range value of $r$).
By default spline approximation is used to retrieve a value from
 $dE/dx$, $Range$, and $InverseRange$ tables.  
The spline flag can be changed using an UI command:\\
\\
{\it /process/em/spline false}
\\       
After the mean energy loss has been calculated, the process computes the
{\em actual} energy loss, i.e. the loss with fluctuations.  The fluctuation
is computed from a model described in Section \ref{gen_fluctuations}.


\subsection{Energy Loss by Heavy Charged Particles}\label{scaling}

To save memory 
in the case of positively charged hadrons and ions energy loss, $dE/dx$, $Range$ and 
$InverseRange$ tables 
are constructed only for {\em proton, antiproton, muons, pions, kaons, and Generic Ion}. 
The energy loss for other particles is computed from these tables at the 
{\em scaled kinetic energy} $T_{scaled}$ :
\begin{equation}
\label{enloss.sc}
  T_{scaled} = T\frac{ M_{base}}{ M_{particle}},
\end{equation}
where $T$ is the kinetic energy of the particle,  $M_{base}$ and
$M_{particle}$ are the masses of the base particle ({\em proton or kaon}) and particle.
For positively changed hadrons with non-zero spin {\em proton} is used as a based particle,
for negatively charged hadrons with non-zero spin - {\em antiproton}, 
for charged particles with zero spin -
$K^+$ or $K^-$ correspondingly. The virtual particle {\em Generic Ion} is used 
as a base particle for for all 
ions with $Z > 2$. It has mass, change and other quantum numbers of the {\em proton}.
The energy loss can be defined via scaling relation:
\begin{equation}
\label{enloss.sc1}
 \frac{dE}{dx}(T) = q^2_{eff}(F_1(T)\frac{dE}{dx}_{base}(T_{scaled}) + F_2(T,q_{eff})),
\end{equation}
where $q_{eff}$ is particle effective 
change in units of positron charge, $F_1$ and $F_2$ are correction function taking into account 
Birks effect, Block correction, low-energy corrections based on data from evaluated data bases
\cite{enloss.ICRU73}.
For a hadron  $q_{eff}$ is equal to the hadron charge, 
for a slow ion effective charge is different from the charge 
of the ion's nucleus, because of electron exchange between transporting ion and the media.
The effective charge approach is used to describe this effect 
\cite{enloss.Ziegler88}.
The scaling relation (\ref{enloss.sc}) is valid for any combination 
of two heavy charged particles with accuracy corresponding to high order
mass, charge and spin corrections \cite{enloss.ICRU49}. 

\subsection{Status of this document}
 09.10.98  created by L. Urb\'an \\
 01.12.03  revised by V.Ivanchenko \\
 02.12.03  spelling and grammar check by D.H. Wright \\
 09.12.05  minor update by V.Ivanchenko \\
 14.06.07  formula of StepFunction (mma) \\
 15.06.07  updated last sub-charter, list of processes and models by V.Ivanchenko \\
 11.12.08  revised by V.Ivanchenko \\

\begin{latexonly}

\begin{thebibliography}{99}
\bibitem{enloss.G3} {\sc geant3} manual
  {\em Cern Program Library Long Writeup W5013 (1994)}   
\bibitem{enloss.Ziegler88} J.F.~Ziegler and
J.M.~Manoyan, {\em Nucl. Instr. and Meth. B35 (1988) 215.}
\bibitem{enloss.ICRU49} ICRU (A.~Allisy et al),
Stopping Powers and Ranges for Protons and Alpha
Particles, {\em ICRU Report 49, 1993.}
\bibitem{enloss.ICRU73}ICRU (R.~Bimbot et al),
Stopping of Ions Heavier than Helium, {\em Journal of the ICRU Vol5 No1 (2005) Report 73.}
\end{thebibliography}

\end{latexonly}

\begin{htmlonly}

\subsection{Bibliography}

\begin{enumerate}
\item {\sc geant3} manual
  {\em Cern Program Library Long Writeup W5013} (1994).  
\item J.F.~Ziegler and
J.M.~Manoyan, {\em Nucl. Instr. and Meth. B35 (1988) 215.}
\item ICRU (A.~Allisy et al),
Stopping Powers and Ranges for Protons and Alpha
Particles,
{\em ICRU Report 49 (1993).}
\item ICRU (R.~Bimbot et al),
Stopping of Ions Heavier than Helium, {\em Journal of the ICRU Vol5 No1 (2005) Report 73.}
\end{enumerate}

\end{htmlonly}
