// // medtech.cc // CERN MedTech:Hack // // Created by Baranyai David on 2018. 03. 30.. // Copyright © 2018. Baranyai David. All rights reserved. // #ifdef G4MULTITHREADED #include "G4MTRunManager.hh" #else #include "G4RunManager.hh" #endif #include "G4UImanager.hh" #include "G4VisExecutive.hh" #include "G4UIExecutive.hh" #include "QGSP_BERT.hh" #include "MedtechDetectorConstruction.hh" #include "MedtechActionInitialization.hh" #include "Parameters.hh" int main(int argc,char** argv) { Parameters *param = Parameters::getInstance(); int NoE=0; for(int i=1; i < argc-1; i++) { if(!strcmp("-n", argv[i])) { NoE = atoi(argv[i+1]); } else if(!strcmp("-p", argv[i])) { param -> SetParticleEnergy(atoi(argv[i+1])); } else if(!strcmp("-d", argv[i])) { param -> SetDegree(atoi(argv[i+1])); } } //parameters from command line #ifdef G4MULTITHREADED G4MTRunManager* runManager = new G4MTRunManager; unsigned nthreads = sysconf(_SC_NPROCESSORS_ONLN); //Use all available cores std::cout << "Using all cores (" << nthreads << ")\n"; runManager->SetNumberOfThreads(nthreads); #else G4RunManager* runManager = new G4RunManager; #endif runManager -> SetUserInitialization(new QGSP_BERT()); runManager -> SetUserInitialization(new MedtechDetectorConstruction()); runManager -> SetUserInitialization(new MedtechActionInitialization()); G4VisManager* visManager = new G4VisExecutive; visManager->Initialize(); G4UImanager* UImanager = G4UImanager::GetUIpointer(); if (NoE!=0) { //batch mode runManager->Initialize(); runManager->BeamOn(NoE); } else { //interactive mode G4UIExecutive* ui = 0; ui = new G4UIExecutive(argc, argv); UImanager -> ApplyCommand("/control/macroPath macros"); //Need to set, macros moved to that folder UImanager -> ApplyCommand("/control/execute gui.mac"); ui->SessionStart(); delete ui; } delete visManager; delete runManager; }