MOMO; GUI desktop for Geant4


Geant4-10
December , 2013
Hajime YOSHIDA
Geant4 Associates International Ltd.
mail: hajime.yoshida@g4ai.org
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//

Index

  1. MOMO for Geant4-10
  2. Environment Variables
  3. GAG
  4. GGE Geant4 Geometry Editor
    1. Characteristics
    2. Material Editor and Volume Editor
    3. Menus of GGE
    4. Material Editor
      1. Periodic Table of Elements
      2. Functionalities of the Material Editor
    5. The Logical Volume Editor
      1. Functionalities to define Geant4 logical volumes
    6. The Physical Volume Editor
      1. Limit of Physical volumes Editor
      2. Constructors of G4PVPlacement
      3. Single Positioned Volume
      4. Repeated Translationally Positioned Volumes
      5. Repeated Rotationally Positioned Volumes
      6. Replica in the X, Y or Z direction, Replica in rho, phi or Z direction
    7. Generation of C++ code
      1. Naming conventions in GGE
      2. Default values and combo-boxes
1) MOMO for Geant4-10

Momo was originally conceived as a kind of integrated GUI desktop for Geant4 but for Geant4 version 10, only two componetnts GAG (Geant4 Adaptive GUI)  and Environment Variable Panel are maintained.
Other MOMO's componets are kept for archives;
Their original source Java codes are  available in the form of Java Archive file "momo-src.jar"  in the "environments/MOMO/" directory.
It is completely written in Java and runs on any platform running Java like Linux, Windows and Mac. Currently supported is Java 1.6 . 


2. Environment Variables




Geant4-10 adopts CMake as the  default build system. The only environment variables user has to set are those on the physics data set files.  MOMO shows the values of the following
environment variables which are set by user, for example, with geant4.(c)sh.


"G4LEDATA",  "G4LEVELGAMMADATA", "G4RADIOACTIVEDATA",  "G4NEUTRONHPDATA" , "G4ABLADATA" ,
"G4NEUTRONXSDATA" , "G4PIIDATA" , "G4REALSURFACEDATA", "G4SAIDXSDATA"





3. GAG


3-1 How to choose GAG as your user interface.

Geant4's interface for GAG, G4UIGAG, is selected as one of  default user interfaces like csh and tcsh, when you use G4UIExecutive() in your main code.
Basic examples, from B1 to B4 are codes as such.
To make GAG as your first choice, the file $HOME/.g4session must be used.
In this file user interfaces (and application which uses them) can be specified, for example;

       #example
       gag
       tcsh
       qt


3-2 How to use GAG

On the terminal, type the following line;

        %java -jar your-path-to-MOMO/MOMO.jar

and you have the MOMO window.
You can create an icon to the above command if it helps you.

Usage of GAG is simple.
  1. Click the GAG tab and open the GAG's pane
  2. Click the top left Geant menu and its "Start" button
  3. Choose the Geant4 binary file, using the file chooser and click on it
  4. After a moment, the Geant4 command tree (at left) and parameter panel (at right) are displayed. AT the lower panel is displayed the outputs from Geant4 application.
  5. Click on the nodes or leaves make their help diaplayed. Commands in the opaque characters are inactive ones.
  6. Parameters are either chosen from the list or typed in.
  7. Four buttons are available
  8. Output from the Geant4 are shown in the lower window, if "Log_to_Terminal" button is cheched. This button can be unchecked at any time. "Log_to_File" button can be also cheched or unchecked at any time.
  9. If you want to interrupt the execution, "Kill_Geant4" button is used.


 
4) GGE Geant4 Geometry Editor (for archive)

GGE, or GEANT4 Geometry Editor, is a tabular tool to "create" a detector geometry of GEANT4. From the rows of the tables, filled by user, it generates a complete C++ class code lines for materials and logical volumes. It is capable of limited and relatively simple cases of the full geometry, including physical volumes, i.e., placing of logical volumes.

4-1) Characteristics

