SLIC  6.1.1
Simulation for the Linear Collider (SLIC) - Geant4 simulation application
Public Types | Public Member Functions | Protected Attributes | Private Member Functions | List of all members
SlicApplication Class Reference

Singleton class for a Geant4 application. More...

#include <SlicApplication.hh>

Inheritance diagram for SlicApplication:
Singleton< SlicApplication > Module

Public Types

enum  ErrorCode {
  OKAY = 0 , UNKNOWN_ERROR , UNKNOWN_EXCEPTION , STD_EXCEPTION ,
  OUTPUT_FILE_EXISTS , FAILED_DELETE_LCIO_FILE , EVENT_UNDERFLOW , INVALID_GEOMETRY_SETUP ,
  GENERATOR_NOT_SETUP , ERROR_CODE_SIZE
}
 
enum  ERunMode { eBatch = 1 , eInteractive = 2 }
 
- Public Types inherited from Module
enum  ModuleStatus { eOkay = 0 , eNotInitialized = 1 , eBadState = 2 , eFatalError = 3 }
 

Public Member Functions

 SlicApplication ()
 
virtual ~SlicApplication ()
 
const std::string & getBinaryBasename () const
 
const std::string & getBinaryName () const
 
const char * getErrorCodeString (unsigned int errorCode)
 
ERunMode getMode () const
 
int getReturnCode () const
 
RunManager * getRunManager ()
 
void initialize ()
 
void initialize (int argc, char **argv)
 
bool isAborting () const
 
void printEndTime ()
 
void printSplashScreen ()
 
void printStartTime ()
 
void printUsage ()
 
void printVersion ()
 
void run ()
 
void setAborting (bool a=true)
 
void setMode (ERunMode rmode)
 
void setReturnCode (int rc)
 
- Public Member Functions inherited from Singleton< SlicApplication >
 Singleton ()
 
 ~Singleton ()
 
void release ()
 
- Public Member Functions inherited from Module
virtual ~Module ()
 
virtual void beginEvent (const G4Event *)
 
virtual void beginRun (const G4Run *)
 
virtual void cleanup ()
 
bool deleteOnExit ()
 
virtual void endEvent (const G4Event *)
 
virtual void endRun (const G4Run *)
 
const std::string & getName () const
 
ModuleStatus getStatus () const
 
LogStream & log ()
 
virtual void postTracking (const G4Track *)
 
virtual void preTracking (const G4Track *)
 
virtual void reset ()
 
virtual void stepping (const G4Step *)
 

Protected Attributes

SlicApplicationMessenger * m_appMessenger
 
std::string m_binarybasename
 
std::string m_binaryname
 
FieldMessenger * m_fieldMessenger
 
std::string * m_geant4VersionString
 
bool m_isInitialized
 
ERunMode m_mode
 
int m_returnCode
 
RunManager * m_runManager
 
G4UIExecutive * m_ui
 

Private Member Functions

void initializeLCDD ()
 
void initializeUserActions ()
 
void initializeVis ()
 
void setBinaryBasename ()
 

Additional Inherited Members

- Static Public Member Functions inherited from Singleton< SlicApplication >
static SlicApplication * instance ()
 
- Public Attributes inherited from Module
bool m_deleteOnExit
 
LogStream * m_log
 
std::string m_name
 
ModuleStatus m_status
 
- Protected Member Functions inherited from Module
 Module (const std::string &name, bool deleteOnExit=true, bool autoRegister=true)
 

Detailed Description

Singleton class for a Geant4 application.

Note
Instantiates manager and messenger classes, including user actions, G4RunManager, GeneratorManager, and PhysicsListManager.

Definition at line 40 of file SlicApplication.hh.

Member Enumeration Documentation

◆ ErrorCode

enum ErrorCode

Error codes.

Enumerator
OKAY 
UNKNOWN_ERROR 
UNKNOWN_EXCEPTION 
STD_EXCEPTION 
OUTPUT_FILE_EXISTS 
FAILED_DELETE_LCIO_FILE 
EVENT_UNDERFLOW 
INVALID_GEOMETRY_SETUP 
GENERATOR_NOT_SETUP 
ERROR_CODE_SIZE 

Definition at line 54 of file SlicApplication.hh.

◆ ERunMode

enum ERunMode

Indicates the run mode: batch or interactive.

Enumerator
eBatch 
eInteractive 

Definition at line 47 of file SlicApplication.hh.

Constructor & Destructor Documentation

◆ SlicApplication()

The constructor.

Definition at line 30 of file SlicApplication.cc.

References LOG::done, LOG::head, Module::log(), and LOG::okay.

◆ ~SlicApplication()

~SlicApplication ( )
virtual

Member Function Documentation

◆ getBinaryBasename()

const std::string & getBinaryBasename ( ) const

Get the base name of the binary (file name only).

Returns
The base name of the binary.

Definition at line 141 of file SlicApplication.cc.

References SlicApplication::m_binarybasename.

◆ getBinaryName()

const std::string & getBinaryName ( ) const

Get the name of the binary, as it was invoked from the command line.

Returns
The name of the binary.

Definition at line 137 of file SlicApplication.cc.

References SlicApplication::m_binaryname.

◆ getErrorCodeString()

const char* getErrorCodeString ( unsigned int  errorCode)
inline

Get a string representation of an error code.

Parameters
[in]errorCodeThe errorCode.
Returns
The string representation of the error code.

Definition at line 182 of file SlicApplication.hh.

References LOG::done, LOG::error, SlicApplication::ERROR_CODE_SIZE, slic::ErrorCodeStrings, and Module::log().

Referenced by SlicApplication::~SlicApplication().

◆ getMode()

