Monte Carlo and Medical Physics

The different codes based on the Monte Carlo method, allows to make simulations in the field of medical physics, so the determination of all the magnitudes of radiation protection namely the absorbed dose, the kerma, the equivalent dose, and effective, what guarantees the good planning of the experiment in order to minimize the degrees of exposure to ionizing radiation, and to strengthen the radiation protection of patients and workers in clinical environment as well as to respect the 3 principles of radiation protection ALARA (As Low As Reasonably Achievable) and which are based on: -Justification of the practice -Optimization of radiation protection -Limitation of exposure.


Introduction
The monte Carlo method is a method of the family of algorithmic methods, it makes it possible to solve statistical problems and contribute to the analysis of data based on stochastic processes, thus it allows to evaluate the maturity risk and these probabilities thus the appointment of this method refers to the random side used at the casino of Monte Carlo located in MONACO.
The scope of the Monte Carlo method is very broad and covers all fields of nuclear medicine and particle transport, namely applications in radiotherapy-brachytherapy, scintigraphic imaging, shielding, dosimetry, PET, gamma camera, etc.
This choice of use of this method is not due to chance, but on the one hand because it allows to simulate the behavior of different particles and to deduce the average behavior of all particles according to the law of large numbers and the central limit theorem, so it can handle coupled and 3D problems with complex geometry and it can answer specific questions (average flow in a volume, Absorbed dose, Kerma, Hp(10), etc.), and its major advantages and determining the sources of errors, on the other hand, this method makes it possible to comply with the laws of ALARA (As Low As Reasonably Achievable) radiation protection which are: • Justification of the practice • Limitation of exposure • Optimization of radiation protection All this through simulation and modeling of the experience by the Monte Carlo method before practicing it in order to be able to determine the limits of the doses absorbed by the staff and the patient, as well as to develop and determine the correction methods to improve the quantification images and results, as well as the design of radiation detection equipment.
Monte Carlo uses software and calculation codes requiring a better knowledge of the input data of the problem (source, energy, angle and distribution, spatial and temporal dependence), and of the geometry which must represent the real situation, as well. The materials constituting the system to be studied, type of calculation envisaged, criteria for stopping the simulation, these parameters are defined and entered by the operator, and the basic nuclear data will be taken directly from data libraries (effective diffusion section, adsorption, fission, etc.).
Among these codes we cite GEANT4, GAMOS, GATE, FLUKA, PENELOPE … generally written in the C ++ language. So, Monte Carlo is a reliable method and offers complete and very close to reality solutions, which cover all the needs in nuclear medicine.

Generality of photons
Most visualization techniques exploit radiation, photonic or otherwise, the intensity of which can be measured in total flux, while gamma radiation used in nuclear medicine is exploited at the level of its smallest indivisible component, the "photon", and to detect this gamma radiation, a scintillation detector is generally used, the sensitive cell of which is a crystal which has the property of producing a small burst of light when it is touched by a photon, a photomultiplier tube associated with this crystal transforms this spark into an electrical pulse whose amplitude is proportional to the energy of the radiation. The total number of photons detected during a given time interval, or count rate, is the measurement of the radioactivity present in the field of the detector. It's this ability to count the number of individual photons that make medicine nuclear energy provides quantitative results [1].
So, photons (m photon = 0, q photon = 0), are electromagnetic radiations characterized by their energy and their origin, they can be produced by the following phenomena: • de-excitation of the nucleus following a modification of its structure; • de-excitation of the electronic procession; • bremsstrahlung production; • dematerialization or positron annihilation There are two types of photons: X-rays: Gamma radiation generally accompany α and β decays, their energy ranges from 60 keV at 3 MeV.
Whatever the origin of the photon, its behavior in matter will be identical. The photons interact directly with the electrons of matter, and then regenerate various effects depending on the disappearance or not of this one, we find the photoelectric effect, creation of pairs which are due to a disappearance of the photon, the coherent and incoherent diffusion due to the non-disappearance of the photon.

Simple flowchart
The method to generate histories is to query the probability distributions that describe the problem. This concept is called sampling. The method chosen for Sampling these probability distributions depends on the nature of the distribution [2]. The analogous simulation of particle transport using the Monte Carlo method allows the particle to be followed in its actual path, and the particle is sampled by following the following steps (Figure 1): 1. Sampling of the "random distance" collision distance (average free path).
2. transport of the particle to the point of interaction taking into account the constraints of geometry.
4. selection of the type of interaction.

