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