Tables
It provides users with several tables into whose cells users can fill with their own detector parameters. Each row of the tables corresponds to a kind of instantiation or application of a certain method of a class.
Help user with Geant4 defaults
Default values, canonical units of Geant4, pre-defined Geant4 constants etc. are visually provided for user's choice.
C++ code generation
Using the data in the tables, even if they are partial and imcomplete, GGE can generate C++ source codes for a detector, only if the class name of the geometry is supplied.
If user wants so, C++ codes generated by GGE can be a complete description of a detector, including the definition of atoms, materials, solids, color attributes, logical volumes and physical volumes with rotations and translations.
Persistency and Reuse of detector data
Full detector data and material data can be saved in the Java's serialization format or in the XML format a la GDML-1. It can be reloaded for later reuse. XML format a la GDML-1 is limited to materials and logical volumes. But XML file lacks some items in the MOMO's table due to GDML-1's present imcompleteness. Physical volumes aren't supported.
Companion files and Extra "Project" functions


4-2) Material Editor and Volume Editor


GGE consists of two tabular editors (material and volume) which are interrelated.
The material editor consists of two tables; one for "material from scratch", another for "compound materials".
Volume editor consists of two minor editors; one for "logical volumes" and another for "physical volumes". The logical volume editor allows user to specify complete description of logical volumes, including solid, material, and visualization attribute.
The Physical volume editor, in contrast, supports only limited use-cases ; Single Positioned Volume, Repeatedly Positioned Volumes with incremental copy numbers (translational arrangement or axially symmetric arrangement), and Replicas (in any axis).

Tips!

  1. GGE/MOMO is based on Java's MVC (Model-View-Control) model, so that any changes to any of the tables by a user are automatically reflected to the internal data structure of GGE and thus to C++ codes. This is true at any moment, so that user can get even imcomplete C++ class files at any moment, even without any filled tabular cells, though only the class name is mandatory.
  2. The whole detector description can be saved in a persistent file and can be loaded for later reuse.
  3. GGE employs own naming rules to generate C++ codes from the tables. This will be explained later.


4-3) Menus of GGE


GGE has a top menu buttons and fill-in text area.

4-4) Material Editor


 

The material editor is composed of two minor tables for
  1. "material from scratch" and
  2. "compound materials".
These tables can be enlengthened as will, if necessary. The boundary of the two tables can be moved as will, too.
Every row corresponds to one material (scratch or compound). A row is filled with selected element(s) and default values, when user push the "append" or "insert" button, after selecting a element(s).

4-4-1) Periodic Table of Elements


The periodic table is popped up, when one of the "append" or "insert" buttons of the tables is pushed.
When an element is chosen by the mouse click, it's label color becomes green. Multiple elements (upto 20 at present) can be chosen simultaneously for compound materials. When a mouse is clicked on the selected element, is is deselected. So, user can choose correct element(s).
The foundamental properties of atoms; Z, A, etc. are pre-built in to the atomic table and are copied automatically to the table. They are also used to create C++, XML and Java serialization files, even though unseen to the user.
The element window can be hidden at any moment by the close button of the window.


4-4-2) Functionalities of the Material Editor


The following functionalities are implemented;
  1. append, insert, edit and delete a material
  2. The first column "in Use" is to mark the materials used in user's detector (logical volumes). The default value is "in Use", when a row is created at the first time.
  3. input and output from/to persistent material file
    Material tables are saved to a Java's persistent file and can be reused. XML a la GDML format is also provided. Note that GDML is not yet complete and is lacking a part of definitions like material's state etc.
Not yet implemented are; Notice on C++ codes
MOMO doesn't duplicate the C++ instance of an element, but is not protected against possible duplication of "in Use" instances of the same name of compound materials.

4-4-3) A code fragment generated from the dicom.xml; XML file.

