Geant4 Cross Reference (Editor's cut)

Cross-Referencing   Geant4
Geant4/run/README.TXT

Version: [ ReleaseNotes ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3 ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ]

  1 
  2  GEANT4
  3  
  4  This directory contains several examples of GEANT4 main programs,
  5  from very simple cases (a purely batch program), 
  6  to interactive programs based on the G4 command line interface,
  7  to more complex cases programs touching most of the G4 functionality.
  8  
  9  Those main programs provide just examples of initialization and usage
 10  of the GEANT4 toolkit classes, but the user is also free to define his
 11  own way and functions to initialize G4 and write the main program.
 12 
 13  A typical GEANT4 main program looks like the following:
 14 
 15 int main() {
 16 
 17   // Create Run Manager  
 18   G4RunManager * runManager = new G4RunManager;
 19 
 20   // Register User Classes to the RunManager
 21     // Mandatory classes  -----------------------
 22       // Detector geometry
 23       runManager-> set_userInitialization(new MyDetectorConstruction);
 24       // Physics List
 25       runManager-> set_userInitialization(new MyPhysicsList);
 26       // Primary Generator
 27       runManager->set_userAction(new MyPrimaryGeneratorAction);
 28   
 29     // Optiolnal classes  -----------------------
 30       // User Actions
 31       runManager->set_userAction(new MyRunAction);
 32       runManager->set_userAction(new MyEventAction);
 33       runManager->set_userAction(new MyStackingAction);
 34       runManager->set_userAction(new MyTrackingAction);
 35       runManager->set_userAction(new MySteppingAction);
 36 
 37 
 38   // Define (G)UI terminal for interactive mode
 39   G4UIsession * session = new G4UIterminal;
 40 
 41   // User interactions
 42   session->sessionStart();
 43   
 44   // Termination
 45   delete session;
 46   delete runManager;
 47   return 0;
 48 }
 49  
 50  First of all, user must create the RunManager. The RunManager controles 
 51  run sequence by receiving messages from the user via UIsession.
 52  The following are a part of commands for run controle; 
 53     /run/initialize *          Initialize G4 kernel.
 54     /run/beamOn *              Start a Run.
 55     /run/verbose *             Set the verbose level of G4RunManager.
 56     /run/abort *               Abort current run processing.
 57  For example, event loop will start by using "/run/beamOn" commands.
 58 
 59  In order to execute simulation, user must provide geometrical 
 60  configuration of his own detector. In addition information of 
 61  primary events must be given with a list of particle types and
 62  processes for them.
 63  
 64  So, user must provide his own classes derived from the following
 65  three abstract classes by implementing their pure virtual functions
 66  and register those user classes to the RunManager. 
 67 
 68  G4VUserDetectorConstruction       - Detector Geometry, Materials
 69    pure virtual functions
 70      G4VPhysicalVolume* construct() 
 71      - construct detectors;
 72              normally implemented to serve as the entry point 
 73              for the tree of methods describing solids, volumes, 
 74              materials and sensitive detectors.
 75 
 76  G4VUserPhysicsList                - Particle types and Processes 
 77    pure virtual functions
 78      void constructParticle() 
 79            - construct particles;
 80              normally implemented to select desired particle types.  
 81      void constructPhysics() 
 82            - construct procesess;
 83        normally implemented to select desired physics processes
 84              for each particle types and register them to the ProcessManager.
 85      void setCuts(G4double aValue)
 86      - sets a cut value; 
 87        normally implemented to set cut value in range for all 
 88              particle types.
 89  
 90  G4VUserPrimaryGeneratorAction     - Event Generator selection
 91    pure virtual functions
 92      void generatePrimaries(G4Event* anEvent)
 93            - generate a event with primary particles
 94        normally implemented to select the desired event generation 
 95              mechanism, such as the ParticleGun or the PYTHIA interface.
 96 
 97  In addition to the above mandatory classes, there are 5 user classes
 98  to customize the default functionality of GEANT4 simulation. 
 99 
100  G4UserRunAction                   - Actions for each Run
101  G4UserEventAction                 - Actions for each Event
102  G4UserStackingAction              - Tracks Stacking selection
103  G4UserTrackingAction              - Actions for each Track
104  G4UserSteppingAction              - Actions for each Step
105  
106  The virtual functions belonging to the classes above are:
107 
108  G4UserRunAction                   - void beginOfRunAction(G4Run*)
109                                    - void endOfRunAction(G4Run*)
110  
111  G4UserEventAction                 - void beginOfEventAction(G4Event*)
112                                    - void endOfEventAction(G4Event*)
113  
114  G4UserStackingAction              - G4ClassificationOfNewTrack
115                                          classifyNewTrack(G4Track *const)
116                                    - void newStage()
117                                    - void prepareNewEvent()
118  
119  G4UserTrackingAction              - void preUserTrackingAction()
120                                    - void postUserTrackingAction()
121   
122  G4UserSteppingAction              - void userSteppingAction()
123  
124  Finally, more details can be found in the header files and in the source
125  code relative to the classes outlined above.
126 
127 
128 
129 
130 
131