Main manager class for the remage simulation. More...
#include <RMGManager.hh>
Public Member Functions | |
| RMGManager (std::string app_name, int argc, char **argv) | |
| Constructs a new RMGManager object. | |
| ~RMGManager ()=default | |
| Default destructor. | |
| RMGManager (RMGManager const &)=delete | |
| RMGManager & | operator= (RMGManager const &)=delete |
| RMGManager (RMGManager &&)=delete | |
| RMGManager & | operator= (RMGManager &&)=delete |
| G4RunManager * | GetG4RunManager () |
| Retrieves the Geant4 run manager. | |
| G4VisManager * | GetG4VisManager () |
| Retrieves the Geant4 visualization manager. | |
| RMGHardware * | GetDetectorConstruction () |
| Retrieves the detector construction. | |
| G4VUserPhysicsList * | GetProcessesList () |
| Retrieves the physics list. | |
| auto | GetUserInit () const |
| Retrieves the user initialization object. | |
| auto | GetOutputManager () const |
| Retrieves the output manager. | |
| int | GetPrintModulo () const |
| Returns the print modulo value. | |
| bool | IsExecSequential () const |
| Checks if the execution is sequential (single-threaded). | |
| int | GetProcessNumberOffset () const |
| Gets the process number offset. | |
| bool | IsMultiProcessing () const |
| Checks if the execution is part of a process-parallelized run. | |
| void | SetUserInit (G4RunManager *g4_manager) |
| Sets the Geant4 run manager. | |
| void | SetUserInit (G4VisManager *vis) |
| Sets the Geant4 visualization manager. | |
| void | SetUserInit (RMGHardware *det) |
| Sets the detector construction. | |
| void | SetUserInit (G4VUserPhysicsList *proc) |
| Sets the physics list. | |
| void | SetInteractive (bool flag=true) |
| Enables or disables interactive mode. | |
| void | SetNumberOfThreads (int nthreads) |
| Sets the number of threads. | |
| void | SetPrintModulo (int n_ev) |
| Sets the print modulo value. | |
| void | IncludeMacroFile (std::string filename) |
| Includes a macro or single macro command file for execution. | |
| void | RegisterG4Alias (std::string alias, std::string value) |
| Registers a Geant4 alias for use in macro commands. | |
| void | Initialize () |
| Initialize the simulation components (run manager, visualization, random engine, detector construction, physics list, ...). | |
| void | Run () |
| Executes the supplied macro files and commands and switch to interactive session if requested. | |
| void | SetRandEngine (std::string name) |
| Sets the random engine by name. | |
| void | SetRandEngineSeed (int seed) |
| Sets the seed for the random engine. | |
| void | SetRandEngineInternalSeed (int index) |
| Sets the internal seed index for the random engine. | |
| void | SetRandSystemEntropySeed () |
| Sets the random engine seed using system entropy. | |
| bool | ApplyRandEngineForCurrentThread () |
| Applies the random engine settings for the current thread. | |
| bool | GetRandIsControlled () const |
| Checks if the random engine is under user controlled seeding. | |
| bool | GetRandEngineSelected () const |
| Checks if a random engine has been selected by the user. | |
| void | SetLogLevel (std::string level) |
| Sets the logging level. | |
| void | EnableMultiProcessing (int proc_num) |
| Sets the process number for offset calculations in process-parallelized mode. | |
| bool | HadWarning () const |
| Checks if any warnings have been recorded. | |
| bool | HadError () const |
| Checks if any errors have been recorded. | |
| void | ActivateOptionalOutputScheme (std::string name) |
| Activates an optional output scheme. | |
Static Public Member Functions | |
| static RMGManager * | Instance () |
| Retrieves the singleton instance of RMGManager. | |
| static void | AbortRunGracefully () |
| Set a flag to gracefully aborts the simulation run at the next possible time. | |
| static bool | ShouldAbortRun () |
| Checks whether an abort signal has been triggered. | |
Main manager class for the remage simulation.
This singleton class initializes and manages the Geant4 run manager, visualization, detector construction, physics list, and user actions. It also handles global configurations such as random engine settings and logging.
| RMGManager::RMGManager | ( | std::string | app_name, |
| int | argc, | ||
| char ** | argv ) |
Constructs a new RMGManager object.
This constructor has to be called by the user, but can only be called once.
| app_name | The application name. |
| argc | Argument count. |
| argv | Argument vector. |
|
inline |
Activates an optional output scheme.
| name | The name of the optional output scheme to activate. |
| bool RMGManager::ApplyRandEngineForCurrentThread | ( | ) |
Applies the random engine settings for the current thread.
|
inline |
Sets the process number for offset calculations in process-parallelized mode.
| proc_num | process number of this instance (note: this is not the total number of processes!) |
| RMGHardware * RMGManager::GetDetectorConstruction | ( | ) |
Retrieves the detector construction.
| G4RunManager * RMGManager::GetG4RunManager | ( | ) |
Retrieves the Geant4 run manager.
| G4VisManager * RMGManager::GetG4VisManager | ( | ) |
Retrieves the Geant4 visualization manager.
|
inlinenodiscard |
Retrieves the output manager.
|
inlinenodiscard |
Returns the print modulo value.
| G4VUserPhysicsList * RMGManager::GetProcessesList | ( | ) |
Retrieves the physics list.
|
inlinenodiscard |
Gets the process number offset.
In a process-parallelized run this might be larger than zero and is used, e.g., for determining an event id offset. For regular (single- or multi-threaded runs) it is always zero.
|
inlinenodiscard |
Checks if a random engine has been selected by the user.
|
inlinenodiscard |
Checks if the random engine is under user controlled seeding.
|
inlinenodiscard |
Retrieves the user initialization object.
|
inlinenodiscard |
Checks if any errors have been recorded.
|
inlinenodiscard |
Checks if any warnings have been recorded.
|
inline |
Includes a macro or single macro command file for execution.
| filename | The name of the macro file. |
| void RMGManager::Initialize | ( | ) |
Initialize the simulation components (run manager, visualization, random engine, detector construction, physics list, ...).
This does not call Initialize() of G4RunManager which remains the user's responsibility (i.e., by using the macro command /run/initialize)
|
inlinestatic |
Retrieves the singleton instance of RMGManager.
|
inlinenodiscard |
Checks if the execution is sequential (single-threaded).
|
inlinenodiscard |
Checks if the execution is part of a process-parallelized run.
In a process-parallelized run, this instance of remage is running single-threaded. Multiple instances are orchestrated by the python wrapper.
|
inline |
Registers a Geant4 alias for use in macro commands.
| alias | The alias name. |
| value | The corresponding value. |
| void RMGManager::Run | ( | ) |
Executes the supplied macro files and commands and switch to interactive session if requested.
This does not actually start the simulation runs; that has to be done with macro commands or by calling int G4RunManager.
|
inline |
Enables or disables interactive mode.
| flag | True to enable interactive mode. |
| void RMGManager::SetLogLevel | ( | std::string | level | ) |
Sets the logging level.
| level | Logging level as a string. |
|
inline |
Sets the number of threads.
| nthreads | Number of threads. |
|
inline |
Sets the print modulo value.
| n_ev | Number of events for modulo printing. |
| void RMGManager::SetRandEngine | ( | std::string | name | ) |
Sets the random engine by name.
| name | Name of the random engine. |
| void RMGManager::SetRandEngineInternalSeed | ( | int | index | ) |
Sets the internal seed index for the random engine.
| index | The seed index. |
| void RMGManager::SetRandEngineSeed | ( | int | seed | ) |
Sets the seed for the random engine.
| seed | The seed value. |
|
inline |
Sets the Geant4 run manager.
| g4_manager | Pointer to the G4RunManager. |
|
inline |
Sets the Geant4 visualization manager.
| vis | Pointer to the G4VisManager. |
|
inline |
Sets the physics list.
| proc | Pointer to G4VUserPhysicsList. |
|
inline |
Sets the detector construction.
| det | Pointer to RMGHardware. |
|
inlinestatic |
Checks whether an abort signal has been triggered.