Collision distance
This is the distance the particle traveled before it interacted. Or a particle that will undergo an interaction at a point x, at a distance l in a given volume.
The probability of interaction in dl: The cumulative function is calculated by: We draw a random number ε, and we look for L such that: where μ hν ð ) is the linear attenuation coefficient for the material at photon energy hν.

Selection of the collided nucleus
Which nuclide is subject to collision in the case of a mixture environment? We must just generate a random number ε between 0 and 1 and compare it to the cumulative probabilities (Figures 2 and 3).  Example (H 2 O):

Choice of the type of interaction
The choice of the interaction type is done in the same way of choosing of the collided nucleus.
with σ photoelecric : cross section of photoelectric effect σ coh : cross section of coherent scattering effect σ incoh : cross section of incoherent scattering effect

Choice of angle and scattering energy
In the case of photoelectric effect, the history of the photon ends, and the program begins with another sample, except if there is emission of a fluorescence X-ray in this case The direction of the emitted photon in the laboratory system is given by.
(θ and Φ, are polar and azimuthal angles, respectively), with the azimuthal angle sampled from, and the polar angle sampled from, with θmax = π When the scattering is incoherent the energy hν' of the scattered photon is taken as the Compton energy: where m e c 2 : the energy equivalence of the electron rest mass (511 keV); θ: scattering angle. It is common to neglect sampling coherent scattering angles [3], this may be justified in many situations. However, in diagnostic radiology the neglect of coherent scattering is a poor approximation [4].
Sampling of scattering angles can be done with the rejection method, from the total (incoherent more coherent) scattering cross-section [5], or separately, through method of Klein-Nishina cross-section and the classical Thompson scattering crosssection and corrected for the use of incorrect scattering cross-sections by applying a weight factor to the photon [6], or with and the distribution function techniques.

Weight of particle
Ideally, every real particle in a physical problem should be simulated by a fictitious particle in monte Carlo, in fact, to limit the duration of the simulations and improve computational efficiency [7], a monte Carlo particle does not exactly simulate a physical particle but rather represents a number w of particles physical. The number w is the weight, this weight represents the importance that is assigned to a particle. By default, the weight of each particle is 1 and the energy deposited by a particle equals the product of its energy by its weight.
The benefit of giving weight to a particle is to favor certain physical processes over others. It is necessary to simulate more particle with a low weight to decrease the uncertainty, if we have a sample N of σ (uncertainty) and we want to decrease σ to σ ffiffi n p ,so we have to multiply N by √n 2 .

Monte Carlo code "GAMOS"
There are several Monte Carlo calculation codes in the field of nuclear medicine, among these codes there is the famous GEANT4 code which is a very powerful and flexible toolkit, for medical applications, but the use of this code does not is not easy, it requires strong knowledge of C ++ language, and details of GEANT4, Most GEANT4 users are researchers who always want to know what is going on in simulation.
The thing that drove Pedro Acre to develop an easy-to-use framework based on the GEANT4 code, allowing to deal with medical physics problems with minimal knowledge of GEANT4 and no need for C ++, thus it provides all the necessary functionalities. to deal with a subject of medical physics while avoiding complicated coding, it is the GAMOS code (Geant4-Based Architecture for Medicine-Oriented Simulation).
The minimum set necessary to compile a project is to select a geometry, a physics list and a generator, to run N events to do this, the geometry will be written in a (.geom) extension file, the name of the geometry, the choice of the physics list, the generators, and the other functionality will be written in an input file of .in extension, therefore output items will be displayed in a file with an .out extension and errors in a file with the gamos_error.log extension.

