Running an example
From UCL HEP PBT Wiki
m (Created page with "To test that your version of Geant4 has been successfully installed we will build and run the basic>B1 example included with the Geant4 install. 1. Create the file “B1-build...") |
m |
||
Line 1: | Line 1: | ||
- | To test that your version of Geant4 has been successfully installed we will build and run the basic>B1 example included with the Geant4 install. | + | To test that your version of Geant4 has been successfully installed we will build and run the |
+ | '''basic>B1''' example included with the Geant4 install. | ||
- | 1. Create the file “B1-build” on your desktop (I would advise placing any build files / other examples you work on in a separate folder to the Geant4-install so that if you wish to update your version of Geant your work is not accidentally deleted) | + | 1. Create the file “B1-build” on your desktop (I would advise placing any build files / other examples |
+ | you work on in a separate folder to the Geant4-install so that if you wish to update your version of | ||
+ | Geant your work is not accidentally deleted) | ||
- | 2. Now change your present working directory to | + | 2. Now change your present working directory to /home/your_name/Desktop/B1-build |
- | /home/your_name/Desktop/B1-build | + | |
by typing the command | by typing the command | ||
+ | |||
+ | |||
cd /home/your_name/Desktop/B1-build | cd /home/your_name/Desktop/B1-build | ||
4. To build your project type the following command into the terminal | 4. To build your project type the following command into the terminal | ||
+ | |||
+ | |||
cmake -DGeant4_DIR=/home/your_name/Desktop/Geant4-install/lib64/Geant4-10.0.0 SPACE /home/your_name/Desktop/Geant4-install/share/Geant4.10.0.1/examples/basic/B1 | cmake -DGeant4_DIR=/home/your_name/Desktop/Geant4-install/lib64/Geant4-10.0.0 SPACE /home/your_name/Desktop/Geant4-install/share/Geant4.10.0.1/examples/basic/B1 | ||
SPACE should obviously be replaced with a space bar (do not type the word SPACE) | SPACE should obviously be replaced with a space bar (do not type the word SPACE) | ||
- | 5. Now type the command | + | 5. Now type the command |
+ | |||
make | make | ||
+ | |||
Into the command terminal | Into the command terminal | ||
6. to run your example, type the following command into the terminal | 6. to run your example, type the following command into the terminal | ||
+ | |||
+ | |||
source /home/your_name/Desktop/geant4-install/bin/geant4.sh | source /home/your_name/Desktop/geant4-install/bin/geant4.sh | ||
+ | |||
+ | |||
This command tells the terminal where all the data files that are required to running and building your simulation are. | This command tells the terminal where all the data files that are required to running and building your simulation are. | ||
7. Finally, to open your simulation type the command | 7. Finally, to open your simulation type the command | ||
+ | |||
./exampleB1 | ./exampleB1 | ||
+ | |||
Into the terminal | Into the terminal | ||
To run the simulation type the following commands into the terminal: | To run the simulation type the following commands into the terminal: | ||
+ | |||
Idle> /control/verbose 2 | Idle> /control/verbose 2 | ||
Idle> /tracking/verbose 1 | Idle> /tracking/verbose 1 |