// Elements
G4Element* elementH = new G4Element( "Hydrogen", "H", 1. , 1.00794*g/mole );
G4Element* elementC = new G4Element( "Carbon", "C", 6. , 12.011*g/mole );
G4Element* elementN = new G4Element( "Nitrogen", "N", 7. , 14.00674*g/mole );
G4Element* elementO = new G4Element( "Oxygen", "O", 8. , 15.9994*g/mole );
G4Element* elementNa = new G4Element( "Sodium", "Na", 11. , 22.989768*g/mole );
G4Element* elementMg = new G4Element( "Magnesium", "Mg", 12. , 24.305*g/mole );
G4Element* elementP = new G4Element( "Phosphorus", "P", 15. , 30.973762*g/mole );
G4Element* elementS = new G4Element( "Sulfur", "S", 16. , 32.066*g/mole );
G4Element* elementCl = new G4Element( "Chlorine", "Cl", 17. , 35.4527*g/mole );
G4Element* elementK = new G4Element( "Potassium", "K", 19. , 39.0983*g/mole );
G4Element* elementCa = new G4Element( "Calcium", "Ca", 20. , 40.078*g/mole );
G4Element* elementFe = new G4Element( "Iron", "Fe", 26. , 55.845*g/mole );

// Materials from Combination

G4Material* SkeletonSpongiosa = new G4Material("SkeletonSpongiosa", 1159.0*kg/m3,
12, kStateUndefined, 273.15*kelvin, 1.0*atmosphere );
SkeletonSpongiosa->AddElement( elementH, 0.085 );
SkeletonSpongiosa->AddElement( elementC, 0.404 );
SkeletonSpongiosa->AddElement( elementN, 0.058 );
SkeletonSpongiosa->AddElement( elementO, 0.367 );
SkeletonSpongiosa->AddElement( elementNa, 0.0010 );
SkeletonSpongiosa->AddElement( elementMg, 0.0010 );
SkeletonSpongiosa->AddElement( elementP, 0.034 );
SkeletonSpongiosa->AddElement( elementS, 0.0020 );
SkeletonSpongiosa->AddElement( elementCl, 0.0020 );
SkeletonSpongiosa->AddElement( elementK, 0.0010 );
SkeletonSpongiosa->AddElement( elementCa, 0.044 );
SkeletonSpongiosa->AddElement( elementFe, 0.0010 );


The above C++ lines are generated from the next fragments of XML file a la GDML which was created by MOMO which reloaded this XML file.
<?xml version="1.0" encoding="UTF-8"?>
<gdml xmlns:gdml="http://cern.ch/2001/Schemas/GDML"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../schema/gdml_1.0.xsd">
<!--skip-->

<materials>
<!--Elements-->
<element name="Hydrogen" formula="H" Z="1">
<atom value="1.00794"/>
</element>
<element name="Carbon" formula="C" Z="6">
<atom value="12.011"/>
</element>
<element name="Nitrogen" formula="N" Z="7">
<atom value="14.00674"/>
</element>
<element name="Oxygen" formula="O" Z="8">
<atom value="15.9994"/>
</element>
<element name="Sodium" formula="Na" Z="11">
<atom value="22.989768"/>
</element>
<element name="Magnesium" formula="Mg" Z="12">
<atom value="24.305"/>
</element>
<element name="Phosphorus" formula="P" Z="15">
<atom value="30.973762"/>
</element>
<element name="Sulfur" formula="S" Z="16">
<atom value="32.066"/>
</element>
<element name="Chlorine" formula="Cl" Z="17">
<atom value="35.4527"/>
</element>
<element name="Potassium" formula="K" Z="19">
<atom value="39.0983"/>
</element>
<element name="Calcium" formula="Ca" Z="20">
<atom value="40.078"/>
</element>
<element name="Iron" formula="Fe" Z="26">
<atom value="55.845"/>
</element>

<!--Materials from Combination-->
<material name="SkeletonSpongiosa">
<D type="denstiy" value="1159.0" unit="kg/m3"/>
<T type="temperature" value="273.15" unit="kelvin"/>
<P type="pascal" value="1.0" unit="atmosphere"/>
<fraction n="0.085" ref="H"/>
<fraction n="0.404" ref="C"/>
<fraction n="0.058" ref="N"/>
<fraction n="0.367" ref="O"/>
<fraction n="0.0010" ref="Na"/>
<fraction n="0.0010" ref="Mg"/>
<fraction n="0.034" ref="P"/>
<fraction n="0.0020" ref="S"/>
<fraction n="0.0020" ref="Cl"/>
<fraction n="0.0010" ref="K"/>
<fraction n="0.044" ref="Ca"/>
<fraction n="0.0010" ref="Fe"/>
</material>
<!--skip-->
</gdml>



