Experimental geometry¶
remage does not implement or manage any experimental geometry. Instead, the user must provide a geometry definition. There are two supported approaches:
Supply one or more GDML files via the command line or using the macro command /RMG/Geometry/IncludeGDMLFile.
Override
RMGHardware::DefineGeometry()in a subclass ofRMGHardwareand register it usingRMGManager::SetUserInit(). A practical example is inexamples/02-hpge.
See also
The pyg4ometry Python library provides powerful tools for building Monte Carlo geometries and exporting them as GDML. Relevant pyg4ometry-based packages include:
legend-pygeom-tools – general geometry routines and extensions
legend-pygeom-hpges – high-purity germanium detector models
legend-pygeom-optics – optical properties for Geant4 materials
Full geometry implementations based on these tools:
legend-pygeom-l200 – LEGEND-200
legend-pygeom-l1000 – LEGEND-1000
Registering sensitive detectors¶
Sensitive detector volumes must be registered so that particle interactions are
recorded in the output. In remage, this can be done in several ways. Each
detector has a unique id (UID) and a type, which determines how hits in a
physical volume (or in a group of them) are processed and stored. Detector of
type Germanium, Scintillator and Optical are currently supported, see
Output for more details.
Note
User-defined detector types cannot currently be registered at runtime.
The simplest method is to use the /RMG/Geometry/RegisterDetector macro command:
/RMG/Geometry/RegisterDetector Germanium B00000B 1
/RMG/Geometry/RegisterDetector Germanium C000RG1 2 1
This registers the physical volume B00000B, and the C000RG1 volume with copy
number 1 as Germanium detectors with UIDs 1 and 2 respectively. Because for
B00000B no copy number was specified, this will register all B00000B named
volumes if there are multiple with different copy numbers. This command now also
accepts regex patterns (respecting the
default std::regex_match grammar):
/RMG/Geometry/RegisterDetector Germanium B.* 1
registers all physical volumes starting with B. If there are multiple volumes
matching the pattern, they will all be registered alphabetically under
incrementing UIDs. This means the first alphabetical B.* match will be
registered under UID 1, the second match will be registered with UID 2 and so
on. It is therefore the responsibility of the user to make sure that no UID will
be duplicated, which is detected by remage and results in an error.
Alternatively, one might want to assign the same UID to multiple physical
volumes, i.e. as if they constitute a single detector unit. In such a scenario,
there would be no way to distinguish hits from different volumes in the
simulation output (except from the coordinates in post-processing). In this
case, the fifth argument (allow_uid_reuse) has to be set to true:
/RMG/Geometry/RegisterDetector Germanium .*_cu_.* 1 .* true
This would register any volume with name matching the regular expression
.*_cu_.* under the UID 1. In this case the UIDs will not be incremented
for multiple matches.
Last but not least, detectors can be imported from a GDML file that includes metadata, using the /RMG/Geometry/RegisterDetectorsFromGDML command.
Tip
The legend-pygeom-tools package automatically includes such metadata when
writing GDML with pygeomtools.write.write_pygeom().
Inspecting geometry¶
To inspect the simulation geometry, use the following macro commands:
Example session:
remage> /RMG/Geometry/IncludeGDMLFile geometry.gdml
remage> /run/initialize
G4GDML: Reading 'geometry.gdml'...
G4GDML: Reading definitions...
G4GDML: Reading materials...
G4GDML: Reading solids...
G4GDML: Reading structure...
G4GDML: Reading userinfo...
G4GDML: Reading setup...
G4GDML: Reading 'geometry.gdml' done!
Stripping off GDML names of materials, solids and volumes ...
[Summary -> Checking for overlaps in GDML geometry...
remage> /RMG/Geometry/PrintListOfPhysicalVolumes
[Summary -> · B00000A // 0 daugh. // 5.54635 g/cm3 // 488.951 g // 8.81573 cL // 1 atm // 293.15 K
[Summary -> · B00000B // 0 daugh. // 5.54635 g/cm3 // 700.096 g // 1.26227 dL // 1 atm // 293.15 K
...
[Summary -> · wlsr_ttx // 1 daugh. // 350 mg/cm3 // 1.15983 kg // 3.3138 L // 1 atm // 293.15 K
[Summary -> · world // 1 daugh. // 1e-22 mg/cm3 // 154028 kg // 1.54028e+18 km3 // 3e-18 Pa // 2.73 K
[Summary ->
[Summary -> Total: 171 volumes
Tip
As seen above, the Geant4 overlap checker is enabled by default if GDML input is provided. It can be disabled with the /RMG/Geometry/GDMLDisableOverlapCheck command.