I am trying to define a geometry with gdml using multiple files, using the gdml manual as a reference (https://gdml.web.cern.ch/GDML/doc/GDMLmanual.pdf) but I am having a problem when using the tesselated
solid geometry.
In this case (a simple cube) it works fine:
child.gdml
<?xml version="1.0" encoding="UTF-8"?>
<gdml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://service-spi.web.cern.ch/service-spi/app/releases/GDML/schema/gdml.xsd">
<define>
<constant name="size" value="50" />
</define>
<solids>
<box name="world_solid" x="100" y="100" z="100" />
<box name="child_solid" x="size" y="size" z="size" />
</solids>
<structure>
<volume name="child">
<materialref ref="child_material" />
<solidref ref="child_solid" />
</volume>
<volume name="world">
<physvol>
<volumeref ref="child" />
</physvol>
<materialref ref="world_material" />
<solidref ref="world_solid" />
</volume>
</structure>
<setup name="Default" version="1.0">
<world ref="world" />
</setup>
</gdml>
mother.gdml
<?xml version="1.0" encoding="UTF-8"?>
<gdml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://service-spi.web.cern.ch/service-spi/app/releases/GDML/schema/gdml.xsd">
<define />
<solids>
<box name="world_solid" x="100" y="100" z="100" />
</solids>
<structure>
<volume name="world">
<physvol>
<file name="child.gdml" />
</physvol>
<materialref ref="world_material" />
<solidref ref="world_solid" />
</volume>
</structure>
<setup name="Default" version="1.0">
<world ref="world" />
</setup>
</gdml>
However when I use a tesselated solid on the child volume I get an error:
child.gdml (tesselated)
<?xml version="1.0" encoding="UTF-8"?>
<gdml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://service-spi.web.cern.ch/service-spi/app/releases/GDML/schema/gdml.xsd">
<define>
<position name="cube_v0" unit="mm" x="10.0" y="-10.0" z="10.0" />
<position name="cube_v1" unit="mm" x="10.0" y="0.0" z="10.0" />
<position name="cube_v2" unit="mm" x="0.0" y="-10.0" z="10.0" />
<position name="cube_v3" unit="mm" x="0.0" y="0.0" z="10.0" />
<position name="cube_v4" unit="mm" x="0.0" y="-10.0" z="0.0" />
<position name="cube_v5" unit="mm" x="0.0" y="0.0" z="0.0" />
<position name="cube_v6" unit="mm" x="10.0" y="-10.0" z="0.0" />
<position name="cube_v7" unit="mm" x="10.0" y="0.0" z="0.0" />
</define>
<solids>
<box name="world_solid" x="100" y="100" z="100" />
<tessellated name="child_solid" aunit="deg" lunit="mm">
<triangular vertex1="cube_v0" vertex2="cube_v1" vertex3="cube_v2" />
<triangular vertex1="cube_v2" vertex2="cube_v1" vertex3="cube_v3" />
<triangular vertex1="cube_v4" vertex2="cube_v5" vertex3="cube_v6" />
<triangular vertex1="cube_v6" vertex2="cube_v5" vertex3="cube_v7" />
<triangular vertex1="cube_v3" vertex2="cube_v5" vertex3="cube_v2" />
<triangular vertex1="cube_v2" vertex2="cube_v5" vertex3="cube_v4" />
<triangular vertex1="cube_v1" vertex2="cube_v7" vertex3="cube_v3" />
<triangular vertex1="cube_v3" vertex2="cube_v7" vertex3="cube_v5" />
<triangular vertex1="cube_v0" vertex2="cube_v6" vertex3="cube_v1" />
<triangular vertex1="cube_v1" vertex2="cube_v6" vertex3="cube_v7" />
<triangular vertex1="cube_v2" vertex2="cube_v4" vertex3="cube_v0" />
<triangular vertex1="cube_v0" vertex2="cube_v4" vertex3="cube_v6" />
</tessellated>
</solids>
<structure>
<volume name="child">
<materialref ref="child_material" />
<solidref ref="child_solid" />
</volume>
<volume name="world">
<physvol>
<volumeref ref="child" />
</physvol>
<materialref ref="world_material" />
<solidref ref="world_solid" />
</volume>
</structure>
<setup name="Default" version="1.0">
<world ref="world" />
</setup>
</gdml>
To read the GDML I use TGeoManager::Import("mother.gdml")
.
I get the following error on the tesselated geometry:
Info in <TGeoManager::Import>: Reading geometry from file: mother.gdml
Info in <TGeoManager::TGeoManager>: Geometry GDMLImport, Geometry imported from GDML created
Medium: world_material, Not Yet Defined!
Fatal in <TGDMLParse::Tessellated>: Vertex cube_v0 not defined
It looks like the cube_v0
definition is not being carried over in the <file/>
declaration. However this does not make sense to me because in the first example, I am using the size
definition which is correctly processed.
What am I missing?
Thanks!