What is Geant4
Simply put, Geant4 is a toolkit for simulating particles passing through matter. Provides complete tools for detector simulation: geometry, detector response, operation, story and track management, graphical display, user interface, etc. Provides a very rich selection of physical processes, see the website introduction.
It is a monte carlo application software package developed by CERN based on C++ object-oriented technology. It is used to simulate the physical process of particle transport in matter. Because of its good versatility and extensibility, its applications mainly include: high energy physics, nuclear physics, accelerator physics, medical and space science research, etc.
Developed from Geant3, Geant4 makes full use of the advantages of C++ language, and is one of the best tools for particle and nuclear physics simulation. It was the first particle and nuclear physics software package to be successfully redesigned using an object-oriented environment, and almost all simulations of large experiments were based on Geant4.
2. Installation environment in Linux
The first step is to download the appropriate installation package, usually the latest version, go to the download page of the official website, the latest version is Geant4 11.0.
Download GNU or Linux tar format, remember to download Source files, not Data Files. After the download is complete, decompress to the specified directory.
The tar - XZVF geant4.11. Tar. GzCopy the code
The second step is to create the build directory using CMake to generate the Makefile
CD /home/pl/geant4.11 mkdir build CD buiid/Copy the code
Then set the installation directory and some configuration parameters
Cmake - DCMAKE_INSTALL_PREFIX = / opt/apps/geant4.11 - DGEANT4_USE_OPENGL_X11 = ON - DGEANT4_USE_RAYTRACER_X11 = ON -DGEANT4_USE_GDML=ON -DGEANT4_INSTALL_DATA=ON ..Copy the code
If it works properly, it looks something like this
The third step is to compile with make command. My server CPU has 8 cores. In order to speed up the compilation, I take parallel compilation. In normal cases, parallel compilation is not applicable because it takes a long time and requires patience.
make -j 8
Copy the code
Step 4 After the compilation is successful, install the compiled file to the specified folder
make install
Copy the code
If nothing goes wrong, the installation is successful. The last thing you need to do is set Geant4 to the environment variable.
The source/opt/apps/geant4.11 / bin/geant4. ShCopy the code
First Demo
To verify that the installation is correct, use the basic/B1 example that comes with Geant4.
CD/home/pl cp - r geant4.11 / examples/basic/B1. CD B1 mkdir build CD build cmake. J. makeCopy the code
We have an executable program exampleB1 in the build/ directory. Execute it
./exampleB1
Copy the code
After running, a visual section will open, so it is running properly.