SLIC
6.1.1
Simulation for the Linear Collider (SLIC) - Geant4 simulation application
src
SlicMain.cc
Go to the documentation of this file.
1
#include "
SlicMain.hh
"
2
3
// slic
4
#include "
SlicApplication.hh
"
5
6
// geant4
7
#include "G4RunManager.hh"
8
9
namespace
slic
{
10
11
SlicMain::SlicMain
() :
12
Module
(
"SlicMain"
) {
13
;
14
}
15
16
SlicMain::~SlicMain
() {
17
;
18
}
19
20
int
SlicMain::main
(
int
argc,
char
** argv) {
21
// Default return code.
22
int
returnCode = 0;
23
24
// Application instance.
25
SlicApplication
* slicApp = 0;
26
27
// Top-level try block.
28
#ifdef SLIC_CATCH_STD_EXCEPTIONS
29
try
{
30
std::cout <<
"SLIC is enabled to catch std exceptions."
<<
std::endl
;
31
#endif
32
// Create the SLIC application using the singleton function.
33
slicApp =
SlicApplication::instance
();
34
35
// Setup the command line arguments.
36
slicApp->
initialize
(argc, argv);
37
38
// Run the app.
39
slicApp->
run
();
40
41
// Get the application return code.
42
returnCode = slicApp->
getReturnCode
();
43
44
// Delete the application.
45
if
(slicApp) {
46
delete
slicApp;
47
}
48
49
#ifdef SLIC_CATCH_STD_EXCEPTIONS
50
// Catch a generic std::exception.
51
}
catch
(std::exception& stde) {
52
log
() <<
LOG::error
<<
LOG::head
<< stde.what() <<
LOG::done
;
53
returnCode =
SlicApplication::STD_EXCEPTION
;
54
}
55
// Catch an unknown exception.
56
catch
(...) {
57
log
() <<
LOG::error
<<
LOG::head
<<
"Top-level catch block caught an unknown exception!"
<<
LOG::done
;
58
returnCode =
SlicApplication::UNKNOWN_EXCEPTION
;
59
}
60
#endif
61
62
return
returnCode;
63
}
64
}
// namespace slic
SlicApplication.hh
SlicMain.hh
Singleton< SlicApplication >::instance
static SlicApplication * instance()
slic::Module
Base class for slic code modules that provides common functionality, such as logging to an output str...
Definition:
Module.hh:25
slic::Module::log
LogStream & log()
Definition:
Module.hh:99
slic::SlicApplication
Singleton class for a Geant4 application.
Definition:
SlicApplication.hh:40
slic::SlicApplication::getReturnCode
int getReturnCode() const
Definition:
SlicApplication.cc:145
slic::SlicApplication::run
void run()
Definition:
SlicApplication.cc:174
slic::SlicApplication::initialize
void initialize()
Definition:
SlicApplication.cc:81
slic::SlicApplication::UNKNOWN_EXCEPTION
@ UNKNOWN_EXCEPTION
Definition:
SlicApplication.hh:56
slic::SlicApplication::STD_EXCEPTION
@ STD_EXCEPTION
Definition:
SlicApplication.hh:57
slic::SlicMain::~SlicMain
virtual ~SlicMain()
Definition:
SlicMain.cc:16
slic::SlicMain::main
int main(int argc, char **argv)
Definition:
SlicMain.cc:20
slic::SlicMain::SlicMain
SlicMain()
Definition:
SlicMain.cc:11
LOG::error
@ error
Definition:
LogStream.hh:33
LOG::head
@ head
Definition:
LogStream.hh:26
LOG::endl
@ endl
Definition:
LogStream.hh:26
LOG::done
@ done
Definition:
LogStream.hh:26
slic
Definition:
CommandLineOption.hh:9
Generated by
1.9.1