58 bool validateGeometry=
true;
60 std::map<std::string, EDepSim::LogManager::ErrorPriority> namedDebugLevel;
63 std::map<std::string, EDepSim::LogManager::LogPriority> namedLogLevel;
73 while (!errflg && ((c=getopt(argc,
argv,
"CdD:e:g:o:p:qsuUvV:h")) != -1)) {
78 validateGeometry = !validateGeometry;
91 std::size_t sep = arg.find(
"=");
92 if (sep != std::string::npos) {
95 switch (levelName[0]) {
97 namedDebugLevel[name.c_str()]
101 namedDebugLevel[name.c_str()]
105 namedDebugLevel[name.c_str()]
109 namedDebugLevel[name.c_str()]
113 namedDebugLevel[name.c_str()]
125 beamOnCount = optarg;
129 gdmlFilename = optarg;
133 outputFilename = optarg;
137 physicsList = optarg;
158 if (logLevel>0) --logLevel;
165 if (logLevel>0) ++logLevel;
173 std::size_t sep = arg.find(
"=");
174 if (sep != std::string::npos) {
177 switch (levelName[0]) {
179 namedLogLevel[name.c_str()]
183 namedLogLevel[name.c_str()]
187 namedLogLevel[name.c_str()]
191 namedLogLevel[name.c_str()]
209 else if (logLevel == 1) {
213 else if (logLevel == 2) {
217 else if (logLevel >= 3) {
223 = namedLogLevel.begin();
224 i != namedLogLevel.end();
229 if (debugLevel == 1) {
233 else if (debugLevel == 2) {
237 else if (debugLevel >= 2) {
243 = namedDebugLevel.begin();
244 i != namedDebugLevel.end();
268 if (!persistencyManager) {
275 G4UImanager* UI = G4UImanager::GetUIpointer();
278 if (gdmlFilename !=
"") {
279 UI->ApplyCommand(
"/edep/gdml/read "+gdmlFilename);
283 UI->ApplyCommand(
"/edep/control edepsim-defaults 1.0");
286 if (persistencyManager && ! outputFilename.empty()) {
287 UI->ApplyCommand(
"/edep/db/open "+outputFilename);
290 std::signal(SIGILL, SIG_DFL);
291 std::signal(SIGBUS, SIG_DFL);
292 std::signal(SIGSEGV, SIG_DFL);
297 if (validateGeometry) UI->ApplyCommand(
"/edep/validateGeometry");
300 if (setSeed) UI->ApplyCommand(
"/edep/random/timeRandomSeed");
306 if (doUpdate) UI->ApplyCommand(
"/edep/update");
310 G4UIExecutive* ui =
new G4UIExecutive(argc,
argv);
311 for (
int i=optind; i<argc; ++i) {
313 std::cout <<
"## Run macro: " << macroFilename <<
std::endl;
314 UI->ApplyCommand(
"/control/execute "+macroFilename);
319 else if (optind < argc) {
321 for (
int i=optind; i<argc; ++i) {
323 UI->ApplyCommand(
"/control/execute " +macroFilename);
330 if (!beamOnCount.empty()) {
331 UI->ApplyCommand(
"/run/beamOn " + beamOnCount);
336 if (persistencyManager) {
337 persistencyManager->
Close();
338 delete persistencyManager;
#define EDepSimLog(outStream)
static void SetLogLevel(LogPriority level)
Set the default logging level.
#define EDepSimInfo(outStream)
#define EDepSimTrace(outStream)
#define EDepSimDebug(outStream)
#define EDepSimVerbose(outStream)
static void SetDebugLevel(ErrorPriority level)
#define EDepSimWarn(outStream)
G4RunManager * CreateRunManager(G4String physicsList)
static void Configure(const char *conf=NULL)
virtual G4bool Close(void)
Make sure the output file is closed.
QTextStream & endl(QTextStream &s)