Geometry file
There are 3 ways to describe your geometry: • Using a text file.
• Using one of the geometry examples provided by Gamos.
In this case we will be concerned with the use of a geometry from a text file, the extension of this file must be (.geom), the 1st step is to create a mother volume that will generate all the other volumes, so that the particles do not escape from the mother volume, and to finish the history of the particles that will come out of this volume, then build the other volumes from the following tags:  Geant4 provides a list of predefined materials, whose compositions correspond to the definition of NIST. Among them you can find all the simple elements, you can use these materials when building a volume in GAMOS without needing to redefine them on your geometry file.
The elements can be found in $ / gamos-6. For more details on List of solid parameters see the manual [8].
: PLACE mean the placement of the volume in relation to the parent volume, according to which rotation Matrix, and which coordinates x, y, z.
: PLACE_PARAM is the placement of several copies of a volume along a line.
c. Rotation matrix :ROTM, a rotation matrix is interpreted as the rotation that should be applied to the volume in the reference system, it can be defined in three ways: 3 rotation angles around X,Y,Z 6 theta and phi angles of X There are other features offered by Gamos such as Visibility, Color and transparency, Check overlaps … . For more details return to manual.

Input file
The first lines of this file are to appeal to the geometry file using the following commands: / gamos / … . Then, you have to determine your generator by writing the following command.

/ gamos / generator GmGenerator
The generator allows you to choose the type of particle and combine any number of single particles or isotopes decaying into e +, e-, g, as well as choosing which distributions of time, energy, position and direction by the following commands:

Position
It can be, at point, in a Geant4 volume, in a user defined volume, in steps along a line,in square, in a disc, in the voxels of a phantom(materials, structure … ) … .
It is also possible to create distributions where several of the four variables, are generated at the same time, so that they are related.
By using this minimum of commands described above we can run an example and also visualize the geometry by VRML, OpenGL and ASCII with this command: The main way to extract information of what is happening and modify the running conditions is user action, /gamos/userAction MyUserAction This user action feature allows you to add filters, and classifier in order to follow and focus on the particles as well as the processes you are interested in with this command: For filters /gamos/userAction USER_ACTION FILTER_NAME /gamos/filter FILTER_NAME FILTER_CLASS PARAMETER_1 PARAMETER_2 For classifiers /gamos/userAction USER_ACTION CLASSIFIER_NAME /gamos/scoring/assignClassifier2Scorer CLASSIFIER_NAME SCORER_NAME Next step consiste of attaching a sensitive detector to a volume, which used to creating hits (deposits of energy) each time a track traverses a sensitive volume and loses some energy.
Finally you can creat a score to calculate many quantities with or without error, in one or several volumes, for each scored quantity one of several filters can be used, only particles in a given volumen, and results can be displayed in a file or as a histogram.

Attenuation study for photons of different energy (shielding)
To strengthen radiation protection, nuclear activities must be carried out in accordance with the fundamental principles to ensure the protection of man and the environment against the harmful effects of exposure to ionizing radiation, and since we are talking about medical nuclear medicine, The use of ionizing radiation for medical purposes contributes significantly to the exposure of the population. After natural exposure, this practice presents the first source of exposure of artificial origin, it is therefore recommended to control the doses, and to minimize the time, it is suggested to simulate the experiment before the practice.
We will be interested in the photon, in a midst, the fluence of photons decreases exponentially with the thickness of the material crossed. So, we have: As the Kerma is at any point proportional to the fluence of photons: For against, the absorbed dose is proportional to the photon fluence that when the electronic equilibruim is achieved in the material medium. In this case: Therefore the dose rate decreases exponentially with the thickness of the material traversed, so to protect ourselves from external exposure we must move far from the source and protect ourselves with shielding, where the role of simulation comes in determining the thickness necessary to attenuate these photons.
The attenuation study of a parallel beam of photons of diffetent energy which moves away from a distance of 1 m from the plate of material with Gamos is made by this user action: /gamos/userAction SHNthValueLayerUA, and we must stopped secondary particle, so that they will not be counted as particles coming out of the shield layers by this command /gamos/userAction GmKillAtStackingActionUA GmSecondaryFilter. This commands, allows us to studying penetration, and to establish the role of the shielding.    Figures 8 and 9. (Figures 4-9). From the curves we can see that the element suitable for attenuating and absorbing photons is lead (you can try other materials than Cu), because it is less expensive, and it allows to have an optimal thickness compared to other materials, as well as for the facility of its control of the parameters of aquatic chemistry.  We can also Make an histogram of the energy spectrum of photons of energy 1 Mev and other types of particles that traverse the plate by using Gamos filters, and classifiers, with GmClassifierByParticle:DataList FinalKineticEnergy (Figures 10-13).

