Creation of Medtech
This commit is contained in:
parent
9264023505
commit
8d41c90e26
|
@ -0,0 +1,57 @@
|
|||
//
|
||||
// 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"
|
||||
|
||||
|
||||
int main(int argc,char** argv)
|
||||
{
|
||||
//parameter from command line
|
||||
int NoE=0;
|
||||
if (argc==2) NoE=atoi(argv[1]);
|
||||
|
||||
#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
|
||||
|
||||
G4VisManager* visManager = new G4VisExecutive;
|
||||
visManager->Initialize();
|
||||
G4UImanager* UImanager = G4UImanager::GetUIpointer();
|
||||
if (argc==2) {
|
||||
//batch mode
|
||||
runManager->Initialize();
|
||||
runManager->BeamOn(NoE);
|
||||
}
|
||||
else {
|
||||
//interactive mode
|
||||
G4UIExecutive* ui = 0;
|
||||
if ( argc == 1 ) {
|
||||
ui = new G4UIExecutive(argc, argv);
|
||||
}
|
||||
UImanager->ApplyCommand("/control/macroPath macros"); //Need to set, macros moved to that folder
|
||||
ui->SessionStart();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
delete visManager;
|
||||
delete runManager;
|
||||
}
|
||||
|
Loading…
Reference in New Issue