SlicApplication::ERunMode getMode ( ) const

Get the run mode, interactive or batch.

Returns
The run mode.

Definition at line 160 of file SlicApplication.cc.

References SlicApplication::m_mode.

Referenced by SlicApplication::run().

◆ getReturnCode()

int getReturnCode ( ) const

Get the return code.

Returns
The return code.

Definition at line 145 of file SlicApplication.cc.

References SlicApplication::m_returnCode.

Referenced by SlicApplication::~SlicApplication(), and SlicMain::main().

◆ getRunManager()

RunManager * getRunManager ( )

Return SLIC's RunManager instance.

Returns
The RunManager instance.

Definition at line 170 of file SlicApplication.cc.

References SlicApplication::m_runManager.

◆ initialize() [1/2]

void initialize ( )
virtual

◆ initialize() [2/2]

void initialize ( int  argc,
char **  argv 
)

Setup SLIC from command line arguments using the CommandLineProcessor.

Parameters
[in]argcThe argument count.
[in]argvThe argument values.

Definition at line 69 of file SlicApplication.cc.

References Singleton< CommandLineProcessor >::instance(), SlicApplication::m_binaryname, SlicApplication::m_ui, CommandLineProcessor::process(), and SlicApplication::setBinaryBasename().

◆ initializeLCDD()

void initializeLCDD ( )
private

Register the LCDDDetectorConstruction.

Definition at line 128 of file SlicApplication.cc.

References SlicApplication::m_runManager.

Referenced by SlicApplication::initialize().

◆ initializeUserActions()

void initializeUserActions ( )
private

Register the Geant4 user action classes with the G4RunManager.

◆ initializeVis()

void initializeVis ( )
private

Initialize the Geant4 visualization subsystem.

Definition at line 119 of file SlicApplication.cc.

Referenced by SlicApplication::initialize().

◆ isAborting()

bool isAborting ( ) const

Get the abort state.

◆ printEndTime()

void printEndTime ( )

Print the end time.

◆ printSplashScreen()

void printSplashScreen ( )

Print SLIC's splash screen.

Definition at line 203 of file SlicApplication.cc.

References LOG::always, LOG::done, and Module::log().

Referenced by SlicApplication::initialize().

◆ printStartTime()

void printStartTime ( )

Print the start time.

◆ printUsage()

void printUsage ( )

Print the usage by calling the CommandLineProcessor.

Definition at line 211 of file SlicApplication.cc.

References Singleton< CommandLineProcessor >::instance().

Referenced by SlicApplicationMessenger::SetNewValue().

◆ printVersion()

void printVersion ( )

Print the version string.

Definition at line 199 of file SlicApplication.cc.

References Singleton< CommandLineProcessor >::instance().

Referenced by SlicApplicationMessenger::SetNewValue().

◆ run()

void run ( )

◆ setAborting()

void setAborting ( bool  a = true)

Set abort state.

Parameters
[in]aThe application abort state.

Definition at line 164 of file SlicApplication.cc.

◆ setBinaryBasename()

void setBinaryBasename ( )
private

Set the binary base name from the full name.

Definition at line 153 of file SlicApplication.cc.

References SlicApplication::m_binarybasename, and SlicApplication::m_binaryname.

Referenced by SlicApplication::initialize().

◆ setMode()

void setMode ( SlicApplication::ERunMode  rmode)

Set the run mode.

Parameters
[in]rmodeThe run mode, either batch or interactive.

Definition at line 133 of file SlicApplication.cc.

References SlicApplication::m_mode.

Referenced by SlicApplicationMessenger::SetNewValue().

◆ setReturnCode()

void setReturnCode ( int  rc)

Set the return code.

Parameters
[in]rcThe return code.

Definition at line 149 of file SlicApplication.cc.

References SlicApplication::m_returnCode.

Member Data Documentation

◆ m_appMessenger

SlicApplicationMessenger* m_appMessenger
protected

app messenger

Definition at line 218 of file SlicApplication.hh.

Referenced by SlicApplication::~SlicApplication(), and SlicApplication::initialize().

◆ m_binarybasename

std::string m_binarybasename
protected

◆ m_binaryname

std::string m_binaryname
protected

What was the name of the SLIC binary from CL? (used by LcioFileNamer)

Definition at line 235 of file SlicApplication.hh.

Referenced by SlicApplication::getBinaryName(), SlicApplication::initialize(), and SlicApplication::setBinaryBasename().

◆ m_fieldMessenger

FieldMessenger* m_fieldMessenger
protected

field messenger

Definition at line 221 of file SlicApplication.hh.

◆ m_geant4VersionString

std::string* m_geant4VersionString
protected

Version string of Geant4.

Definition at line 239 of file SlicApplication.hh.

◆ m_isInitialized

bool m_isInitialized
protected

Has the initialize() function been called?

Definition at line 232 of file SlicApplication.hh.

Referenced by SlicApplication::initialize(), and SlicApplication::run().

◆ m_mode

ERunMode m_mode
protected

application run mode: batch or interactive

Definition at line 226 of file SlicApplication.hh.

Referenced by SlicApplication::getMode(), and SlicApplication::setMode().

◆ m_returnCode

int m_returnCode
protected

return code

Definition at line 229 of file SlicApplication.hh.

Referenced by SlicApplication::getReturnCode(), and SlicApplication::setReturnCode().

◆ m_runManager

RunManager* m_runManager
protected

◆ m_ui

G4UIExecutive* m_ui
protected

G4 UI manager.

Definition at line 215 of file SlicApplication.hh.

Referenced by SlicApplication::initialize(), and SlicApplication::run().


The documentation for this class was generated from the following files: