Introduction to GEANT4
From UCL HEP PBT Wiki
m |
m |
||
Line 29: | Line 29: | ||
== <span style="color:#000080"> The function main() </span> == | == <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. | + | 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. This is example <span style="color:#ff0000"> main() </span> function, where MyDetectorConstruction, MyPhysicsList, MyPrimaryGeneratorAction, MyEventAction and MyRunAction are derived classes from the GEANT4 base classes: |
<span style="color:#800000"> { </span> | <span style="color:#800000"> { </span> | ||
Line 119: | Line 119: | ||
# electromagnetic | # electromagnetic | ||
- | + | ## standard | |
- | + | ## low Energy (Livermore Library / Penelope) | |
# hadronic | # hadronic | ||
# decay | # decay | ||
Line 132: | Line 132: | ||
<span style="color:#800000"> MyPhysicsList :: MyPhysicsList(): G4VUserPhysicsList() </span> | <span style="color:#800000"> MyPhysicsList :: MyPhysicsList(): G4VUserPhysicsList() </span> | ||
- | <span style="color:#800000"> { | + | |
- | + | <span style="color:#800000"> { //Define production thresholds </span> | |
- | <span style="color:#800000"> defaultCutValue = 1.0*cm; </span> | + | |
- | + | <span style="color:#800000"> defaultCutValue = 1.0*cm;} </span> | |
+ | |||
+ | |||
<span style="color:#800000"> void MyPhysicsList :: ConstructParticles() </span> | <span style="color:#800000"> void MyPhysicsList :: ConstructParticles() </span> | ||
- | <span style="color:#800000"> { | + | |
- | + | <span style="color:#800000"> { //Define the particles </span> | |
+ | |||
<span style="color:#800000"> G4Electron::ElectronDefinition(); </span> | <span style="color:#800000"> G4Electron::ElectronDefinition(); </span> | ||
+ | |||
<span style="color:#800000"> G4Positron::PositronDefinition(); </span> | <span style="color:#800000"> G4Positron::PositronDefinition(); </span> | ||
- | <span style="color:#800000"> G4Gamma::GammaDefinition(); </span> | + | |
- | + | <span style="color:#800000"> G4Gamma::GammaDefinition();} </span> | |
+ | |||
+ | |||
<span style="color:#800000"> void MyPhysicsList :: SetCuts() </span> | <span style="color:#800000"> void MyPhysicsList :: SetCuts() </span> | ||
- | <span style="color:#800000"> { | + | |
- | + | <span style="color:#800000"> { //Set the production threshold </span> | |
- | <span style="color:#800000"> SetCutsWithDefault(); </span> | + | |
- | + | <span style="color:#800000"> SetCutsWithDefault();} </span> | |
+ | |||
== <span style="color:#000080"> Generate primary particles </span> == | == <span style="color:#000080"> Generate primary particles </span> == |