Class RMGOutputManager

Class Documentation

class RMGOutputManager

Manages output operations including ntuple registration and persistent storage.

This singleton class provides methods for configuring output options, registering ntuples, and handling file persistency for analysis purposes.

Public Functions

RMGOutputManager()
~RMGOutputManager() = default
RMGOutputManager(RMGOutputManager const&) = delete
RMGOutputManager &operator=(RMGOutputManager const&) = delete
RMGOutputManager(RMGOutputManager&&) = delete
RMGOutputManager &operator=(RMGOutputManager&&) = delete
inline bool IsPersistencyEnabled() const

Checks if persistency is enabled.

Returns:

true if output persistency is enabled.

inline const std::string &GetOutputFileName()

Retrieves the output file name.

Returns:

Reference to the output file name string.

inline bool HasOutputFileNameNone() const

Checks if the output file name is set to “none”.

Returns:

true if output file name equals “none”.

inline bool HasOutputFileName() const

Checks if a valid output file name is set.

Returns:

true if output file name is non-empty and not “none”.

inline bool GetOutputOverwriteFiles() const

Indicates whether output files should be overwritten.

Returns:

true if overwriting is enabled.

inline const std::string &GetOutputNtupleDirectory()

Gets the directory name for output ntuples.

Returns:

Reference to the ntuple directory name.

inline bool GetOutputNtuplePerDetector() const

Checks if output ntuples are generated per detector.

Returns:

true if ntuples are generated per detector.

inline bool GetOutputNtupleUseVolumeName() const

Checks if volume names are used for output ntuple naming.

Returns:

true if volume names are used.

inline const std::map<int, std::pair<int, std::string>> &GetNtupleIDs()

Retrieves the set of registered ntuple detector identifiers.

Returns:

Set of detector identifiers.

inline std::set<std::string> GetAuxNtupleNames()

Retrieves the set of registered auxiliary ntuple identifiers.

Returns:

Set of auxiliary ntuple names.

inline void EnablePersistency(bool flag = true)

Enables or disables output persistency.

Parameters:

flag – Set to true to enable, false to disable.

inline void SetOutputFileName(std::string filename)

Sets the output file name.

Parameters:

filename – The name of the output file.

inline void SetOutputOverwriteFiles(bool overwrite)

Configures whether output files should be overwritten.

Parameters:

overwrite – True to enable overwriting, false otherwise.

inline void SetOutputNtupleDirectory(std::string dir)

Sets the directory for output ntuples.

this might not be used by all output file formats.

Parameters:

dir – The directory name for ntuple output.

int RegisterNtuple(int det_uid, int ntuple_id, std::string table_name)

Registers an alreaday created ntuple for a given detector.

Parameters:
  • det_uid – Unique identifier for the detector.

  • ntuple_id – Identifier for the ntuple.

  • table_name – name of the the ntuple on disk.

Returns:

The registered ntuple identifier.

int CreateAndRegisterNtuple(int det_uid, std::string table_name, std::string oscheme, G4AnalysisManager *ana_man)

Creates and registers a ntuple for a given detector.

An ordinary ntuple that stores information related to stepping data. An IPC message keyed as “output_ntuple” is automatically sent to communicate the output scheme name and the output table name.

Parameters:
  • det_uid – Unique identifier for the detector.

  • table_name – Name of the table.

  • oscheme – Type name of the output scheme registering this ntuple.

  • ana_man – Pointer to the analysis manager.

Returns:

The created ntuple identifier.

int CreateAndRegisterAuxNtuple(std::string table_name, std::string oscheme, G4AnalysisManager *ana_man)

Creates and registers an auxiliary ntuple.

An auxiliary ntuple stores information not strictly related to stepping data. An IPC message keyed as “output_ntuple_aux” is automatically sent to communicate the output scheme name and the output table name.

Parameters:
  • table_name – Name of the output table.

  • oscheme – Type name of the output scheme registering this ntuple.

  • ana_man – Pointer to the analysis manager.

Returns:

The created auxiliary ntuple identifier.

inline int GetNtupleID(int det_uid)

Gets the ntuple identifier for a given detector.

Parameters:

det_uid – Unique identifier for the detector.

Returns:

The ntuple identifier.

inline int GetAuxNtupleID(std::string det_uid)

Gets the auxiliary ntuple identifier for a given key.

Parameters:

det_uid – Key for the auxiliary ntuple.

Returns:

The auxiliary ntuple identifier.

void ActivateOptionalOutputScheme(std::string name)

Activates an optional output scheme.

Parameters:

name – Name of the output scheme to activate.

Public Static Functions

static inline RMGOutputManager *Instance()

Gets the singleton instance of RMGOutputManager.

Creates a new instance if none exists.

Returns:

Pointer to the RMGOutputManager instance.