4-5) The Logical Volume Editor


The logical volume editor is composed of

4-5-1) Functionalities of the logical volume editor


Following functionaliteis are implemented;
  1. Defining G4LogicalVolumes
    Each row of the logical vulume table represents an instance of the G4LogicalVolume constructor. User can append, insert or delete a row with corresponding buttons.
    The table has following columns;
  2. Selecting a G4Solid
    All Geant4 solids can be selected from the solid listbox, located at the right of "Select a Solid" label.
  3. After selecting a solid tyle, user pushes the "append" or "insert" button and a new row is created in the table.
  4. By clicking on the "solid" cell (the second column), a pop up window appears to specify solid's parameters. User can
    A code fragment of a logical volume "thintube" of BREP PolyCone generated by MOMO. Words in red are those typed in by a user.
    G4double DzArraythintube   [] = 
    {-1000.0*micrometer, -750.0*micrometer, -500.0*micrometer, -250.0*micrometer,
    0.0*micrometer, 250.0*micrometer, 500.0*micrometer, 750.0*micrometer,
    1000.0*micrometer};
    G4double RminArraythintube [] =
    {1.0*micrometer, 1.0*micrometer, 1.0*micrometer, 1.0*micrometer, 1.0*micrometer,
    1.0*micrometer, 1.0*micrometer, 1.0*micrometer, 1.0*micrometer};
    G4double RmaxArraythintube [] =
    {20.0*micrometer, 16.0*micrometer, 12.0*micrometer, 8.0*micrometer,
    4.0*micrometer, 8.0*micrometer, 12.0*micrometer, 16.0*micrometer, 20.0*micrometer};

    G4BREPSolidPCone *solidthintube = new G4BREPSolidPCone("solidthintube", //its name
    0.0*mrad, //its start angle
    270.0*deg, //its opening angle
    9, //its nZ
    DzArraythintube[0], //z start
    DzArraythintube, //z value
    RminArraythintube, //rmin
    RmaxArraythintube ); //rmax

    G4LogicalVolume * logicalthintube = new G4LogicalVolume(solidthintube, //its solid
    carbon, //its material
    "logicalthintube" , //its name
    0,0,0);

    logicalthintube->SetVisAttributes(black);

  5. Defining G4Color
    The visualization attribute and its name are required by the logical volumes. They can be defined using a graphical color chooser. Each color's given unique name is listed in the editor panel. The RGB numbers defined by the chooser are taken to generate C++ codes.
    An example of code fragments generated by MOMO
    G4VisAttributes * lightblue= new G4VisAttributes( G4Colour(0/255. ,255/255. ,255/255. ));
  6. "Make the used materials" button.
    Clicking this button, GGE scans the materials specified in the logical volume table and marks "in Use" cell (the first column ) of the material tables accordingly. All other materials not used in logical volumes are not marked. Note that only rows marked "in Use" are used to generate C++ codes.


4-6) The Physical Volume Editor


The physical volume editor consists of five minor tables of different way of displacement of a logical volume. Each table is contained in a tabbed pane.

4-6-1) Limit of Physical volumes Editor


Compared with the logical volume editor, the physical volume one has limited generality. So, if user aren't satisfied with the following simplistic ways to place logical volumes, he can use partially generated C++ codes for logical volumes etc. as a starting point.

4-6-2) Constructors of G4PVPlacement


Following four types of constructor are implemented, according to the types of rotation and types of the mother volume.

  1. Type 1 constructor = rotation of the frame, physical mother volume
  2. Type 2 constructor = rotation of a body, physical mother volume
  3. Type 3 constructor = rotation of the frame, logical mother volume
  4. Type 4 constructor = rotation of a body, logical mother volume
