Class RMGHardware

Nested Relationships

Nested Types

Inheritance Relationships

Base Type

  • public G4VUserDetectorConstruction

Class Documentation

class RMGHardware : public G4VUserDetectorConstruction

Public Functions

RMGHardware()

Constructor based on calling the macro commands (with DefineCommands ).

~RMGHardware() = default
RMGHardware(RMGHardware const&) = delete
RMGHardware &operator=(RMGHardware const&) = delete
RMGHardware(RMGHardware&&) = delete
RMGHardware &operator=(RMGHardware&&) = delete
G4VPhysicalVolume *Construct() override

Construct the detector.

Detector geometry can be based on GDML files, parsed with G4GDMLParser . Alternatively geometry can be defined directly by overriding the DefineGeometry() method.

This function defines the geometry and checks for overlaps, if using GDML defined geometry and check are not disabled. It also assigns physical volumes to Geant4 regions and sets user step limits. This must not modify thread-local state, because it is only called once globally.

This function will call RegisterDetector() to register detectors staged with StageDetector() and register all detector types specified with the RegisterDetectorsFromGDML macro command from the GDML.

Returns:

The physical volume of the world.

void ConstructSDandField() override

Setup thread-local geometry data.

This is called once for the master thread and once for each worker thread. Can be used to setup sensitive detectors, which have to be constructed per thread.

void RegisterDetector(RMGDetectorType type, const std::string &pv_name, int uid, int copy_nr = 0, bool allow_uid_reuse = false)

Register a physical volume as sensitive detector.

The uid is a unique identifier for the detector. It is mostly used to label the detector in the simulation output. This function also informs the run action to automatically activate output schemes for all registered detector types. This function is called during Construct() method to register detectors from the GDML and to register detectors staged with StageDetector() method.

Parameters:
  • type – The type of detector.

  • pv_name – The name of the physical volume to be registered.

  • uid – A unique integer identifier for the sensitive volume.

  • copy_nr – The copy number of the physical volume.

  • allow_uid_reuse – Flag to allow assigning the same uid to different detectors.

void StageDetector(RMGDetectorType type, const std::string &pv_name, int uid, int copy_nr = 0, bool allow_uid_reuse = false)

Stage a detector for later registration.

This function is used to stage detectors following a regex name pattern, which will be registered later during the Construct() method. This function will be called by the /RegisterDetector macro command instead of the RegisterDetector() function directly. If multiple volumes match a regex by given uid, depending on the allow_uid_reuse flag, the uid will be reused or incremented for each detector.

Parameters:
  • type – The type of detector.

  • pv_name – The name of the physical volume to be registered.

  • uid – A unique integer identifier for the sensitive volume.

  • copy_nr – The copy number of the physical volume.

  • allow_uid_reuse – Flag to allow assigning the same uid to different detectors.

inline const auto &GetDetectorMetadataMap()

Extract a map of the detector metadata, one element for each sensitive detector physical volume and copy_nr.

inline const auto &GetDetectorMetadata(const std::pair<std::string, int> &det)

Extract the detector metadata for a given detector.

Parameters:

det – the detector identifier, a pair of the physical volume name and the copy number.

inline const auto &GetActiveDetectorList()
inline const auto &GetAllActiveOutputSchemes()
inline void IncludeGDMLFile(std::string filename)

Add a GDML file to the geometry.

Parameters:

filename – file name to add.

inline virtual G4VPhysicalVolume *DefineGeometry()

Method to define geometry directly, the user must reimplement the base class method.

void SetMaxStepLimit(double max_step, std::string name)

Set the maximum step size.

This is used as a G4UserLimit to limit step sizes to being no larger than the chosen value. This requires the G4StepLimiter process to be activated in the physics list.

Parameters:
  • max_step – The maximum step size.

  • name – Name of the physical volume.

inline void PrintListOfLogicalVolumes()
inline void PrintListOfPhysicalVolumes()