Introduction to GEANT4

From UCL HEP PBT Wiki

Jump to: navigation, search
m
m
Line 23: Line 23:
; Manager class  
; Manager class  
-
* <span style="color:#800000"> G4RunManager </span>: Manages the simulation process
+
* <span style="color:#800000"> G4RunManager </span>: Manages the simulation process
 +
 
-
The function <span style="color:#ff0000"> '''main()''' </span> defines the skeleton of your simulation code. Inside the function you instantiate G4RunManager 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:#800000"> G4RunManager </span> and notify it of your mandatory and optional classes. Example <span style="color:#ff0000"> '''main()''' </span> function:
-
Example <span style="color:#ff0000"> '''main()''' </span> function:
+
<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>

Revision as of 13:31, 3 July 2014

Personal tools