Next are the example C++ codes generated by MOMO for the above four cases. In the first two cases, words in red are those which user typed in the cells of the editor.
  1. "box-bp" and "box-fp" in the first column to specify the pName, i.e., the name of the unstance of G4PVPlacement
  2. "box" in the second column to spscify the names of their logical volumes, pLogical. All the names already defined in the logical volume panel are displayed to choose one. In this case, one "box" is used to make different physical volumes.
  3. "container" in the pMother, i.e., name of the mother volume. The prefixes "logical" or "physical" are attached according to the type of the mother volume.
pNames are used as postfixes to designate local variables like rotation matrices and rotation angles etc.. On the contrary, several prefixes are used to differentiate instances, like physicalcontainer and logicalcontainer, where only "container" is typed in a cell.
Naming conventions will be explained later.
// Single Positioned Placement 
// Body rotation + physical mother G4RotationMatrix rotMatrixbox-bp; // unit rotation matrix
G4double anglebox-bp = 0.0*deg; // rotational angle
rotMatrixbox-bp.rotateX(anglebox-bp); // rot matrix

G4VPhysicalVolume * box-bp= new G4PVPlacement(G4Transform3D(rotMatrixbox-bp, //rotation
G4ThreeVector(0.0*mm, 0.0*mm, 0.0*mm)),
"box-bp", //its name (2nd constructor)
box, //its logical volume
physicalcontainer, //its mother volume
false, //no boolean operation
0); //copy number

// Frame rotation + physical mother G4RotationMatrix rotMatrixbox-fp; // unit rotation matrix
G4double anglebox-fp = 0.0*deg; // rotational angle
rotMatrixbox-fp.rotateX(anglebox-fp); // rot matrix

G4VPhysicalVolume * box-fp= new G4PVPlacement( new G4RotationMatrix(rotMatrixbox-fp) , // Frame rotation
G4ThreeVector(0.0*mm, 0.0*mm, 0.0*mm),
"box-fp", // 1st constructor its name
box, //its logical volume
physicalcontainer, //its mother volume
false, //no boolean operation
0); //copy number

// Body rotation + logical mother G4RotationMatrix rotMatrixbox-bl; // unit rotation matrix G4double anglebox-bl = 0.0*deg; // rotational angle rotMatrixbox-bl.rotateX(anglebox-bl); // rot matrix G4VPhysicalVolume * box-bl= new G4PVPlacement(G4Transform3D(rotMatrixbox-bl, //rotation G4ThreeVector(0.0*mm, 0.0*mm, 0.0*mm)), box, //its current logical volume(4th constructor) "box-bl", //its name logicalcontainer, //its mother volume false, //no boolean operation 0); //copy number // Frame rotation + logical mother G4RotationMatrix rotMatrixbox-fl; // unit rotation matrix G4double anglebox-fl = 0.0*deg; // rotational angle rotMatrixbox-fl.rotateX(anglebox-fl); // rot matrix G4VPhysicalVolume * box-fl= new G4PVPlacement( new G4RotationMatrix(rotMatrixbox-fl) , // Frame rotation G4ThreeVector(0.0*mm, 0.0*mm, 0.0*mm), box, // 3rd constructor its logical volume "box-fl", //its name logicalcontainer, //its mother volume false, //no boolean operation 0); //copy number

Following simple placements are provided in GGE. Every placement is contained in independent tabbed pane.

4-6-3) Single Positioned Volume (SPV)


Each row represents a physical volume which has one-to-one correspondence to a logical volume. The C++ code lines are demonstrated just above.
IMPORTANT!! The world volume must be defined in the first row of this table.
  1. The first column specifies either body or frame rotation.
  2. The second column specifies the instance's name of the physical volume
  3. The third column specifies the name of the logical volume to be placed
  4. The fourth column specifies the type of the mother volume. The mother volume is either null(Master Reference System), logical or physical. The MARS or the world volume must be specified at the first row.
  5. The fifth column specifies the name of the mother volume, if it isn't NULL.
  6. The columns 7, 8 and 9-th specify the translation in the X, Y or Z direction (default is no translation) with a selectable unit of length
  7. The 11-th column specifies the axis of rotation (frame or body); rotation around X, Y or Z axis with an angle in the 12-th column


