Gsim Geometry
The detector geometry used in Gsim is controlled by the GEO tables stored in RATDB. Each piece of the detector is represented by a GEO table that gives the name of the element, the shape, position, material, and color (for visualization purposes). This allows simple changes to the detector configuration to be made without having to edit the RAT source code.
Unlike other RATDB files, geometry files end in .geo rather than .ratdb. Because of this, when RAT starts, no GEO tables are loaded into memory. Instead, the program waits until the /run/initialize command is issued, and then loads the geometry file listed in the DETECTOR.geo_file field. It also optionally loads the geometry file given in the DETECTOR.veto_file field if it exists. Once these files have been loaded into the database, the detector is constructed from all of the GEO tables currently in memory.
Customizing the Geometry in a Macro File
There are several ways to customize the detector geometry:
Change DETECTOR.geo_file
If you want to make drastic changes to the detector, you should start by copying one of the geometry files (like simple.geo) and editing it. Then you can add a command like:
/rat/db/set DETECTOR geo_file "mydetector.geo"
to the top of your macro (before /run/initialize). None of the default geometry will be loaded, just your new file. Note that this file should be placed in the data directory.
Load an additional geometry file
Since geometry files are just RATDB files, you can load additional GEO tables using a command like:
/rat/db/load "calibration_source.geo"
This file can contain either completely new detector pieces, or it can override parts of the default geometry. Make sure you set the validity ranges on the tables to put them in the user plane, otherwise they will be overwritten by the defaults when they are loaded. Any extra GEO tables you create will be built right along with the defaults when /run/initialize is executed.
Alter individual fields
For a very small change, like changing just a few numbers, you can use the commands:
/rat/db/set GEO[av] r_max 2800.0
/rat/db/set GEO[scint] r_max 2700.0
Unfortunately, you cannot change array fields using the set command yet.
GEO Table Fields
GEO tables can contain a wide variety of fields to control the properties of the volume. The common fields shared by all tables:
Field |
Type |
Description |
|---|---|---|
|
|
Name of the volume. To conform with RATDB standards, it should follow identifier conventions (no spaces). |
|
|
Name of the mother volume. The mother volume should fully contain this volume. The world volume has the mother “”. |
|
|
If set to zero, this volume is skipped and not constructed. |
|
|
Shape of this volume, see below for list. |
|
|
Name of sensitive detector if this volume should register hits. Limited to ‘’/mydet/pmt/inner’’, ‘’/mydet/fibers’’ and ‘’/mydet/veto/genericchamber’’ |
- Allowed types:
box - Rectangular solid
tube - Cylindrical solid (or section over limited phi range)
ptube - Cylindrical solid with circular perforations along z cut out
sphere - Spherical solid (or section over limited theta and phi range)
psphere - Spherical solid with circular perforations radially cut out
revolve - Solid of revolution defined by (r_max, r_min, z)
AV - Generic spherical acrylic vessel
tubearray - Array of tubes
lgarray - Array of tubes where one end has the PMT face cut out
pmtarray - Array of PMTs
nestedtubearray - Array of three nested tubes. Useful to simulate optical fibers
waterboxarray - Array of standard cubitainer water boxes
extpolyarray - Array of extruded polygonal solids
bubble - Collection of bubbles
All types except “pmtarray”, “waterboxarray”, and “bubble” have these additional fields:
Field |
Type |
Description |
|---|---|---|
|
|
Material filling this volume. See the MaterialList for details. |
|
|
Color to be used for this element in visualization. Either RGB or RGBA (A=alpha transparancy) components ranging from 0.0 to 1.0. |
|
|
If set to 1, mark this volume as invisible during visualization |
|
|
X, Y, Z (mm) components of the position of the volume center, ‘in coordinate system of the mother volume’. Default position is the center. |
|
|
X, Y, Z axis rotations (deg) of element about its center. Rotations are applied in X, Y, Z order. Default is no rotation. |
|
|
Replicate this volume N times inside the mother (position and rotation are ignored if this is set) |
|
|
Axis along which to replicate volume: x, y, z |
|
|
Distance (mm) between replicas |
Box Fields:
Field |
Type |
Description |
|---|---|---|
|
|
X, Y, Z half-lengths (mm) of box (perpendicular distance from center to each face) |
Tube Fields:
Field |
Type |
Description |
|---|---|---|
|
|
Outer radius of tube (mm) |
|
|
Inner radius of tube (mm) Default is 0.0 (solid) |
|
|
Half-height of tube (mm) |
|
|
Angle (deg) where tube segment starts. Default is 0.0 |
|
|
Angle span (deg) of tube segment. Default is 360.0 |
Sphere Fields:
Field |
Type |
Description |
|---|---|---|
|
|
Outer radius of sphere (mm) |
|
|
Inner radius of sphere (mm) Default is 0.0 (solid) |
|
|
Polar angle (deg) where sphere segment starts. Default is 0.0 |
|
|
Polar angle span (deg) of sphere segment. Default is 180.0 |
|
|
Azimuthal angle (deg) where sphere segment starts. Default is 0.0 |
|
|
Azimuthal angle span (deg) of sphere segment. Default is 360.0 |
PMTArray Fields:
Field |
Type |
Description |
|---|---|---|
|
|
Serves as the index for |
|
|
Specifies the table containing position (and direction) arrays specifying how to place PMTs |
|
|
Index to start building PMTs in the |
|
|
Index to stop building PMTs in the |
|
|
Method of determining PMT direction. “point” will aim all PMTs at a point in space. “manual” requires that the position table also contain dir_x, dir_y, and dir_z fields which define the direction vector for each PMT. |
|
|
Point (mm) in mother volume to aim all PMTs toward. |
|
|
Assumes all PMTs are spherically arranged around the center of the mother volume and rescales their positions to a particular radius. By default, no rescaling is done. |
NestedTubeArray Fields:
Creating a parameterized geometry
Using a DetectorFactory one can build a DB defined geometry on the fly
(less useful), or modify a normal DB defined geometry template (more
useful) before the geometry itself is built. Using only .geo files
there is no nice way to have a property of a geometry component defined
as a formula (a function of other geometry parameters), and no nice way to
algorithmically define components of a scalable geometry, e.g. PMT
positions for various photocathode coverage fractions.
The DetectorFactory to use is specified by name in the DETECTOR table under
the field detector_factory and supersedes the geo_file field if used.
If no DetectorFactory is specified, the geo_file specified is loaded as
described above. A DetectorFactory should define tables in the DB in the same
way a .geo file would and make use of GeoFactory components.
/rat/db/set DETECTOR experiment "Validation"
/rat/db/set DETECTOR geo_file "Validation/Valid.geo"
Example usage would be to load a normal (statically defined) .geo file into
the DB and modify it as necessary for the dynamic functionality.