00001
00002
00003
00004
00005
00006
00007
00008 #include "G4RunManager.hh"
00009
00010 #include "G4UImanager.hh"
00011 #include "G4UIterminal.hh"
00012 #include "G4UItcsh.hh"
00013
00014 #include "DetectorConstruction.hh"
00015 #include "PhysicsList.hh"
00016
00017 #include "GPSPrimaryGeneratorAction.hh"
00018
00019 #include "SteppingVerbose.hh"
00020
00021 #ifdef G4VIS_USE
00022 #include "G4VisExecutive.hh"
00023 #endif
00024
00025
00026
00027 int main(int argc,char** argv) {
00028
00029
00030 G4VSteppingVerbose::SetInstance(new SteppingVerbose);
00031
00032
00033 G4RunManager* runManager = new G4RunManager;
00034
00035
00036
00037 DetectorConstruction* detector = new DetectorConstruction();
00038 runManager->SetUserInitialization(detector);
00039
00040 PhysicsList* physics = new PhysicsList();
00041 runManager->SetUserInitialization(physics);
00042
00043 GPSPrimaryGeneratorAction* primary = new GPSPrimaryGeneratorAction();
00044 runManager->SetUserAction(primary);
00045
00046
00047
00048 runManager->Initialize();
00049
00050
00051 G4UImanager* UI = G4UImanager::GetUIpointer();
00052
00053 if (argc!=1) {
00054 G4String command = "/control/execute ";
00055 G4String fileName = argv[1];
00056 UI->ApplyCommand(command+fileName);
00057 }
00058
00059 else {
00060
00061 #ifdef G4VIS_USE
00062 G4VisManager* visManager = new G4VisExecutive;
00063 visManager->Initialize();
00064 #endif
00065
00066 G4UIsession* session = 0;
00067 #ifdef G4UI_USE_TCSH
00068 session = new G4UIterminal(new G4UItcsh);
00069 #else
00070 session = new G4UIterminal();
00071 #endif
00072 UI->ApplyCommand( "/control/execute vis.mac");
00073 session->SessionStart();
00074 delete session;
00075
00076 #ifdef G4VIS_USE
00077 delete visManager;
00078 #endif
00079 }
00080
00081
00082
00083 delete runManager;
00084 return 0;
00085 }
00086
00087