utilities
Loading...
Searching...
No Matches
gemcUtilities.h
Go to the documentation of this file.
1#pragma once
2
3// qt
4#include <QCoreApplication>
5
6// geant4
7#include "G4MTRunManager.hh"
8#include "G4UImanager.hh"
9
10// cpp
11#include <memory>
12
13// gemc
14#include "glogger.h"
15#include "gsplash.h"
16#include "gbatch_session.h"
17
18namespace gemc {
19
71inline std::unique_ptr<QCoreApplication>
72makeQtApplication(int& argc, char* argv[], bool gui) {
73
74 if (!gui) {
75 auto gbatch = std::make_unique<GBatch_Session>();
76 G4UImanager::GetUIpointer()->SetCoutDestination(gbatch.release()); // release ownership to Geant4
77
78 return std::make_unique<QCoreApplication>(argc, argv);
79 }
80 return std::make_unique<QApplication>(argc, argv);
81}
82
101int get_nthreads(const std::shared_ptr<GOptions>& gopts, const std::shared_ptr<GLogger>& log);
102
116std::vector<std::string> verbosity_commands(const std::shared_ptr<GOptions>& gopts,
117 const std::shared_ptr<GLogger>& log);
118
140std::vector<std::string> initial_commands(const std::shared_ptr<GOptions>& gopts,
141 const std::shared_ptr<GLogger>& log);
142
154void run_manager_commands(const std::shared_ptr<GOptions>& gopts,
155 const std::shared_ptr<GLogger>& log,
156 const std::vector<std::string>& commands);
157
180void start_random_engine(const std::shared_ptr<GOptions>& gopts, const std::shared_ptr<GLogger>& log);
181
182 // end of group gemc_utilities_module
183
184} // namespace gemc
void start_random_engine(const std::shared_ptr< GOptions > &gopts, const std::shared_ptr< GLogger > &log)
Select and start the random engine, then seed it.
std::unique_ptr< QCoreApplication > makeQtApplication(int &argc, char *argv[], bool gui)
Create a Qt application instance suitable for GUI or batch execution.
std::vector< std::string > verbosity_commands(const std::shared_ptr< GOptions > &gopts, const std::shared_ptr< GLogger > &log)
Build a list of Geant4 UI commands that reduce verbosity across subsystems.
std::vector< std::string > initial_commands(const std::shared_ptr< GOptions > &gopts, const std::shared_ptr< GLogger > &log)
Build a list of Geant4 UI commands needed at startup.
void run_manager_commands(const std::shared_ptr< GOptions > &gopts, const std::shared_ptr< GLogger > &log, const std::vector< std::string > &commands)
Execute a sequence of Geant4 UI commands through the UI manager.
int get_nthreads(const std::shared_ptr< GOptions > &gopts, const std::shared_ptr< GLogger > &log)
Determine the number of worker threads to use for the run.