A Monte Carlo simulation of the experiment was developed using the GEANT4 toolkit. A visualisation of the implemented geometry is shown in Figure~\ref{fig:geant-vis}. \begin{figure}[htbp] \centering \subfigure{ \includegraphics[scale=0.4,trim=100 50 100 100,clip]{figs/geant-vis} \label{g4} } ~% \subfigure{ \fbox{ \includegraphics[scale=0.20,trim=200 0 200 0,clip]{figs/geant-vis_eventDisplay} } \label{g4_ed} } \caption{Visualisations from the AlCap Monte Carlo simulation. Left: The implemented geometry for an aluminium target. Right: An event display where a muon stops in the target, emitting a proton which is stopped in the right silicon detector package.} \label{fig:geant-vis} \end{figure} The simulation is written so that most aspects can be easily modified by editing various text files which describe the geometry, the initial particle distribution, and the output variables. %The geometry configure files define and place all volumes. Some of these are placed within each other but ultimately they all placed within the ``world'' volume. By editing this file, properties of each volume can be changed to suit the simulation study being done. For example, the thickness and material of the target can be changed to simulate the experimental set-up of a different dataset. In addition, it is in this file that the volumes that are designated the ``sensitive'' volumes are defined. It is in these volumes where the properties of particles are read out. The initial particle distribution configure-files (also called the generator configure files) are used to define the particles which are created at the beginning of the experiment. These files contain the particle type, starting position, and initial momentum. The distributions of the latter two can be defined as simple random uniform or Gaussian distributions, or a stored distribution in a ROOT histogram. The later is is especially useful if a particular simulation is found which provides a more realistic distribution. For example, after running a simulation where muons are thrown at the target, a 3D histogram of the muon stopping positions can be created and used in future simulations. %Finally, the output configure file defines the variables that are read out of the simulation. This includes, for example, each particle's momentum and energy deposited in the sensitive volumes as defined in the geometry configure file. Also, certain condition can be specified in this configure file so that only particles passing a certain cut will be recorded which can aid in reducing the output file size and allowing more statistics for a specific result.