A Simple Geometry Editor¶
GGE is the acronym for Geant4 Graphical Geometry Editor. GGE aims to assist physicists who have a little knowledge on C++ and the Geant4 toolkit to construct his or her own detector geometry. In essence, GGE is made up of a set of tables which can contain all relevant parameters to construct a simple detector geometry. Tables for scratch or compound materials, tables for logical and physical volumes are provided. From the values in the tables, C++ source codes are automatically generated.
GGE provides methods to:
construct a detector geometry including
G4Element
,G4Material
,G4Solids
,G4LogicalVolume
,G4PVPlacement
, etc.view the detector geometry using existing visualization system, DAWN
keep the detector object in a persistent way, either in GDML format (currently only logical volumes are supported) or Java serialized format.
produce corresponding C++ codes after the norm of Geant4 toolkit
make a Geant4 executable, in collaboration with another component of MOMO, i.e., GPE, or Geant4 Physics Editor.
GGE can be found in the standard Geant4 source package under the
directory environments/MOMO/MOMO.jar
. JRE (Java Run-time
Environment) is prerequisite to run MOMO.jar, Java archive file of MOMO.
MOMO contains GGE, GPE, GAG and other helper tools.
Materials: elements and mixtures¶
GGE provides the database of elements in the form of the periodic table,
from which users can select element(s) to construct new materials. They
can be loaded, used, edited and saved as Java persistent objects or in a
GDML file. In enviroments/MOMO
, a pre-constructed database of
materials taken from the PDG book, PDG.xml
is present.
Users can also create new materials either from scratch or by combining other materials.
By selecting an element in the periodic table, default values as shown below are copied to a row in the table.
Use
Name
A
Z
Density
Unit
State
Temperature
Unit
Pressure
Unit
Use marks the used materials. Only the elements and materials used in the logical volumes are kept in the detector object and are used to generate C++ constructors.
By selecting multiple elements in the periodic table, a material from a combination of elements is assigned to a row of the compound material table. The minimum actions user have to do is to give a name to the material and define its density.
Use
Name
Elements
Density
Unit
State
Temperature
Unit
Pressure
Unit
By clicking the column Elements, a new window is open to select one of two methods:
Add an element, giving its fraction by weight
Add an element, giving its number of atoms.
Solids¶
The most popular CSG solids (G4Box
, G4Tubs
, G4Cons
,
G4Trd
) and specific solids (Pcons, Pgons) are supported. All
relevant parameters of such a solid can be specified in the parameter
table, which pops up upon selection.
Color, or the visualization attribute of a logical volume can be created, using color chooser panel. Users can view each solid using DAWN.
Logical Volume¶
GGE can specify the following items:
Name |
Solid |
Material |
VisAttribute |
The lists of solid types, names of the materials defined in the material tables, and names of user-defined visualization attributes are shown automatically in respective table cell for user’s choices.
The construction and assignment of appropriate entities for
G4FieldManager
and G4VSensitiveDetector
are left to the user.
Physical Volume¶
Geant4 enables users to create a physical volume in different ways; the mother volume can be either a logical or a physical one, spatial rotation can be either with respect to the volume or to the frame to which the volume is attached. GGE is prepared for such four combinatorial cases to construct a physical volume.
Five simple cases of creating physical volumes are supported by GGE. Primo, a single copy of a physical volume can be created by a translation and rotation. Secondo, repeated copies can be created by repeated linear translations. A logical volume is translated in a Cartesian direction, starting from the initial position, with a given step size. Mother volume can be either another logical volume or a physical volume.
Name |
LogicalVolume |
Type and name of MotherVolume |
Many |
X0, Y0, Z0 |
Direction |
StepSize |
Unit |
CopyNumber |
Third, repeated copies are created by rotation around an axis, placing an object repeatedly on a “cylindrical” pattern. Fourth, replicas are created by slicing a volume along a Cartesian direction. Fifth, replicas are created by cutting a volume cylindrically.
Generation of C++ code:¶
User has to type in a class name to his geometry, for example,
MyDetectorConstruction
. Then, with a mouse button click, source
codes in the form of an include file and a source file are created and
shown in the editor panel. In this example, they are
MyDetectorConstruction.cc
and MyDetectorConstruction.hh
files.
They reflect all current user modifications in the tables in real-time.
Visualization¶
The whole geometry can be visualized after the compilation of the source
code MyDetectorConstruction.cc
with appropriate parts of Geant4. (In
particular only the geometry and visualization, together with the small
other parts they depend on, are needed.) MOMO provides Physics Editor to
create standard electromagnetic physics and a minimum main program. See
the on-line document in MOMO.