@@ -104,6 +104,7 @@ int main(int argc_, char ** argv_)
104
104
datatools::logger::priority logging = datatools::logger::PRIO_FATAL;
105
105
bayeux::initialize (argc_, argv_, app_kernel_init_flags ());
106
106
try {
107
+ bool run = true ;
107
108
108
109
// Configuration parameters for the G4 manager:
109
110
mctools::g4::manager_parameters params;
@@ -173,7 +174,7 @@ int main(int argc_, char ** argv_)
173
174
// Collect all other options & args for the driver session:
174
175
std::vector<std::string> unrecognized_opts;
175
176
unrecognized_opts = po::collect_unrecognized(parsed.options,
176
- po::include_positional);
177
+ po::include_positional);
177
178
*/
178
179
179
180
// Parse specific options:
@@ -201,71 +202,73 @@ int main(int argc_, char ** argv_)
201
202
if (vm.count (" help" )) {
202
203
if (vm[" help" ].as <bool >()) {
203
204
ui::print_usage (optPublic, std::cout);
204
- return ( 0 ) ;
205
+ run = false ;
205
206
}
206
207
}
207
208
208
- // Fill the configuration data structure from program options:
209
- ui::process_opts (vm, optPublic, params);
210
-
211
- // DLL loading:
212
- datatools::library_loader dll_loader (params.dll_loader_config );
213
- if (params.g4_visu ) {
214
- std::string g4_vis_dll = " G4visXXX" ;
215
- if (std::find (params.dlls .begin (), params.dlls .end (), g4_vis_dll) == params.dlls .end ()) {
216
- DT_LOG_NOTICE (logging, " Force the loading of the DLL '" << g4_vis_dll << " ' DLL..." );
217
- params.dlls .push_back (g4_vis_dll);
209
+ if (run) {
210
+ // Fill the configuration data structure from program options:
211
+ ui::process_opts (vm, optPublic, params);
212
+
213
+ // DLL loading:
214
+ datatools::library_loader dll_loader (params.dll_loader_config );
215
+ if (params.g4_visu ) {
216
+ std::string g4_vis_dll = " G4visXXX" ;
217
+ if (std::find (params.dlls .begin (), params.dlls .end (), g4_vis_dll) == params.dlls .end ()) {
218
+ DT_LOG_NOTICE (logging, " Force the loading of the DLL '" << g4_vis_dll << " ' DLL..." );
219
+ params.dlls .push_back (g4_vis_dll);
220
+ }
221
+ std::string g4_opengl_dll = " G4OpenGL" ;
222
+ if (std::find (params.dlls .begin (), params.dlls .end (), g4_opengl_dll) == params.dlls .end ()) {
223
+ DT_LOG_NOTICE (logging, " Force the loading of the DLL '" << g4_opengl_dll << " ' DLL..." );
224
+ params.dlls .push_back (g4_opengl_dll);
225
+ }
218
226
}
219
- std::string g4_opengl_dll = " G4OpenGL" ;
220
- if (std::find (params.dlls .begin (), params.dlls .end (), g4_opengl_dll) == params.dlls .end ()) {
221
- DT_LOG_NOTICE (logging, " Force the loading of the DLL '" << g4_opengl_dll << " ' DLL..." );
222
- params.dlls .push_back (g4_opengl_dll);
227
+ for (const std::string & dll_name : params.dlls ) {
228
+ DT_LOG_NOTICE (logging, " Loading DLL '" << dll_name << " '..." );
229
+ DT_THROW_IF (dll_loader.load (dll_name) != EXIT_SUCCESS,
230
+ std::logic_error,
231
+ " Loading DLL '" << dll_name << " ' failed !" );
223
232
}
224
- }
225
- for (const std::string & dll_name : params.dlls ) {
226
- DT_LOG_NOTICE (logging, " Loading DLL '" << dll_name << " '..." );
227
- DT_THROW_IF (dll_loader.load (dll_name) != EXIT_SUCCESS,
228
- std::logic_error,
229
- " Loading DLL '" << dll_name << " ' failed !" );
230
- }
231
-
232
- // Variant service:
233
- std::unique_ptr<dtc::variant_service> vserv;
234
- if (variants_params.is_active ()) {
235
- // Create and start the variant service:
236
- vserv.reset (new dtc::variant_service);
237
- vserv->configure (variants_params);
238
- vserv->start ();
239
- // vserv->get_repository().tree_dump(std::cerr, "Repository:");
240
- }
241
233
242
- {
243
- // Declare the simulation manager:
244
- DT_LOG_NOTICE (logging, " Instantiate the simulation manager..." );
245
- mctools::g4::manager sim_manager;
246
-
247
- // Configure the simulation manager:
248
- DT_LOG_NOTICE (logging, " Setup the simulation manager..." );
249
- mctools::g4::manager_parameters::setup (params, sim_manager);
250
-
251
- // Run the simulation session :
252
- DT_LOG_NOTICE (logging, " Simulation session starts..." );
253
- sim_manager.run_simulation ();
254
- DT_LOG_NOTICE (logging, " Simulation session is stopped." );
255
-
256
- // Explicitely terminate the simulation manager:
257
- DT_LOG_NOTICE (logging, " Terminate the simulation manager..." );
258
- if (sim_manager.is_initialized ()) {
259
- sim_manager.reset ();
234
+ // Variant service:
235
+ std::unique_ptr<dtc::variant_service> vserv;
236
+ if (variants_params.is_active ()) {
237
+ // Create and start the variant service:
238
+ vserv.reset (new dtc::variant_service);
239
+ vserv->configure (variants_params);
240
+ vserv->start ();
241
+ // vserv->get_repository().tree_dump(std::cerr, "Repository:");
260
242
}
261
243
262
- DT_LOG_NOTICE (logging, " Simulation manager is terminated." );
263
- } // Destructor is invoked here.
264
-
265
- if (vserv) {
266
- // Stop the variant service:
267
- vserv->stop ();
268
- vserv.reset ();
244
+ {
245
+ // Declare the simulation manager:
246
+ DT_LOG_NOTICE (logging, " Instantiate the simulation manager..." );
247
+ mctools::g4::manager sim_manager;
248
+
249
+ // Configure the simulation manager:
250
+ DT_LOG_NOTICE (logging, " Setup the simulation manager..." );
251
+ mctools::g4::manager_parameters::setup (params, sim_manager);
252
+
253
+ // Run the simulation session :
254
+ DT_LOG_NOTICE (logging, " Simulation session starts..." );
255
+ sim_manager.run_simulation ();
256
+ DT_LOG_NOTICE (logging, " Simulation session is stopped." );
257
+
258
+ // Explicitely terminate the simulation manager:
259
+ DT_LOG_NOTICE (logging, " Terminate the simulation manager..." );
260
+ if (sim_manager.is_initialized ()) {
261
+ sim_manager.reset ();
262
+ }
263
+
264
+ DT_LOG_NOTICE (logging, " Simulation manager is terminated." );
265
+ } // Destructor is invoked here.
266
+
267
+ if (vserv) {
268
+ // Stop the variant service:
269
+ vserv->stop ();
270
+ vserv.reset ();
271
+ }
269
272
}
270
273
271
274
DT_LOG_TRACE (logging, " The end." );
0 commit comments