Message: Re: Are slashes allowed in volume names in GDML? Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: Are slashes allowed in volume names in GDML? 

Forum: Persistency
Re: None Are slashes allowed in volume names in GDML? (Michael H. Kelsey)
Date: 21 Dec, 2012
From: Michael H. Kelsey <Michael H. Kelsey>

On Sat, 22 Dec 2012 04:51:42 GMT, Michael H. Kelsey wrote:
> I am attempting to add GDML support to an existing application with a
> C++-generated geometry. The application uses a variety of factory
> classes with associated G4UImessengers to build the geometry with
> user-configurable parameters.
> 
> To simplify the coding, I re-use the factories' name string for both the
> Messenger path and for the volume names. In several cases, these names
> include slashes ("/") to provide both a G4UIcommand hierarchy and a
> human-readable volume hierarchy.
> 
> I was able to successfully export my entire geometry to a GDML file, but
> on readback, the GDML parser generates warning messages for all of the
> volume names containing slashes, and fails to construct the geometry:
> 
>   G4GDML: Reading 'snolab+fridge.gdml'...
>   G4GDML: VALIDATION ERROR! value 'Shield/MuMetalShield0xd641c00' is invalid NCName at line: 381
>   G4GDML: VALIDATION ERROR! value 'Shield/MuMetalShield0xd641e10' is invalid NCName at line: 386
>   G4GDML: VALIDATION ERROR! value 'Shield/MuMetalShield0xd641c00' is invalid NCName at line: 387
> [...]
>   G4GDML: VALIDATION ERROR! value 'Fridge/layer40xd65a0c0' is invalid NCName at line: 4452
>   G4GDML: VALIDATION ERROR! value 'Fridge/layer50xd65c670' is invalid NCName at line: 4456
>   G4GDML: Reading definitions...
>   G4GDML: Reading materials...
> [...]
> 
> The visualization comes up empty. I believe this is a shortcoming of the
> GDML schema, since the volume name strings are apparently entirely
> acceptable within the GEANT4 application.

Digging into this a bit more, the "name" attributes for the GDML tags are identified in the schema (http://www-geant4.kek.jp/lxr/source/persistency/gdml/schema/) as being of type "xs:ID", which is (http://documentation.softwareag.com/webmethods/tamino/ins441/xqueryref/ref-xs_ID.htm) defined as an "NCName" value. An NCName is something which can be used as a tag or attribute name in an XML document (like "BLOCKQUOTE" in HTML), rather than being an arbitrary string. NCName values are limited to alphanumeric, underscore, and a few other characters, but not punctuation.

What I would like to be able to do would be to add a "hook" to the GDML generating code (i.e., G4GDMLWriteStructure) so that it would take the raw volume names and convert disallowed characters to something 'safe', like a hyphen, period, or underscore. This doesn't appear to be possible, as the necessary protected functions, in particular the base class G4GDMLWrite::GenerateName(), are not virtual.

 Add Message Add Message
to: "Re: Are slashes allowed in volume names in GDML?"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]