Class RMGManager¶
Defined in File RMGManager.hh
Class Documentation¶
-
class RMGManager¶
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.
Public Functions
-
RMGManager() = delete¶
-
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.
- Parameters:
app_name – The application name.
argc – Argument count.
argv – Argument vector.
-
~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.
- Returns:
Pointer to the G4RunManager instance.
-
G4VisManager *GetG4VisManager()¶
Retrieves the Geant4 visualization manager.
- Returns:
Pointer to the G4VisManager instance.
-
RMGHardware *GetDetectorConstruction()¶
Retrieves the detector construction.
- Returns:
Pointer to the RMGHardware instance.
-
G4VUserPhysicsList *GetProcessesList()¶
Retrieves the physics list.
- Returns:
Pointer to the G4VUserPhysicsList instance.
-
inline auto GetUserInit() const¶
Retrieves the user initialization object.
- Returns:
Shared pointer to RMGUserInit.
-
inline auto GetOutputManager() const¶
Retrieves the output manager.
- Returns:
Pointer to the RMGOutputManager instance.
-
inline int GetPrintModulo() const¶
Returns the print modulo value.
- Returns:
Print modulo integer.
-
inline bool IsExecSequential()¶
Checks if the execution is sequential (single-threaded).
- Returns:
True if the run manager is sequential.
-
inline void SetUserInit(G4RunManager *g4_manager)¶
Sets the Geant4 run manager.
- Parameters:
g4_manager – Pointer to the G4RunManager.
-
inline void SetUserInit(G4VisManager *vis)¶
Sets the Geant4 visualization manager.
- Parameters:
vis – Pointer to the G4VisManager.
-
inline void SetUserInit(RMGHardware *det)¶
Sets the detector construction.
- Parameters:
det – Pointer to RMGHardware.
-
inline void SetUserInit(G4VUserPhysicsList *proc)¶
Sets the physics list.
- Parameters:
proc – Pointer to G4VUserPhysicsList.
-
inline void SetInteractive(bool flag = true)¶
Enables or disables interactive mode.
- Parameters:
flag – True to enable interactive mode.
-
inline void SetNumberOfThreads(int nthreads)¶
Sets the number of threads.
- Parameters:
nthreads – Number of threads.
-
inline void SetPrintModulo(int n_ev)¶
Sets the print modulo value.
- Parameters:
n_ev – Number of events for modulo printing.
-
inline void IncludeMacroFile(std::string filename)¶
Includes a macro or single macro command file for execution.
- Parameters:
filename – The name of the macro file.
-
inline void RegisterG4Alias(std::string alias, std::string value)¶
Registers a Geant4 alias for use in macro commands.
- Parameters:
alias – The alias name.
value – The corresponding value.
-
void 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)
-
void 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.
-
void SetRandEngine(std::string name)¶
Sets the random engine by name.
- Parameters:
name – Name of the random engine.
-
void SetRandEngineSeed(int seed)¶
Sets the seed for the random engine.
- Parameters:
seed – The seed value.
-
void SetRandEngineInternalSeed(int index)¶
Sets the internal seed index for the random engine.
- Parameters:
index – The seed index.
-
void SetRandSystemEntropySeed()¶
Sets the random engine seed using system entropy.
-
bool ApplyRandEngineForCurrentThread()¶
Applies the random engine settings for the current thread.
- Returns:
True if applied successfully.
-
inline bool GetRandIsControlled() const¶
Checks if the random engine is under user controlled seeding.
- Returns:
True if controlled.
-
inline bool GetRandEngineSelected() const¶
Checks if a random engine has been selected by the user.
- Returns:
True if a random engine is selected.
-
void SetLogLevel(std::string level)¶
Sets the logging level.
- Parameters:
level – Logging level as a string.
-
inline bool HadWarning() const¶
Checks if any warnings have been recorded.
- Returns:
True if warnings occurred.
-
inline bool HadError() const¶
Checks if any errors have been recorded.
- Returns:
True if errors occurred.
-
inline void ActivateOptionalOutputScheme(std::string name)¶
Activates an optional output scheme.
- Parameters:
name – The name of the optional output scheme to activate.
Public Static Functions
-
static inline RMGManager *Instance()¶
Retrieves the singleton instance of RMGManager.
- Returns:
Pointer to the RMGManager instance.
-
static inline void AbortRunGracefully()¶
Set a flag to gracefully aborts the simulation run at the next possible time.
-
static inline bool ShouldAbortRun()¶
Checks whether an abort signal has been triggered.
- Returns:
True if the run should be aborted.
-
RMGManager() = delete¶