Class RMGMasterGenerator

Inheritance Relationships

Base Type

  • public G4VUserPrimaryGeneratorAction

Class Documentation

class RMGMasterGenerator : public G4VUserPrimaryGeneratorAction

Public Types

enum class Confinement

Enumeration for specifying the primary vertex confinement strategy.

Values:

enumerator kUnConfined

No confinement is applied here; the generator has the duty to sample a primary vertex.

enumerator kVolume

The primary vertex is confined to a specific detector volume.

enumerator kFromFile

The primary vertex is read from an external file.

enum class Generator

Enumeration for selecting the primary generator mode.

Values:

enumerator kG4gun

The standard Geant4 particle gun.

enumerator kGPS

The Geant4 General Particle Source.

enumerator kBxDecay0

The BxDecay0 generator for double beta decay processes.

enumerator kFromFile

A generator that reads primary vertex data from an external file.

enumerator kCosmicMuons

A simple cosmic muon generator.

enumerator kMUSUNCosmicMuons

The MUSUN-based cosmic muon generator.

enumerator kUserDefined

A user-specified custom generator.

enumerator kUndefined

Undefined generator mode.

Public Functions

RMGMasterGenerator()
~RMGMasterGenerator() = default
RMGMasterGenerator(RMGMasterGenerator const&) = delete
RMGMasterGenerator &operator=(RMGMasterGenerator const&) = delete
RMGMasterGenerator(RMGMasterGenerator&&) = delete
RMGMasterGenerator &operator=(RMGMasterGenerator&&) = delete
void GeneratePrimaries(G4Event *event) override

Generate primary vertices for the event.

This method delegates the creation of primary vertices to the configured generator. Depending on the selected generator mode (e.g. G4gun, GPS, BxDecay0, CosmicMuons, etc.), it produces one or more primary vertices for the event.

Parameters:

event – Pointer to the G4Event to which the primary vertices will be added.

inline RMGVGenerator *GetGenerator()

Get the current primary generator.

Returns:

Pointer to the configured RMGVGenerator instance.

inline RMGVVertexGenerator *GetVertexGenerator()

Get the current vertex generator.

Returns:

Pointer to the configured RMGVVertexGenerator instance.

inline Confinement GetConfinement() const

Retrieve the current vertex confinement strategy.

Returns:

The currently selected Confinement mode (kUnConfined, kVolume, or kFromFile).

void SetConfinement(Confinement code)

Set the primary vertex confinement strategy.

The confinement strategy determines how the primary vertex is generated, for example whether to generate it from a detector volume or to load it from an input file.

Parameters:

code – The Confinement mode to set.

void SetConfinementString(std::string code)

Set the vertex confinement strategy using a string.

The provided string is converted to a Confinement enum value.

Parameters:

code – The string specifying the confinement mode (e.g., “kUnConfined”, “kVolume”, “kFromFile”).

void SetUserGenerator(RMGVGenerator *gen)

Set a user-defined primary generator.

This method allows the registration of a custom generator. The user-defined generator pointer is owned by the manager.

Parameters:

gen – Pointer to an instance of a custom RMGVGenerator.

void SetGenerator(Generator gen)

Select one of the built-in primary generator modes.

This method sets the generator mode (e.g., kG4gun, kGPS, kBxDecay0, kCosmicMuons, etc.) to be used when generating primary vertices.

Parameters:

gen – The generator mode to use.

void SetGeneratorString(std::string gen)

Set the primary generator mode using a string.

The method converts the provided string into a Generator enum value.

Parameters:

gen – The string representing the generator type (e.g., “kG4gun”, “kGPS”, “kBxDecay0”, “kCosmicMuons”, “kMUSUNCosmicMuons”, etc.).