112 lines
2.9 KiB
C++
112 lines
2.9 KiB
C++
//
|
|
// 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_BIC.hh"
|
|
#include "MedtechDetectorConstruction.hh"
|
|
#include "MedtechActionInitialization.hh"
|
|
#include "Parameters.hh"
|
|
#include "G4SteppingManager.hh"
|
|
|
|
int main(int argc,char** argv)
|
|
{
|
|
Parameters *param = Parameters::getInstance();
|
|
bool visualization = false;
|
|
int NoE=1;
|
|
|
|
for(int i=1; i < argc-1; i++)
|
|
{
|
|
if(!strcmp("-n", argv[i])) //number of events
|
|
{
|
|
NoE = atoi(argv[i+1]);
|
|
}
|
|
|
|
else if(!strcmp("-p", argv[i])) //particle energy
|
|
{
|
|
param -> SetParticleEnergy(atoi(argv[i+1]));
|
|
}
|
|
|
|
else if(!strcmp("-h", argv[i])) //H degree
|
|
{
|
|
param -> SetHDegree(atoi(argv[i+1]));
|
|
}
|
|
|
|
else if(!strcmp("-v", argv[i])) //V degree
|
|
{
|
|
param -> SetVDegree(atoi(argv[i+1]));
|
|
}
|
|
|
|
else if(!strcmp("-s", argv[i])) //windows size
|
|
{
|
|
param -> SetBoxSize(atof(argv[i+1]));
|
|
}
|
|
|
|
else if(!strcmp("-x", argv[i])) //visualization
|
|
{
|
|
visualization = false;
|
|
}
|
|
|
|
else if(!strcmp("-t", argv[i])) //tube size
|
|
{
|
|
param -> SetTubeSize(atof(argv[i+1]));
|
|
}
|
|
|
|
else if(!strcmp("-c", argv[i])) //Cone size
|
|
{
|
|
param -> SetConeSize(atof(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_BIC);
|
|
runManager -> SetUserInitialization(new MedtechDetectorConstruction);
|
|
runManager -> SetUserInitialization(new MedtechActionInitialization);
|
|
|
|
G4VisManager* visManager = new G4VisExecutive;
|
|
visManager->Initialize();
|
|
G4UImanager* UImanager = G4UImanager::GetUIpointer();
|
|
|
|
|
|
if (visualization)
|
|
{
|
|
//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;
|
|
}
|
|
|