4-6-4) Repeated Translationally Positioned Volumes (RTPV Arrangement)


Each row represent a physical volume which consists of any number of copies of a logical volume with incremental copy numbers.
  1. The first to 4-th columns are same as above.
  2. The columns 6, 7 and 8-th specify the position of the first copy
  3. The 10-th column specifies the direction of placement; X, Y or Z direction
  4. The 11-th column specifies the incremental step size of displacement
  5. The last column specifies the number of copies
Next is a fragment of C++ code generated from a line in the table. Here "Boses" is typed in the first column, pName. This word is used as the postfix to designate local variables as well as the loop variable. "box" is the pLogical, i.e., the name of the logical volume. Here the mother's name is typed in as "world" in the pMother cell, and it is physical. The "box" logical volume is translated along X direction from X0 = -100*cm in 10*cm step with the copy numbers "copyBoxes" from 1 to 21.
G4int copyBoxes;
copyBoxes=0;
for (G4int Boxes=1; Boxes<=21; Boxes++){
G4double transBoxes =-100.0*cm+10.0*cm*(Boxes-1);
G4VPhysicalVolume * Boxes = new G4PVPlacement(0, //no rotation
G4ThreeVector(transBoxes, 0.0*cm, 0.0*cm),
"Boxes", //its name
box, //its logical volume
physicalworld, //its mother volume
false, //no boolean operation
copyBoxes++); //copy number
}



4-6-5) Repeated Rotationally Positioned Volumes; (RRPV Arrangement)


Each row represents a physical volume which consists of axially symmetric arrangement of any number of copies of a logical volume with incremental copy numbers.
  1. The columns "move", "pName", "pLogic", "MomType" and "pMother" are same as above.
  2. (X0, Y0, Z0) column specify the position of the center of an axial rotation
  3. "Radius" column specifies a radius of axially symmetric arrangement
  4. "RotAxis" column specifies the rotational axis ; X, Y or Z
  5. "Phi_0" and "dPhi" column specify a starting angle and incremental step angle
  6. The last column specifies the number of copies
A row of the table generates the C++ code lines as below. Here "Circle" is the pName. The logical volume "box" is copied around the Z axis from 0* deg with 30* deg step and with copy number "copyCircle" from 1 to 10. The center of rotation (x0Circle, y0Circle, z0Circle) = (-200*mm, 100*mm, 0.0*mm).
// Active Rotation of Bodies
G4int copyCircle;
copyCircle=0;
G4RotationMatrix rotationMatrixCircle;G4double startCircle = 0.0*deg;
G4double incCircle = 30.0*deg;
rotationMatrixCircle.rotateZ(startCircle);
G4double x0Circle = -200.0*mm;
G4double y0Circle = 100.0*mm;
G4double z0Circle = 0.0*mm;
G4double radiusCircle = 300.0*mm;

for (G4int Circle=1; Circle<=10; Circle++){
G4double transCircle = startCircle+incCircle*(Circle-1);

G4double xCircle, yCircle, zCircle;
xCircle = x0Circle + radiusCircle * cos(transCircle);
yCircle = y0Circle + radiusCircle * sin(transCircle);
zCircle = z0Circle;
G4VPhysicalVolume * Circle = new G4PVPlacement(G4Transform3D(rotationMatrixCircle, //rotate
G4ThreeVector(xCircle, yCircle, zCircle)),
"Circle", //its name
box, //its logical volume
physicalworld, //its mother volume
false, //no boolean operation
copyCircle++); //copy number
rotationMatrixCircle.rotateZ(incCircle);
}



4-6-6, 7) Replica in the X, Y or Z direction, Replica in rho, phi or Z direction

  1. width (in length or angle) and number of replicas
  2. offset (in length or angle)
  3. logical or physical mother volume
Below is the C++ code lines generated from a row in the table. "Sliced" is the pName (the first column). "box" is the logical volume to be sliced. pMother is "world" and it is the physical volume. The number of replicas along X axis is 1000 with 2.0*micronmeter width and with offset of -1.0*mm.
/ Slicing Translation 

