remage
Simulation framework for HPGe-based experiments
 
Loading...
Searching...
No Matches
RMGHardware Class Reference
Inheritance diagram for RMGHardware:
Collaboration diagram for RMGHardware:

Public Member Functions

 RMGHardware ()
 Constructor based on calling the macro commands (with DefineCommands ).
 
 RMGHardware (RMGHardware const &)=delete
 
RMGHardwareoperator= (RMGHardware const &)=delete
 
 RMGHardware (RMGHardware &&)=delete
 
RMGHardwareoperator= (RMGHardware &&)=delete
 
G4VPhysicalVolumeConstruct () override
 Construct the detector.
 
void ConstructSDandField () override
 Setup thread-local geometry data.
 
void RegisterDetector (RMGDetectorType type, const std::string &pv_name, int uid, int copy_nr=0, bool allow_uid_reuse=false, const std::string &ntuple_name="")
 Register a physical volume as sensitive detector.
 
void StageDetector (RMGDetectorType type, const std::string &pv_name, int uid, const std::string &copy_nr="0", bool allow_uid_reuse=false, const std::string &ntuple_name="")
 Stage a detector for later registration.
 
const auto & GetDetectorMetadataMap ()
 Extract a map of the detector metadata, one element for each sensitive detector physical volume and copy_nr.
 
const auto & GetDetectorMetadata (const std::pair< std::string, int > &det)
 Extract the detector metadata for a given detector.
 
const auto & GetActiveDetectorList ()
 
const auto & GetAllActiveOutputSchemes ()
 
void IncludeGDMLFile (std::string filename)
 Add a GDML file to the geometry.
 
const G4VPhysicalVolumeGetDefinedWorldVolume () const
 Get the instance of the world volume, after Construct had been called once.
 
G4VPhysicalVolumeGetDefinedWorldVolume ()
 Get the instance of the world volume, after Construct had been called once.
 
void SetMaxStepLimit (double max_step, std::string name)
 Set the maximum step size.
 
void SetEminLimitForParticle (double ekin_min, std::string name, std::string particle_name)
 Set a minimum kinetic energy cut for one selected particle in a volume.
 
void PrintListOfLogicalVolumes ()
 
void PrintListOfPhysicalVolumes ()
 

Static Public Member Functions

static bool IsEminLimitParticleSelected (const G4LogicalVolume *logical, const std::string &particle_name)
 Check if selective EkinMin should be applied for the current track context.
 

Protected Member Functions

virtual G4VPhysicalVolumeDefineGeometry ()
 Method to define geometry directly, the user must reimplement the base class method.
 

Member Function Documentation

◆ Construct()

G4VPhysicalVolume * RMGHardware::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.

◆ ConstructSDandField()

void RMGHardware::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.

◆ GetDetectorMetadata()

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

Extract the detector metadata for a given detector.

Parameters
detthe detector identifier, a pair of the physical volume name and the copy number.

◆ IncludeGDMLFile()

void RMGHardware::IncludeGDMLFile ( std::string filename)
inline

Add a GDML file to the geometry.

Parameters
filenamefile name to add.

◆ RegisterDetector()

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

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
typeThe type of detector.
pv_nameThe name of the physical volume to be registered.
uidA unique integer identifier for the sensitive volume.
copy_nrThe copy number of the physical volume.
allow_uid_reuseFlag to allow assigning the same uid to different detectors.
ntuple_nameNtuple name override.

◆ SetEminLimitForParticle()

void RMGHardware::SetEminLimitForParticle ( double ekin_min,
std::string name,
std::string particle_name )

Set a minimum kinetic energy cut for one selected particle in a volume.

This sets G4UserLimits::SetUserMinEkine on matching logical volumes, but the corresponding cut process is applied only to registered particles.

Parameters
ekin_minMinimum kinetic energy.
namePhysical volume name or regex.
particle_nameGeant4 particle name.

◆ SetMaxStepLimit()

void RMGHardware::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_stepThe maximum step size.
nameName of the physical volume.

◆ StageDetector()

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

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
typeThe type of detector.
pv_nameThe name of the physical volume to be registered.
uidA unique integer identifier for the sensitive volume.
copy_nrThe copy number of the physical volume.
allow_uid_reuseFlag to allow assigning the same uid to different detectors.
ntuple_nameNtuple name override.

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