107 G4UIExecutive* ui = 0;
109 ui =
new G4UIExecutive(argc, argv);
114 G4Timer* theTimer =
new G4Timer();
121 CLHEP::RanluxEngine defaultEngine( 1234567, 4 );
122 G4Random::setTheEngine( &defaultEngine );
123 G4int
seed = time( NULL );
124 G4Random::setTheSeed( seed );
126 #ifdef G4MULTITHREADED 128 G4MTRunManager* runManager =
new G4MTRunManager;
130 G4RunManager* runManager =
new G4RunManager;
136 HadrontherapyGeometryController *geometryController =
new HadrontherapyGeometryController();
139 HadrontherapyGeometryMessenger *geometryMessenger =
new HadrontherapyGeometryMessenger(geometryController);
141 G4ScoringManager *scoringManager = G4ScoringManager::GetScoringManager();
142 scoringManager->SetVerboseLevel(1);
145 geometryController->SetGeometry(
"default");
148 G4PhysListFactory factory;
149 G4VModularPhysicsList* phys = 0;
153 char* path = std::getenv(
"PHYSLIST");
154 if (path) { physName =
G4String(path); }
156 if(physName !=
"" && factory.IsReferencePhysList(physName))
158 phys = factory.GetReferencePhysList(physName);
162 G4cout <<
"Going to register G4ParallelWorldPhysics" << G4endl;
163 phys->RegisterPhysics(
new G4ParallelWorldPhysics(
"DetectorROGeometry"));
167 G4cout <<
"Using HadrontherapyPhysicsList()" << G4endl;
168 phys =
new HadrontherapyPhysicsList();
172 runManager->SetUserInitialization(phys);
175 runManager->SetUserInitialization(
new HadrontherapyActionInitialization);
178 G4ScoringManager::GetScoringManager();
181 HadrontherapyInteractionParameters* pInteraction =
new HadrontherapyInteractionParameters(
true);
184 HadrontherapyAnalysis* analysis = HadrontherapyAnalysis::GetInstance();
189 G4VisManager* visManager =
new G4VisExecutive;
193 G4UImanager* UImanager = G4UImanager::GetUIpointer();
197 G4String command =
"/control/execute ";
199 UImanager->ApplyCommand(command+fileName);
205 UImanager -> ApplyCommand(
"/control/execute macro/defaultMacro.mac");
206 ui -> SessionStart();
214 G4cout <<
"The simulation took: " << theTimer->GetRealElapsed() <<
" s to run (real time)" 223 if ( HadrontherapyMatrix * pMatrix = HadrontherapyMatrix::GetInstance() )
226 pMatrix -> StoreDoseFluenceAscii();
230 if (HadrontherapyLet *let = HadrontherapyLet::GetInstance())
231 if(let -> doCalculation)
234 let -> StoreLetAscii();
237 delete geometryMessenger;
238 delete geometryController;