This is the code for the data generation for the paper,
The data is generated using CERN’s Geant4 simulation software. To generate the 3D objects, we make use of fractal noise to generate objects of various shapes. The material of the object is randomly chosen from a set list of materials of different radiation lengths.
The geometry of the system can be found above. The target object is contained within a cube of side length 1 m. The input and output detectors are squares of side length 2 m. They are separated from the object by a distance of 0.5 m.
For the muon beam, we use a beam with a
First, you will need to setup CERN's Geant4. It can be downloaded from https://geant4.web.cern.ch/. This was built with Geant4 v11.1.2.
Then, run
mkdir build
cd build
cmake ..
make
Once done, run
mkdir voxels
mkdir output
python3 run.py
The configurations within run.py
can be adjusted accordingly, depending on your desired output directory.
There are several files which you can use to adjust the settings for the simulation.
-
To adjust the geometry, change the settings in CONSTANTS.hh. You can adjust the resolution of the simulation, the size of the target object, distance from the detectors, etc. Do note the resolution should be adjusted within run.py as well. You will also need to recompile the entire project by running
make
inbuild
. -
To adjust the dosage, muon angular and spacial distribution, change run.mac. You don't need to worry about copying it to other directories, run.py will do that for you. Also note that since many muons do not hit the final detector, the dosage you will see in the final CSV output is not necessarily the same (and is usually much lower) than what is indicated in run.mac.
-
To adjust the resolution of the target object and the way it is generated, change run.py.
You can refer to detector.cc for the output format. Also note that muons in the simulation travel from the positive z-direction to the negative z-direction.
Basically, the program outputs headerless *.csv files.
The columns in order are:
- x position of detection (mm)
- y position of detection (mm)
- z position of detection (mm)
- x component of momentum (MeV/c)
- y component of momentum (MeV/c)
- z component of momentum (MeV/c)
- initial x position (mm)
- initial y position (mm)
- initial z position (mm)
- x-component of initial momentum (normalised)
- y-component of initial momentum (normalised)
- z-component of initial momentum (normalised)
- initial energy of the muon (MeV)