Getting started
What's needed
- In order to use GDML-3 with Geant4 one needs to have:
- XercesC parser
installed (GDML-3 in Geant4 9.2 has been successfully tested with
version 3.1.1 of XercesC);
- Geant4 9.2 or newer installed
(together with the appropriate CLHEP
library version), with flag G4LIB_BUILD_GDML set and
XERCESCROOT path to XercesC installation specified.
- In order to use GDML with Root one needs to have Root v5.12.00 or newer.
- No additional installation is needed.
Using GDML
- Using GDML with Geant4
In order to use the GDML file as geometry source for a Geant4 application
one needs to instanciate and call the GDML parser. This can, for instance,
be done within a special G4VUserDetectorConstruction class
implementation.
The examples located inside the Geant4 distribution
(see inside examples/extended/persistency/gdml directory) provide
implementations of such a detector construction class.
In order to export the Geant4 geometry in the form of the GDML file, one
needs to call the writer through the G4GDMLParser instance for dumping the
geometry tree identified by the pointer to the top volume provided as
argument. This can be done anywhere in the user code provided only
that the Geant4 geometry tree is already instanciated in the memory.
The example code can be found in Geant4 example G02 in the
same directory as specified above.
- Using GDML with Root
GDML reader and writer is fully integrated within the
TGeoManager::Import and TGeoManager::Export
methods which will call the appropriate GDML processing
code whenever the file extension is .gdml.