remage
Simulation framework for HPGe-based experiments
 
Loading...
Searching...
No Matches
RMGManager Class Reference

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
 
RMGManageroperator= (RMGManager const &)=delete
 
 RMGManager (RMGManager &&)=delete
 
RMGManageroperator= (RMGManager &&)=delete
 
G4RunManagerGetG4RunManager ()
 Retrieves the Geant4 run manager.
 
G4VisManagerGetG4VisManager ()
 Retrieves the Geant4 visualization manager.
 
RMGHardwareGetDetectorConstruction ()
 Retrieves the detector construction.
 
G4VUserPhysicsListGetProcessesList ()
 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 RMGManagerInstance ()
 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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ RMGManager()

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.

Parameters
app_nameThe application name.
argcArgument count.
argvArgument vector.

Member Function Documentation

◆ ActivateOptionalOutputScheme()

void RMGManager::ActivateOptionalOutputScheme ( std::string name)
inline

Activates an optional output scheme.

Parameters
nameThe name of the optional output scheme to activate.

◆ ApplyRandEngineForCurrentThread()

bool RMGManager::ApplyRandEngineForCurrentThread ( )

Applies the random engine settings for the current thread.

Returns
True if applied successfully.

◆ EnableMultiProcessing()

void RMGManager::EnableMultiProcessing ( int proc_num)
inline

Sets the process number for offset calculations in process-parallelized mode.

Parameters
proc_numprocess number of this instance (note: this is not the total number of processes!)

◆ GetDetectorConstruction()

RMGHardware * RMGManager::GetDetectorConstruction ( )

Retrieves the detector construction.

Returns
Pointer to the RMGHardware instance.

◆ GetG4RunManager()

G4RunManager * RMGManager::GetG4RunManager ( )

Retrieves the Geant4 run manager.

Returns
Pointer to the G4RunManager instance.

◆ GetG4VisManager()

G4VisManager * RMGManager::GetG4VisManager ( )

Retrieves the Geant4 visualization manager.

Returns
Pointer to the G4VisManager instance.

◆ GetOutputManager()

auto RMGManager::GetOutputManager ( ) const
inlinenodiscard

Retrieves the output manager.

Returns
Pointer to the RMGOutputManager instance.

◆ GetPrintModulo()

int RMGManager::GetPrintModulo ( ) const
inlinenodiscard

Returns the print modulo value.

Returns
Print modulo integer.

◆ GetProcessesList()

G4VUserPhysicsList * RMGManager::GetProcessesList ( )

Retrieves the physics list.

Returns
Pointer to the G4VUserPhysicsList instance.

◆ GetProcessNumberOffset()

int RMGManager::GetProcessNumberOffset ( ) const
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.

Returns
the process number offset.

◆ GetRandEngineSelected()

bool RMGManager::GetRandEngineSelected ( ) const
inlinenodiscard

Checks if a random engine has been selected by the user.

Returns
True if a random engine is selected.

◆ GetRandIsControlled()

bool RMGManager::GetRandIsControlled ( ) const
inlinenodiscard

Checks if the random engine is under user controlled seeding.

Returns
True if controlled.

◆ GetUserInit()

auto RMGManager::GetUserInit ( ) const
inlinenodiscard

Retrieves the user initialization object.

Returns
Shared pointer to RMGUserInit.

◆ HadError()

bool RMGManager::HadError ( ) const
inlinenodiscard

Checks if any errors have been recorded.

Returns
True if errors occurred.

◆ HadWarning()

bool RMGManager::HadWarning ( ) const
inlinenodiscard

Checks if any warnings have been recorded.

Returns
True if warnings occurred.

◆ IncludeMacroFile()

void RMGManager::IncludeMacroFile ( std::string filename)
inline

Includes a macro or single macro command file for execution.

Parameters
filenameThe name of the macro file.

◆ Initialize()

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)

◆ Instance()

static RMGManager * RMGManager::Instance ( )
inlinestatic

Retrieves the singleton instance of RMGManager.

Returns
Pointer to the RMGManager instance.

◆ IsExecSequential()

bool RMGManager::IsExecSequential ( ) const
inlinenodiscard

Checks if the execution is sequential (single-threaded).

Returns
True if the run manager is sequential.

◆ IsMultiProcessing()

bool RMGManager::IsMultiProcessing ( ) const
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.

Returns
True if this instance of remage is part of a process-parallelized run.

◆ RegisterG4Alias()

void RMGManager::RegisterG4Alias ( std::string alias,
std::string value )
inline

Registers a Geant4 alias for use in macro commands.

Parameters
aliasThe alias name.
valueThe corresponding value.

◆ Run()

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.

◆ SetInteractive()

void RMGManager::SetInteractive ( bool flag = true)
inline

Enables or disables interactive mode.

Parameters
flagTrue to enable interactive mode.

◆ SetLogLevel()

void RMGManager::SetLogLevel ( std::string level)

Sets the logging level.

Parameters
levelLogging level as a string.

◆ SetNumberOfThreads()

void RMGManager::SetNumberOfThreads ( int nthreads)
inline

Sets the number of threads.

Parameters
nthreadsNumber of threads.

◆ SetPrintModulo()

void RMGManager::SetPrintModulo ( int n_ev)
inline

Sets the print modulo value.

Parameters
n_evNumber of events for modulo printing.

◆ SetRandEngine()

void RMGManager::SetRandEngine ( std::string name)

Sets the random engine by name.

Parameters
nameName of the random engine.

◆ SetRandEngineInternalSeed()

void RMGManager::SetRandEngineInternalSeed ( int index)

Sets the internal seed index for the random engine.

Parameters
indexThe seed index.

◆ SetRandEngineSeed()

void RMGManager::SetRandEngineSeed ( int seed)

Sets the seed for the random engine.

Parameters
seedThe seed value.

◆ SetUserInit() [1/4]

void RMGManager::SetUserInit ( G4RunManager * g4_manager)
inline

Sets the Geant4 run manager.

Parameters
g4_managerPointer to the G4RunManager.

◆ SetUserInit() [2/4]

void RMGManager::SetUserInit ( G4VisManager * vis)
inline

Sets the Geant4 visualization manager.

Parameters
visPointer to the G4VisManager.

◆ SetUserInit() [3/4]

void RMGManager::SetUserInit ( G4VUserPhysicsList * proc)
inline

Sets the physics list.

Parameters
procPointer to G4VUserPhysicsList.

◆ SetUserInit() [4/4]

void RMGManager::SetUserInit ( RMGHardware * det)
inline

Sets the detector construction.

Parameters
detPointer to RMGHardware.

◆ ShouldAbortRun()

static bool RMGManager::ShouldAbortRun ( )
inlinestatic

Checks whether an abort signal has been triggered.

Returns
True if the run should be aborted.

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