Welcome to my home page!


Visit the UIB home page here.

Project in PHYS291


My main idea for a project in PHYS291 was to make a Monte Carlo simulation of the range of an electron passing through a medium. I choose this because wanted to learn more about Monte Carlo simulations as well as the topic was relevant for the PHYS231 course that I took this this semester.

The Bethe-Bloch formula

The first C++ code is a program that creates the Bethe-Bloch function for electrons in air. This program was used later to compare the simulated range with a range given by the Bethe-Bloch formula. The Bethe-Bloch function used in this program is a formula that approximate how much energy the electron looses per unit length in air due to ionization [1]. The energy loss is dependent of the speed (beta) of the electron.

The Bethe-Bloch formula can be found here: Bethe-Bloch formula.

My code for the Bethe Bloch function can be found here: Bethe-Bloch program.

Picture of the graph in the Bethe-Bloch program:

The Monte Carlo Simulation

The program simulates the range of electrons in air for various kinetic energies between 1 and 25 MeV. The energy loss is only due to ionization in this simulation since the Bethe-Bloch formula only looks at energy losses due to excitations and ionizations.

The average energy loss of the electrons due to production of an ion par is 33.7eV in air [1]. The energy loss per collision has a Landau distribution which is a probability function that the simulation uses.

The distribution of how far the electron would travel before a collision is dependent of the mean free path:

Where f(s) is the probability distribution of the distance (s) traveled between two collisions as a function of the mean free path. This is the formula used in the Monte Carlo simulation as the probability density for the range before collision.

The kinetic energy of the particle has an important impact on the mean free path, so the program also calculates the mean free path as a function of the kinetic energy of the electron:

This graph is for an electron in a dense medium. Therefore, the mean free path needed to be increased according to that for air. The inelastic mean free path for electrons in air is dependent on pressure. The pressure used in the Bethe-Bloch formula is 77cmHg and it uses a temperature of zero degrees. Since there is no clear indication of the mean free path of electrons in air at this pressure only due to ionization, the mean free path uses cm as the unit. However, this is only true for air in a low to medium vacuum, but was necessary for this simulation for comparison.

The process of the Monte Carlo simulation is to start with an initial energy E given by the user. Then simulate the range by using the mean free path of the electron in air. And at the end finding the energy loss by making a random number generator with a Landau distribution, centered as the average electron loss due to ionization. These three steps would get repeated until all of the electrons kinetic energy would be zero, and the repeat for 10000 electrons.

The code for the Monte Carlo simulation of the range of electron in air can be found here: Electron range simulation program.

Picture of the Monte Carlo electron range simulation:

The Bethe-Bloch range simulation

The final step in this project was to compare the range given by the Monte Carlo simulation and by the Bethe-Bloch formula. This was done by continuously fining the energy loss given by the Bethe-Bloch formula as the electrons decreased in speed as they went through the air. The program then simulates this loss by a Landau distribution with mean indicated by the Bethe-Bloch formula for a given speed.

As a consequence, the range distribution would only look the same as the sampling distribution. This however was a essential step in order to find a range given by the Bethe-Bloch formula since it only shows the energy loss per cm at given kinetic energy.

This means that the program is just an illustrated of the range given by the Bethe-Bloch formula.

The code for the Bethe-Bloch range simulation of electrons in air can be found here: Bethe-Bloch simulation program.

Picture of the Bethe-Bloch simulation can be found here:

Picture of Bethe-Bloch simulation

Input sanitization

It’s important to know that all the values that goes into the simulation are somewhere near what we would expect them to be.

In the project especially, the Electron range simulation (simulation.C) uses a series of calculations to estimate how far the electron travel before collision. These calculations are based on the mean free path of the electron at a specific kinetic energy.

In order to check if the calculations is near what we expect them to be, we can look at the range distribution before collision for many different runs.

This code therefore plots the range distribution of the electrons in air before collision: Range distribution before collision.

The graph shows a range distribution that confirms our expectations. The probability should decrease exponentially with as a function of range. Only few electrons will travel deep into the medium before colliding with the particle.

The difference between the Electron range simulation (simulation.C) and the Bethe-Bloch simulation (range.C).

There is a clear distinction between the two programs in the way they simulate the range of of the electron and for that reason they will yield different ranges for the same initial energy of the electron. The latter simulation, the Bethe-Bloch simulation, was only implemented for a comparison with the Electron range simulation. It is clear from the results that the two programs, even though they both uses values from the Bethe-Bloch formula, would not match each other and a good comparison was therefore not achieved in this project.

There are mainly two important differences in the programs on how they simulate the electron range.

1) Estimation of the range the electron travels before collision.

2) Energy loss of the particle.


The first program (simulation.C) uses a mean free path probability density to simulate how far the electron would travel before collision. However, the second program (range.C) estimates how much energy the electron have lost after one cm into the medium.

In simulation.C the range of the electron is simulated by using the mean free path, but in range.C the electron always travels one cm before the energy subtraction.


There is also a difference in how the energy loss is calculated. In the first program (simulation.C) the energy loss has a Landau probability distribution with an average energy loss due to production of an ion par, 33.7eV.

In the second program (range.C) the energy loss is found by using the Bethe-Bloch formula. It finds the mean value by reading the point on the Bethe-Bloch formula corresponding to the specific kinetic energy of the electron and then subtracts that energy loss. It does this calculation for each cm of the distance traveled by the electron.


A fitting exaltation was also build in later, that tried to fit a Gaussian function to the plot. The values of the Gaussian fit is printed in the program.


[1] Cember Herman, Johnson Thomas, (2009), Introduction to health physics, Colerado, The McGraw-Hill companies, Page: 150-151.

Thank you for reading!