Interpretation
So we can remove the number of interactions that occur along the path of the particle in the material with this command /gamos/userAction GmCountProcessesUA Shielding calculations made by hand are often approximations, the most accurate are those performed by simulation, The thickness of the shielding needed depends on: Radiation Energy, the shield material, and Radiation intensity, So the lower the energy of the gamma rays, the easier it is to shield of them, and high energy gamma rays sometimes determine shielding requirements.
For gamma rays, the higher the atomic number of the shield material, the greater the attenuation of the radiation.

PET scanner
PET imaging combined with CT scanning allows two examinations to be performed simultaneously: the PET examination studies the biological activity of organs, while the CT examination studies the anatomy and morphology of organs. The objective of this examination is to detect anomalous organic activities, by injecting the patient with low-level radioactive glucose, the radiation dose is very low, and does not represent a risk for the patient and his entourage. The injected product is a weakly radioactive marker (derived from glucose marked by Fluorine 18), which will be fixed on the organs, with a preference for the organs that work more, the radioactive marker to highlight the biological activity. This examination is performed on a hybrid machine consisting of two devices: • PET scanner that records the radiation emissions of the injected product.
• X-ray CT which allows to obtain anatomical images Quantitative reconstruction of PET (Positron emission tomography) data with GAMOS (Monte Carlo) needs to have knowledge of the scanner geometry (Figure 13). Both typical clinical and preclinical scanners use a block-type geometry. Many rectangular blocks of crystals are arrayed in regular polygons. Some of these polygons are arranged along the axis of the scanner, and Monte Carlo simulation remains an essential tool to help design new medical imaging devices, and to know what is happening in the simulation.  With this user action we can obtain information about the physics process that occur in a PET scanner with all particle: /gamos/userAction GmCountTracksUA /gamos/userAction GmCountProcessesUA /gamos/userAction GmHistosGammaAtSD /gamos/analysis/histo1Max *Energy* 1*MeV /gamos/analysis/histo1Max *Pos* 200*mm /gamos/userAction GmTrackDataHistosUA GmPrimaryFilter We will obtain results about track (Figure 14) and procces that occur for each particle in terminal and we can save them in file, for example /gamos/userAction GmHistosGammaAtSD, this command give us an idea about the interaction of original gammas in the sensitive detector (Figure 15).
So we have 901 total number of events: 55.66% of 'original' gammas reaching one sensitive detector, 94.21% with photoelectric interaction in SD, 37.67%with photoelectric interaction and no Compton interactions, 38,51, with photoelectric interaction and one Compton interaction, 16.29% with photoelectric interaction and two Compton interaction,    6.7% with photoelectric interaction and more than two Compton interaction, 31,03% with no photoelectric interaction and no Compton interaction. Also we can get more details from the histrograms for examples: Figures 16-20 show the different parameters and details after reaction generated by Gamos based on random number generator (Section 2.2.4).

Conclusion
To conclude, Monte Carlo simulation facilitates the experiment and minimizes the time to process the phenomena, so we can go as far as studying the treatment   using proton therapy because if we use a cancer treatment with photons, there will be the maximum amount of X-rays, so there will be a maximum dose delivered to the area to be treated (tumor volume), but also there will be a certain level of dose around this volume which are the organs at risk, and which are the tissues that should not be irradiated and which are, so the great advantage of protons is to have a delicate dose, almost zero once the target is reached, because the protons deposit their energy locally, so they generate less complication, and allows to decrease the risk of having a radiation-induced carcinogenesis. Proton therapy has an extremely important indication, which makes it possible to prevent proton therapy, and the Monte Carlo method remains a very powerful tool that makes it possible to improve research in this field by going as far as microdosimetry.

Author details
Omaima Essaad Belhaj 1 *, Hamid Boukhal 1 and El Mahjoub Chakir 2 1 Laboratory of Radiation and Nuclear Systemes, University Abdelmalek Essaadi, Tetouan, Morocco 2 Laboratory of Materials Subatomic Physics, University Ibn Tofail Kenitra, Morocco *Address all correspondence to: omaimaessaad.belhaj@gmail.com © 2021 The Author(s). Licensee IntechOpen. This chapter is distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/ by/3.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.