One can hard code the optical properties of a material or a surface in C++, which requires recompiling of the source code. GDML can also be used, but with some limitation (for example, properties cannot be assigned to existing NIST materials pre-defined in Geant4). Worse, there is no way to define optical properties in the default Geant4 text geometry description.
The following two tags are added in GEARS to enable definition of optical materials and surfaces using Geant4 text geometry description syntax. NOTE that they need to be placed at the end of a .tg file to avoid interrupting the processing of known tags by Geant4 before GEARS processes the added ones.
More than 40% of the ~550 lines of C++ code in gears.cc is used to implement this new feature. If it is absorbed in future Geant4 releases, gears.cc can become a lot smaller.
Define optical properties of a material
//:prop <material>
// <wavelength-independent_property> <value>
:prop pureCsIat77K
SCINTILLATIONYIELD 100./keV
RESOLUTIONSCALE 2.
FASTTIMECONSTANT 1.*ns
SLOWTIMECONSTANT 1.*us
YIELDRATIO 0.8
//:prop <material> photon_energies <int(array size)> <energy array>
// <wavelength-dependent_property> <property values>
:prop pureCsIat77K
photon_energies 2 2.034*eV 3.025*eV 4.136*eV
RINDEX 1.34 1.35 1.36
ABSLENGTH 1.0*meter 1.1*meter 1.2*meter
Define optical properties of a surface
First of all, there is no need to define a surface for polished interfaces between two media. As long as the two media have an index of refraction stored in their respective G4MaterialPropertiesTable, the G4OpBoundaryProcess::PostStepDoIt will handle the refraction and reflection correctly.
One can use the following syntax to define a G4LogicalBorderSurface in case that there is a real need to specify the optical properties of the interface:
//:surf v12v2 v1:copyNo1 v2:copyNo2
:surf CsI2Teflon CsI:1 Teflon:1
type dielectric_dielectric
model unified
finish ground
sigma_alpha 0.1
property photon_energies 2 2.5*eV 5.0*eV
REFLECTIVITY 0.9 0.9
//property must be the last setting due to the current coding method
Note that physics volumes from the same logical volume created by the text geometry processor share the same name as their logical volume. Since G4LogicalBorderSurface requires pointers to the two physical volumes beside, a unique copy number has to be attached to the volume name to uniquely identify the physics volume.
Please read the Geant4 manual if you would like to learn more about the optical interface models in Geant4.
You can also run example macros in the surface/ directory to understand the difference between different surfaces.