Vertex confinement¶
Todo
examples
tricks for vertex visualization
remage supports generating event vertices either in the bulk or on the surface of various solids. This is essential for simulating, for example, the decay of radioactive isotopes in detector components.
To enable vertex confinement, activate the corresponding generator using /RMG/Generator/Confine (see Event generators):
/RMG/Generator/Confine Volume
Configuration is handled via commands in the /RMG/Generator/Confinement/ section.
Listing volumes¶
The next step is specifying a list of volumes to consider. These can be of two types: Geant4 physical volumes or user defined virtual geometrical solids.
Physical volumes¶
These can be added via
/RMG/Generator/Confinement/Physical/AddVolume. To add a
physical volume named e.g. C000RG1, do:
/RMG/Generator/Confinement/Physical/AddVolume C000RG1
C000RG1 must be part of the provided geometry implementation. An optional
second argument sets the copy number. You can also use regular expressions (via
std::regex) to match multiple
volumes:
/RMG/Generator/Confinement/Physical/AddVolume C\w+
Geometrical solids¶
Virtual user-defined geometrical solids can be defined with commands in the /RMG/Generator/Confinement/Geometrical/ folder. For example, to add a sphere of radius 15 cm centered in (-1, 2, 5) cm:
/RMG/Generator/Confinement/Geometrical/AddSolid Sphere
/RMG/Generator/Confinement/Geometrical/CenterPositionX -1 cm
/RMG/Generator/Confinement/Geometrical/CenterPositionY 2 cm
/RMG/Generator/Confinement/Geometrical/CenterPositionZ 5 cm
/RMG/Generator/Confinement/Geometrical/Sphere/InnerRadius 0 m
/RMG/Generator/Confinement/Geometrical/Sphere/OuterRadius 15 cm
Other shapes, such as boxes and cylinders, are also supported.
Sampling modes¶
Note
In this section, sampling in the bulk of volumes is assumed. For documentation about sampling on surfaces, see next section.
Once a list of solids is defined, we need to select the sampling mode (i.e. how the list of solids will be used to generate vertices) via /RMG/Generator/Confinement/SamplingMode. Three modes are currently available:
UnionAll(the default)IntersectPhysicalWithGeometricalSubtractGeometrical
In the following, we will refer to physical volumes as \(P_i\) and geometrical volumes as \(G_i\).
UnionAll¶
In this mode, vertices are sampled randomly across all defined solids (physical and geometrical), weighted by their volume to ensure uniform vertex volume density. Formally:
IntersectPhysicalWithGeometrical¶
In this mode, vertices are sampled in the intersection between physical and geometrical volumes. Formally:
As for the previous mode, uniform vertex volume density is guaranteed. The algorithm first samples a candidate vertex from the smaller group (by total volume, to improve sampling efficiency), then checks if it lies in the other group. Override the default group with /RMG/Generator/Confinement/FirstSamplingVolume.
SubtractGeometrical¶
This mode allows to perform subtractions between physical and geometrical volumes, formally:
Geometrical solids can be added to the group of solids to be subtracted with the /RMG/Generator/Confinement/Geometrical/AddExcludedSolid command.
Note
The functionality of IntersectPhysicalWithGeometrical is still available. If
both physical and geometrical volumes are defined with
/RMG/Generator/Confinement/Physical/AddVolume, the
intersection between them will be computed before subtracting the other solids.
Formally:
Bulk versus surface¶
By default, remage will sample vertices in the bulk of solids. Activate sampling on surfaces with the /RMG/Generator/Confinement/SampleOnSurface command.
remage can exactly sample in the bulk or surface of some simple solids
(G4Box, G4Sphere, G4Orb and G4Tubs, see
RMGGeneratorUtil::rand()). For other volumes, Monte Carlo sampling
methods are implemented. For sampling in the bulk of an arbitrary Geant4 solid,
a rejection-sampling method is implementing by using Geant4’s solid extent and
G4VSolid::Inside(). For sampling on the surface of an arbitrary Geant4
solid, the algorithm described in [1] is implemented.
All sampling modes described above are available, with few notes/limitations:
The algorithm samples across volumes weighted by surface area, to ensure uniform vertex surface density.
Sampling on the surface of volumes that contain daughters will result in vertices being distributed on the outer surface of the mother volume only.
volumes that have daughters coincinding with the mothers’s surface will be weighted by the surface area including the daughter volume.
Sampling on intersections/subtractions of surfaces is not possible. remage will instead sample vertices in intersections/subtractions between surfaces and volumes. Because of this, the group of volumes (geometrical or physical) to sample the candidate surface vertices from must be set with /RMG/Generator/Confinement/FirstSamplingVolume. This is not optional.
Vertices from external files¶
For more complicated vertex confinement remage supports the possibility to read in directly event primary positions from input files, as described in Vertex input.