ROOT 6.12/07 Reference Guide |
GDML tools for geometry classes.
The $ROOTSYS/gdml
directory contains a set of Python modules designed for writing out Geometry Description Markup Language (GDML) files. There is also a C++ implementation for the import of GDML into ROOT. They act as a converter between the GDML geometry files and the TGeo geometry structures (and vice versa).
As this binding is integrated into the ROOT installation, you need to enable the use of the binding at the configure point of the ROOT installation. This can be done like so:
On doing this the libraries will be built by issuing the standard ROOT make command. The GDML to TGeo converter uses the TXMLEngine to parse the GDML files. This XML parser is a DOM parser and returns the DOM tree to the class TGDMLParse. This class then interprets the GDML file and adds the bindings in their TGeo equivalent.
The GDML schema is fully supported with a few exceptions:
These will hopefully be added in the near future.
Once you have enabled GDML in the configure process for ROOT, to import a GDML file, this can be done using TGeoManager::Import. This automatically calls the right method to parse the GDML by detecting the .gdml file extension. Here is how to do it:
Replace test.gdml with the gdml filename you want to import. Once the GDML file has been successfully imported, you can view the geometry by calling:
For any questions or comments about the GDML->ROOT binding please contact ben.l loyd @cern .ch
The TGeo to GDML converter allows to export ROOT geometries (TGeo geometry trees) as GDML files. The writer module writes a GDML file out of the 'in-memory' representation of the geometry. The actual application-specific (ROOT) binding is implemented in ROOTwriter module. It contains 'binding methods' for TGeo geometry classes which can be exported in GDML format. Please refere to the comment part of the ROOTwriter.py file for the list of presently supported TGeo classes. The ROOTwriter class contains also three methods, dumpMaterials, dumpSolids and examineVol which need to be called in order to export materials, solids and geometry tree respectively.
The TGeo to GDML converter is now interfaced to the TGeoManager::Export method which automatically calls the appropriate Python scripts whenever the geometry output file has the .gdml extension.
Alternatively, one can also use the ROOT->GDML converter directly from the Python prompt (assuming the TGeo geometry has already been loaded into memory in one or another way), for example:
For all other functionality questions or comments, or even GDML in general, please email Witol d.Po korsk i@ce rn.ch
Classes | |
class | TGDMLParse |
This class contains the implementation of the GDML parser associated to all the supported GDML elements. More... | |
class | TGDMLRefl |
This class is a helper class for TGDMLParse. More... | |
class | TGDMLWrite |
This class contains implementation of converting ROOT's gGeoManager geometry to GDML file. More... | |