<!-- ******************************************************** -->
<!--                                                          -->
<!--  [History]                                               -->
<!--    Converted to DocBook: Katsuya Amako, Aug-2006         -->
<!--    Changed by: Gabriele Cosmo, 18-Apr-2005               -->
<!--                                                          -->
<!-- ******************************************************** -->


<!-- ******************* Section (Level#2) ****************** -->
<sect2 id="sect.Geom.Edit">
<title>
A Simple Geometry Editor
</title>

<para>
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.
</para>

<para>
GGE provides methods to:

<orderedlist spacing="compact">
  <listitem><para>
    construct a detector geometry including <literal>G4Element</literal>,
    <literal>G4Material</literal>, <literal>G4Solids</literal>, 
    <literal>G4LogicalVolume</literal>,
    <literal>G4PVPlacement</literal>, etc.
  </para></listitem>
  <listitem><para>
    view the detector geometry using existing visualization system, DAWN
  </para></listitem>
  <listitem><para>
    keep the detector object in a persistent way, either in GDML format (currently only logical volumes are supported) or Java serialized format.
  </para></listitem>
  <listitem><para>
    produce corresponding C++ codes after the norm of Geant4 toolkit
  </para></listitem>
  <listitem><para>
    make a Geant4 executable, in collaboration with another component of MOMO, i.e., GPE, or Geant4 Physics Editor.
  </para></listitem>
</orderedlist>
</para>

<para>
GGE can be found in the standard
Geant4 distribution under the <literal>$G4INSTALL/environments/MOMO/MOMO.jar</literal>. 
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. Further information is available from the
Web pages below. 
</para>
<para>
MOMO = GGE + GPE + GAG: 
<ulink url="http://www-geant4.kek.jp/~yoshidah">
http://www-geant4.kek.jp/~yoshidah
</ulink>
</para>

<!-- ******************* Section (Level#3) ****************** -->
<sect3 id="sect.Geom.Edit.Mate">
<title>
Materials: elements and mixtures
</title>

<para>
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 <literal>$G4INSTALL/enviroments/MOMO</literal>,
a pre-constructed database of materials taken from the PDG book, <literal>PDG.xml</literal>
is present.
</para>

<para>
Users can also create new materials either from scratch or by
combining other materials.

<itemizedlist spacing="compact">
  <listitem><para>
    By selecting an element in the periodic table, default values as shown below are copied to a row in the table. 
    <para>
    <informaltable>
    <tgroup cols="11">
    <tbody>
    <row>
      <entry>Use</entry>
      <entry>Name</entry>
      <entry>A</entry>
      <entry>Z</entry>
      <entry>Density</entry>
      <entry>Unit</entry>
      <entry>State</entry>
      <entry>Temperature</entry>
      <entry>Unit</entry>
      <entry>Pressure</entry>
      <entry>Unit</entry>
    </row>
    </tbody>
    </tgroup>
    </informaltable>
    </para>
    <para>
    <emphasis role="bold">Use</emphasis> 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. 
    </para>
  </para></listitem>
  <listitem><para>
    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.
    <para>
    <informaltable>
    <tgroup cols="9">
    <tbody>
    <row>
      <entry>Use</entry>
      <entry>Name</entry>
      <entry>Elements</entry>
      <entry>Density</entry>
      <entry>Unit</entry>
      <entry>State</entry>
      <entry>Temperature</entry>
      <entry>Unit</entry>
      <entry>Pressure</entry>
      <entry>Unit</entry>
    </row>
    </tbody>
    </tgroup>
    </informaltable>
    </para>

    <para>
    By clicking the column <emphasis role="bold">Elements</emphasis>, a new 
    window is open to select one of two methods:

    <itemizedlist spacing="compact">
      <listitem><para>
        Add an element, giving its fraction by weight
      </para></listitem>
      <listitem><para>
        Add an element, giving its number of atoms.
      </para></listitem>
    </itemizedlist>
    </para>
  </para></listitem>
</itemizedlist>
</para>

</sect3>

<!-- ******************* Section (Level#3) ****************** -->
<sect3 id="sect.Geom.Edit.Solids">
<title>
Solids
</title>

<para>
The most popular CSG solids (<literal>G4Box</literal>, <literal>G4Tubs</literal>,
<literal>G4Cons</literal>, <literal>G4Trd</literal>) and specific BREPs solids 
(Pcons, Pgons) are supported. All relevant parameters of such a
solid can be specified in the parameter table, which pops up upon selection.
</para>

<para>
Color, or the visualization attribute of a logical volume can be created, 
using color chooser panel.
Users can view each solid using DAWN.
</para>

</sect3>

<!-- ******************* Section (Level#3) ****************** -->
<sect3 id="sect.Geom.Edit.LogVol">
<title>
Logical Volume
</title>

<para>
GGE can specify the following items:

<informaltable>
<tgroup cols="4">
<tbody>
<row>
  <entry>Name</entry>
  <entry>Solid</entry>
  <entry>Material</entry>
  <entry>VisAttribute</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>

<para>
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.
</para>
<para>
The construction and assignment of appropriate entities for
<literal>G4FieldManager</literal> and <literal>G4VSensitiveDetector</literal> 
are left to the user.
</para>

</sect3>

<!-- ******************* Section (Level#3) ****************** -->
<sect3 id="sect.Geom.Edit.PhysVol">
<title>
Physical Volume
</title>

<para>
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. 
</para>
<para>
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.


<informaltable>
<tgroup cols="9">
<tbody>
<row>
  <entry>Name</entry>
  <entry>LogicalVolume</entry>
  <entry>Type and name of MotherVolume</entry>
  <entry>Many</entry>
  <entry>X0, Y0, Z0</entry>
  <entry>Direction</entry>
  <entry>StepSize</entry>
  <entry>Unit</entry>
  <entry>CopyNumber</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>

<para>
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.
</para>

</sect3>

<!-- ******************* Section (Level#3) ****************** -->
<sect3 id="sect.Geom.Edit.GeneCode">
<title>
Generation of C++ code: 
</title>

<para>
User has to type in a class name  to his
geometry, for example, <literal>MyDetectorConstruction</literal>. 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
<literal>MyDetectorConstruction.cc</literal> and <literal>MyDetectorConstruction.hh</literal> files. 
They reflect all current user modifications in the tables in real-time.
</para>

</sect3>

<!-- ******************* Section (Level#3) ****************** -->
<sect3 id="sect.Geom.Edit.Vis">
<title>
Visualization
</title>

<para>
The whole geometry can be visualized after the
compilation of the source code <literal>MyDetectorConstruction.cc</literal>
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.
</para>


</sect3>
</sect2>