G4PVReplica * physicalSliced= new G4PVReplica("physicalSliced", //name
logicalbox, // its logical
physicalworld, // its mother
kXAxis, // along Axis
1000, // No of replicas
2.0*micrometer, // width
-1.0*mm); // offset

Planned but not implemented yet are paremetrised volumes with linear scaling or linear rotation.

4-7) Generation of C++ code


GGE has two menu buttons to generate the implementation file and class definition file. Here is a sample of automatically generated C++ code which is created from completely skelton tables but with the class name "MyDetector".
//***** Generated by Geant4 Geometry Editor at  Wed Feb 25 20:27:44 JST 2004 *****

//------HeaderFile-
#include "MyDetector.hh"

#include "G4UnitsTable.hh"

#include "G4VUserDetectorConstruction.hh"

#include "globals.hh"
#include "G4Material.hh"
#include "G4MaterialTable.hh"
#include "G4Element.hh"
#include "G4ElementTable.hh"
#include "G4LogicalVolume.hh"
#include "G4ThreeVector.hh"
#include "G4PVPlacement.hh"
#include "G4PVReplica.hh"
#include "G4SDManager.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"

MyDetector::MyDetector()
{ ; }
MyDetector::~MyDetector()
{ ; }
G4VPhysicalVolume* MyDetector::Construct( )
{
// Elements

// Materials from Combination


// Materials from Scratch


// Visualization attributes


// Logical Volumes


// Physical Volumes ---- Single Positioned Placement, Repeated Placement, Slicing ---------------------------


// Single Positioned Placement


// Repeated Placement Translation


// Repeated Placement AxialSymmetoric


// Slicing Translation


// Slicing AxialSymmetric


// return the physical World



Next is the definition file of this skelton class.
// Geometry Header File 
// MyDetector.hh generated by Geant4 Geometry Editor at Wed Feb 25 20:27:44 JST 2004


#ifndef MyDetector_h
#define MyDetector_h 1

class G4VPhysicalVolume;
#include "G4VUserDetectorConstruction.hh"
class MyDetector: public G4VUserDetectorConstruction
{ public:
MyDetector();
~MyDetector();

public:
G4VPhysicalVolume* Construct();
};
#endif



4-7-1) Naming conventions in GGE


Knowing GGE's naming convention is helpful to read the generated C++ code as well as using GGE correctly. Look at relevant Geant4 constructors will be very suggestive.
  1. Elements and materials
    1. Elements are named "elementXXX", where XXX stands for the element's symbol in the periodic table.
    2. materials are named just as you have typed in the second column of the material window.
  2. solids and logical volumes
    The "Name" typed in the first (leftmost) column of the "Logical Volume" is used to name the corresponding solid. If the name "world" is given to a logical volume of a Box, the G4Solid has an instance "solidworld".
  3. logical and physical volumes
    1. The strings of the pName (physical or logical) cells filled in the table are used literally as the names of instances.
    2. The instance of a physical volume defined by "pName" has a name prefixed with "physical", i.,e., instance's name is "physical" + pName ( + => string concatenation). "logical" is added to the instance of a logical volume.
    3. In case of SPV (single positioned volume), the columns "pName" (instance of physical volume) and "pLogical" may have the same strings.
    4. In case of RVA (repeated volumes arrangement), "pName" is different from "pLogical" whose copies are repeatedly placed.
  4. All variables are named after their proper instances. See for example, the control variable used in the for loop in the RVA.
    Another examples are arrays to define BREP geometry.


4-7-2) Default values and combo-boxes

  1. Default optional values of materials GGE provides default values in a pre-filled columns or with the combo-boxes. "Use", "State" and "Unit" columns are equipped with combo-boxes. Temperature and pressure column are pre-filled with 273.15 * kelvin and 1 * atmosphere.
  2. Default values in volumes "Mother Type" is either NULL (mother of all), logical (type 2, 4 constructors) or physical (type 2 or 4 constructors) in G4PVPlacement.




yoshida

About the authors