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