51 std::transform(ext.begin(), ext.end(), ext.begin(),
58int main(
int argc,
char** argv) {
64 std::vector<std::string> stepFiles;
65 std::vector<std::string> materialFiles;
68 for (G4int i = 1; i < argc; ++i) {
69 const std::string arg(argv[i]);
77 }
else if (arg ==
"-u") {
83 }
else if (arg ==
"-t") {
90 const std::string nextArg(argv[i + 1]);
91 if (nextArg[0] ==
'-') {
97 nThreads = G4UIcommand::ConvertToInt(argv[i]);
99 G4cerr <<
"Warning: -t option (" << argv[i]
100 <<
") ignored (Geant4 built without multi-threading)." << G4endl;
102 }
else if (arg[0] ==
'-') {
103 G4cerr <<
"Unknown option: " << arg << G4endl;
108 const auto ext = FileExtension(arg);
109 if (ext ==
".step" || ext ==
".stp") {
110 stepFiles.push_back(arg);
111 }
else if (ext ==
".xml") {
112 materialFiles.push_back(arg);
114 G4cerr <<
"Unrecognised file type (expected .step, .stp, or .xml): " << arg << G4endl;
122 G4UIExecutive* ui =
nullptr;
124 ui =
new G4UIExecutive(argc, argv, session);
128 auto* runManager = G4RunManagerFactory::CreateRunManager(G4RunManagerType::Default);
129#ifdef G4MULTITHREADED
131 runManager->SetNumberOfThreads(nThreads);
139 for (
const auto& f : materialFiles) {
143 for (
const auto& f : stepFiles) {
144 detConstruction->AddSTEP(f);
147 runManager->SetUserInitialization(detConstruction);
148 runManager->SetUserInitialization(
new FTFP_BERT(0));
154 G4VisExecutive* visManager =
nullptr;
156 visManager =
new G4VisExecutive(
"Quiet");
157 visManager->Initialize();
163 auto* UImanager = G4UImanager::GetUIpointer();
164 UImanager->SetMacroSearchPath(G4String(G4OCCT_MACRO_DIR_INSTALL) +
":" + G4OCCT_MACRO_DIR_BUILD);
169 if (!macro.empty()) {
170 exitCode = UImanager->ApplyCommand(
"/control/execute " + macro);
172 UImanager->ApplyCommand(
"/control/execute init_vis.mac");
174 UImanager->ApplyCommand(
"/control/execute gui.mac");
182 return exitCode != 0 ? 1 : 0;
int main(int argc, char **argv)