Geant4 Geometry XML Convertor
|
The Geant4 geometry XML convertor is a small set of C++ classes
that are included in the
Geant4 Virtual Monte Carlo . It enables to generate
XML files with geometry description in the AGDD
or GDML format.
The geometry can be then browsed and visualized using
GraXML tool .
- Start root and run example E02:
cd geant4_vmc/examples/E02
root.exe
root[0] .x run_g4.C
- Go to Geant4 UI:
root [1] ((TGeant4*)gMC)->StartGeantUI()
- Invoke Geant4 UI command:
Idle> /xml/generateAGDD [volName]
or
Idle> /xml/generateGDML [volName]
A file "WRLD.xml" or "WRLD.gdml" will be generated.
If a volume name is specified after the command:
the XML file "volName.xml" or "volName.gdml" will be then genarated for the
specified volume and its daughters tree.
E.g. in the Geant4 novice example N02:
- Add these lines to GNUmakefile:
# added lines
CPPFLAGS += -I/mypath/geant4_vmc/convertors/g4toxml/include
EXTRALIBS += -L/mypath/geant4_vmc/lib/tgt_Linux -lg4toxml
-
Include TG4AGDDGeometryGenerator and/or TG4GDMLGeometryGenerator
instance in ExN02DetectorConstruction.hh:
#include "TG4AGDDGeometryGenerator.h"
#include "TG4GDMLGeometryGenerator.h"
// ... skipped
private:
// ... skipped
TG4AGDDGeometryGenerator fAGDDGeometryGenerator;
TG4GDMLGeometryGenerator fGDMLGeometryGenerator;
};
This will add Geant4 UI directory /xml with
/xml/generateAGDD and/or /xml/generateGDML commands.
GraXML is a program for the 3D visualization of the
Event and Detector description data. It uses Java3D to create, render and
manipulate SceneGraph and can be run as a standalone application.
Variety of pictures created by GraXML can be found in the
GraXML Gallery .
In order to view a file (or files) generated by Geant4 VMC XML convertor
in GraXML do the following steps:
- If using AGDD, copy the AGDD.dtd file from the GraXML distribution
(GraXML/misc/Test/AGDD.dtd) to your current directory
- Set the Java environment and run GraXML following the instructions in the
GraXML Guide .
- In the GraXML window type command:
w.show("myfile.xml");
or
w.show("myfile.gdml");
A few tips how to start:
- When viewing the XML file in a text editor select XML (if available)
or HTML (otherwise) syntax highlighting.
- When viewing a "huge" geometry use high optimisation level via
Config.setOptimisation(9);
command (viewing with limited interactivity).
XML Formats
- Atlas
AGDD (Detector description)
-
GDML (Geometry Description Markup Language)
- In GEANT3 a volume (e.g. XYZ) can change its solid parameters with
its new position (placement with GSPOSP);
for each such G3 volume with modified solid parameters a
new G4LogicalVolume (associated with a new G4VSolid) is defined
in Geant4 and a new element with name XYZ_N in XML.
- Divided volumes (defined by GSDVN, GSDVN2, GSDVT, GSDVT2)
in GEANT3 are in Geant4 represented by replicated volumes
(G4PVReplica) and in XML (AGDD) with "mpos.." elements.
GDML does not support divided or replicated volumes yet.
- In AGDD, for each volume (e.g. XYZ) that contains daughters volumes a new
composition element is created with the name XYZ_comp and
it is placed separately from the volume's solid.
So for each placement of this volume two XML elements are created:
1. a "pos.." (or "transform") element that places the volume's
solid XYZ
2. a "pos.." (or "transform") element that places the volume's
daughters XYZ_comp.
This doubling is not present in GDML.
XML Web pages
Page maintained by:
Ivana Hrivnacova
Last update: 26/04/2004