Introduction to GEANT4

From UCL HEP PBT Wiki

(Difference between revisions)
Jump to: navigation, search
m
m
Line 5: Line 5:
* You may take actions during the simulation - inspect and store results.  
* You may take actions during the simulation - inspect and store results.  
-
The interaction with GEANT4 is done via base classes. There are eight base classes: 
+
The interaction with GEANT4 is done via base classes.  
-
* Mandatory classes
+
; Mandatory classes
-
; G4VUserDetectorConstruction: Describe the experimental setup, geometry and materials
+
* <span style="color:#800000"> G4VUserDetectorConstruction </span>: Describe the experimental setup, geometry and materials
-
; G4VUserPhysicsList: Define particles, physics processes and range cuts
+
* <span style="color:#800000"> G4VUserPhysicsList </span>: Define particles, physics processes and range cuts
-
; G4UserPrimaryGeneratorAction: Describe particle source, source dimensions, initial position, energy spectrum, angular distributions
+
* <span style="color:#800000"> G4UserPrimaryGeneratorAction </span>: Describe particle source, source dimensions, initial position, energy spectrum, angular distributions
-
* Optional classes
+
; Optional classes:
-
; G4UserRunAction: Define and store histograms  
+
* <span style="color:#800000"> G4UserRunAction </span>: Define and store histograms  
-
; G4UserEventAction: Event selection and analysis of simulation data
+
* <span style="color:#800000"> G4UserEventAction </span>: Event selection and analysis of simulation data
-
; G4UserStackingAction: Customize priority of tracks
+
* <span style="color:#800000"> G4UserStackingAction </span>: Customize priority of tracks
-
; G4UserTrackingAction: Decide whether a trajectory should be stored or not
+
* <span style="color:#800000"> G4UserTrackingAction </span>: Decide whether a trajectory should be stored or not
-
; G4UserSteppingAction: Kill, suspend, postpone a track
+
* <span style="color:#800000"> G4UserSteppingAction </span>: Kill, suspend, postpone a track
-
You can create your own classes which are derived from the base classes. All of them should be registered with the G4RunManager. In function main() which is the skeleton of your simulation code you instantiate G4RunManager and notify it of your mandatory and optional classes.
+
; Manager class
 +
 
 +
* <span style="color:#800000"> G4RunManager </span>: Manages the simulation process 
 +
 
 +
The function main() is the skeleton of your simulation code. Inside the function you instantiate G4RunManager and notify it of your mandatory and optional classes.  
 +
 
 +
Example main() function:

Revision as of 12:48, 3 July 2014

GEANT4 is a software toolkit based on C++. In your code you have to define:

  • Your experimental setup - geometry, materials and primary particles.
  • Which physics process you are interested in.
  • You may take actions during the simulation - inspect and store results.

The interaction with GEANT4 is done via base classes.

Mandatory classes
  • G4VUserDetectorConstruction : Describe the experimental setup, geometry and materials
  • G4VUserPhysicsList : Define particles, physics processes and range cuts
  • G4UserPrimaryGeneratorAction : Describe particle source, source dimensions, initial position, energy spectrum, angular distributions
Optional classes
  • G4UserRunAction : Define and store histograms
  • G4UserEventAction : Event selection and analysis of simulation data
  • G4UserStackingAction : Customize priority of tracks
  • G4UserTrackingAction : Decide whether a trajectory should be stored or not
  • G4UserSteppingAction : Kill, suspend, postpone a track
Manager class
  • G4RunManager : Manages the simulation process

The function main() is the skeleton of your simulation code. Inside the function you instantiate G4RunManager and notify it of your mandatory and optional classes.

Example main() function:

Personal tools