105 CLHEP::HepRandom::setTheEngine(
new CLHEP::RanecuEngine());
113 #ifdef G4MULTITHREADED 115 G4MTRunManager* runManager =
new G4MTRunManager;
118 G4RunManager* runManager =
new G4RunManager;
125 HadrontherapyGeometryController *geometryController =
new HadrontherapyGeometryController();
128 HadrontherapyGeometryMessenger *geometryMessenger =
new HadrontherapyGeometryMessenger(geometryController);
130 G4ScoringManager *scoringManager = G4ScoringManager::GetScoringManager();
131 scoringManager->SetVerboseLevel(1);
135 geometryController->SetGeometry(
"default");
138 G4ScoringManager::GetScoringManager();
141 G4PhysListFactory factory;
142 G4VModularPhysicsList* phys = 0;
146 char* path = getenv(
"PHYSLIST");
147 if (path) { physName =
G4String(path); }
149 if(physName !=
"" && factory.IsReferencePhysList(physName))
151 phys = factory.GetReferencePhysList(physName);
155 G4cout <<
"Going to register G4ParallelWorldPhysics" << G4endl;
156 phys->RegisterPhysics(
new G4ParallelWorldPhysics(
"DetectorROGeometry"));
160 G4cout <<
"Using HadrontherapyPhysicsList()" << G4endl;
161 phys =
new HadrontherapyPhysicsList();
164 runManager->SetUserInitialization(phys);
167 runManager->SetUserInitialization(
new HadrontherapyActionInitialization);
172 HadrontherapyInteractionParameters* pInteraction =
new HadrontherapyInteractionParameters(
true);
175 HadrontherapyAnalysisManager* analysis = HadrontherapyAnalysisManager::GetInstance();
177 #ifdef G4ANALYSIS_USE_ROOT 183 G4VisManager* visManager =
new G4VisExecutive;
188 G4UImanager* UImanager = G4UImanager::GetUIpointer();
193 G4UIExecutive* ui =
new G4UIExecutive(argc, argv);
194 G4cout <<
" UI session starts ..." << G4endl;
195 UImanager -> ApplyCommand(
"/control/execute macro/defaultMacro.mac");
196 ui -> SessionStart();
202 G4String command =
"/control/execute ";
204 UImanager -> ApplyCommand(command+fileName);
209 if ( HadrontherapyMatrix * pMatrix = HadrontherapyMatrix::GetInstance() )
211 pMatrix -> TotalEnergyDeposit();
212 pMatrix -> StoreDoseFluenceAscii();
213 #ifdef G4ANALYSIS_USE_ROOT 215 pMatrix -> StoreDoseFluenceRoot();
219 if (HadrontherapyLet *let = HadrontherapyLet::GetInstance())
220 if(let -> doCalculation)
223 let -> StoreLetAscii();
224 #ifdef G4ANALYSIS_USE_ROOT 226 let -> StoreLetRoot();
231 #ifdef G4ANALYSIS_USE_ROOT 232 if (analysis -> IsTheTFile()) analysis -> flush();
240 delete geometryMessenger;
241 delete geometryController;