#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4UIterminal.hh"
#include "G4UItcsh.hh"
#include "DetectorConstruction.hh"
#include "PhysicsList.hh"
#include "PrimaryGeneratorAction.hh"
#include "RunAction.hh"
#include "EventAction.hh"
#include "SteppingAction.hh"
#include "SteppingVerbose.hh"
Go to the source code of this file.
Functions | |
int | main (int argc, char **argv) |
int main | ( | int | argc, | |
char ** | argv | |||
) |
Definition at line 29 of file jour3e.cc.
00029 { 00030 00031 //my Verbose output class 00032 G4VSteppingVerbose::SetInstance(new SteppingVerbose); 00033 00034 //Construct the default run manager 00035 G4RunManager* runManager = new G4RunManager; 00036 00037 //set mandatory initialization classes 00038 // 00039 DetectorConstruction* detector = new DetectorConstruction(); 00040 runManager->SetUserInitialization(detector); 00041 00042 PhysicsList* physics = new PhysicsList(); 00043 runManager->SetUserInitialization(physics); 00044 00045 PrimaryGeneratorAction* primary = new PrimaryGeneratorAction(detector); 00046 runManager->SetUserAction(primary); 00047 00048 //set user action classes 00049 // 00050 RunAction* run_action = new RunAction(detector); 00051 runManager->SetUserAction(run_action); 00052 // 00053 EventAction* event_action = new EventAction(run_action); 00054 runManager->SetUserAction(event_action); 00055 // 00056 SteppingAction* step_action = new SteppingAction(detector, run_action, 00057 event_action); 00058 runManager->SetUserAction(step_action); 00059 00060 //Initialize Geant4 kernel 00061 // 00062 runManager->Initialize(); 00063 00064 //get the pointer to the User Interface manager 00065 G4UImanager* UI = G4UImanager::GetUIpointer(); 00066 00067 if (argc!=1) { // Batch mode 00068 G4String command = "/control/execute "; 00069 G4String fileName = argv[1]; 00070 UI->ApplyCommand(command+fileName); 00071 } 00072 00073 else { // Define UI terminal for interactive mode 00074 00075 #ifdef G4VIS_USE 00076 G4VisManager* visManager = new G4VisExecutive; 00077 visManager->Initialize(); 00078 #endif 00079 00080 G4UIsession* session = 0; 00081 #ifdef G4UI_USE_TCSH 00082 session = new G4UIterminal(new G4UItcsh); 00083 #else 00084 session = new G4UIterminal(); 00085 #endif 00086 UI->ApplyCommand( "/control/execute vis.mac"); 00087 session->SessionStart(); 00088 delete session; 00089 00090 #ifdef G4VIS_USE 00091 delete visManager; 00092 #endif 00093 } 00094 00095 //job termination 00096 // 00097 delete runManager; 00098 return 0; 00099 }