File indexing completed on 2025-01-18 09:16:37
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044 #include "G4Types.hh"
0045 #include "G4RunManagerFactory.hh"
0046
0047 #include "G4UImanager.hh"
0048 #include "G4UIterminal.hh"
0049 #include "G4UItcsh.hh"
0050
0051 #include "G4VisExecutive.hh"
0052
0053 #include "G4UIExecutive.hh"
0054
0055 #include "GammaKnifeDetectorConstruction.hh"
0056 #include "GammaKnifePhysicsList.hh"
0057 #include "GammaKnifePrimaryGeneratorAction.hh"
0058 #include "GammaKnifeRunAction.hh"
0059 #include "GammaKnifeActionInitialization.hh"
0060
0061 #include "Randomize.hh"
0062 #include "G4RunManager.hh"
0063 #include "G4UImessenger.hh"
0064 #include "G4ScoringManager.hh"
0065 #include "globals.hh"
0066 #include "GammaKnifeController.hh"
0067 #include "G4PhysListFactory.hh"
0068
0069 #include <ctime>
0070
0071 int main(int argc ,char ** argv)
0072 {
0073
0074 G4int seconds = time(NULL);
0075 G4Random::setTheSeed(seconds);
0076
0077 auto* runManager = G4RunManagerFactory::CreateRunManager();
0078 G4int nThreads = 4;
0079 runManager->SetNumberOfThreads(nThreads);
0080
0081 G4ScoringManager::GetScoringManager();
0082
0083
0084 GammaKnifeDetectorConstruction* detector = new GammaKnifeDetectorConstruction();
0085 runManager -> SetUserInitialization(detector);
0086
0087
0088 G4PhysListFactory factory;
0089 G4VModularPhysicsList* phys = 0;
0090 G4String physName = "";
0091
0092
0093 char* path = std::getenv("PHYSLIST");
0094 if (path) { physName = G4String(path); }
0095
0096 if(physName != "" && factory.IsReferencePhysList(physName))
0097 {
0098 phys = factory.GetReferencePhysList(physName);
0099 }
0100
0101 if(!phys) { phys = new GammaKnifePhysicsList(); }
0102
0103 runManager->SetUserInitialization(phys);
0104
0105
0106 GammaKnifeActionInitialization* actionInitialization= new GammaKnifeActionInitialization();
0107 runManager->SetUserInitialization(actionInitialization);
0108
0109 GammaKnifeController* controller = new GammaKnifeController( detector );
0110 controller->ReadFile("MachineAngle.in");
0111
0112
0113
0114 runManager->Initialize();
0115
0116
0117 G4VisManager* visManager = new G4VisExecutive;
0118 visManager -> Initialize();
0119
0120
0121 G4UImanager* UImanager = G4UImanager::GetUIpointer();
0122
0123 if (argc!=1) {
0124
0125 G4String command = "/control/execute ";
0126 G4String fileName = argv[1];
0127 UImanager->ApplyCommand(command+fileName);
0128 }
0129 else {
0130
0131
0132 G4UIExecutive* ui = new G4UIExecutive(argc, argv);
0133
0134 UImanager->ApplyCommand("/control/execute defaultMacro.mac");
0135
0136 ui->SessionStart();
0137 delete ui;
0138
0139 }
0140 delete controller;
0141 delete visManager;
0142 delete runManager;
0143
0144
0145 return 0;
0146 }