Introduction to GEANT4
From UCL HEP PBT Wiki
m |
m |
||
Line 1: | Line 1: | ||
- | == Introduction == | + | == <span style="color:#000080"> Introduction </span> == |
GEANT4 is a software toolkit based on C++. In your code you have to define: | GEANT4 is a software toolkit based on C++. In your code you have to define: | ||
Line 27: | Line 27: | ||
* <span style="color:#ff0000"> G4RunManager </span>: Manages the simulation process | * <span style="color:#ff0000"> G4RunManager </span>: Manages the simulation process | ||
- | == The function main() == | + | == <span style="color:#000080"> The function main() </span> == |
The function <span style="color:#ff0000"> main() </span> defines the skeleton of your simulation code. Inside the function you instantiate <span style="color:#ff0000"> G4RunManager </span> and notify it of your mandatory and optional classes. Example <span style="color:#ff0000"> main() </span> function: | The function <span style="color:#ff0000"> main() </span> defines the skeleton of your simulation code. Inside the function you instantiate <span style="color:#ff0000"> G4RunManager </span> and notify it of your mandatory and optional classes. Example <span style="color:#ff0000"> main() </span> function: | ||
Line 62: | Line 62: | ||
<span style="color:#800000"> } </span> | <span style="color:#800000"> } </span> | ||
- | == Experimental setup == | + | == <span style="color:#000080"> Experimental setup </span> == |
You can define your experiment by using three base classes: | You can define your experiment by using three base classes: | ||
Line 109: | Line 109: | ||
<span style="color:#800000"> H2O->AddElement(O, natoms=1); </span> | <span style="color:#800000"> H2O->AddElement(O, natoms=1); </span> | ||
- | == Physics processes == | + | == <span style="color:#000080"> Physics processes </span> == |
- | == Generate primary particles == | + | == <span style="color:#000080"> Generate primary particles </span> == |
<span style="color:#ff0000"> G4VUserPrimaryGeneratorAction </span> is a mandatory user action class to control the generation of primary particles. | <span style="color:#ff0000"> G4VUserPrimaryGeneratorAction </span> is a mandatory user action class to control the generation of primary particles. | ||
Line 120: | Line 120: | ||
* <span style="color:#ff0000"> G4GeneralParticleSource </span> the primary vertex is randomly chosen on surface of a given volume with pre-defined energy spectra. | * <span style="color:#ff0000"> G4GeneralParticleSource </span> the primary vertex is randomly chosen on surface of a given volume with pre-defined energy spectra. | ||
- | == Optional user classes == | + | == <span style="color:#000080"> Optional user classes </span> == |