Introduction to GEANT4
From UCL HEP PBT Wiki
for
Introduction to GEANT4
Jump to:
navigation
,
search
== Introduction == 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: * <span style="color:#800000"> G4VUserDetectorConstruction </span>: Describe the experimental setup, geometry and materials * <span style="color:#800000"> G4VUserPhysicsList </span>: Define particles, physics processes and range cuts * <span style="color:#800000"> G4UserPrimaryGeneratorAction </span>: Describe particle source, source dimensions, initial position, energy spectrum, angular distributions ; Optional classes: * <span style="color:#800000"> G4UserRunAction </span>: Define and store histograms * <span style="color:#800000"> G4UserEventAction </span>: Event selection and analysis of simulation data * <span style="color:#800000"> G4UserStackingAction </span>: Customize priority of tracks * <span style="color:#800000"> G4UserTrackingAction </span>: Decide whether a trajectory should be stored or not * <span style="color:#800000"> G4UserSteppingAction </span>: Kill, suspend, postpone a track ; Manager class * <span style="color:#800000"> G4RunManager </span>: Manages the simulation process == The function main() == The function <span style="color:#ff0000"> '''main()''' </span> defines the skeleton of your simulation code. Inside the function you instantiate <span style="color:#800000"> G4RunManager </span> and notify it of your mandatory and optional classes. Example <span style="color:#ff0000"> '''main()''' </span> function: <span style="color:#800000"> { </span> <span style="color:#800000"> ... </span> <span style="color:#800000"> // Run manager construction </span> <span style="color:#800000"> G4RunManager* runManager = new G4RunManager; </span> <span style="color:#800000"> // mandatory user initialization classes </span> <span style="color:#800000"> runManager->SetUserInitialization(new MyDetectorConstruction); </span> <span style="color:#800000"> runManager->SetUserInitialization(new myPhysicsList); </span> <span style="color:#800000"> // mandatory user action classes </span> <span style="color:#800000"> runManager->SetUserAction(new MyPrimaryGeneratorAction); </span> <span style="color:#800000"> // optional user action classes </span> <span style="color:#800000"> runManager->SetUserAction(new MyEventAction); </span> <span style="color:#800000"> runManager->SetUserAction(new MyRunAction); </span> <span style="color:#800000"> ... </span> <span style="color:#800000"> } </span> == Experimental setup == == Physics processes == == Generate primary particles == == Optional user classes ==
Return to
Introduction to GEANT4
.
Views
Page
Discussion
View source
History
Personal tools
Log in
Navigation
Main page
Community portal
Current events
Recent changes
Random page
Help
Search
Toolbox
What links here
Related changes
Special pages