Multiple GDML File Loading.

Issue #190 resolved
Laurie Nevay created an issue

We can't load two different gdml files where volumes have the same name.

The Geant4 GDML parser is written in a way such that everything is cached behind the scenes. Even if you delete and re-instantiate a parser, the tags defined are cached and reused. We have the same tags in each file - say 'world_solid' or 'world_volume'. Despite a new G4GDMLParser each time, we get the exact same logical volume and solids for the world volume when loading totally different files.

I found this thread:

http://hypernews.slac.stanford.edu/HyperNews/geant4/get/geometry/1497.html

with relevant reply:

http://hypernews.slac.stanford.edu/HyperNews/geant4/get/geometry/1497/2.html

For now the solution is to uniquely name all objects across multiple files - a total pain.

I'm looking just now for some sort of static interface to reset the cache (so far unsuccessfully). It looks like it's how you use the xercesc parser.

We might have to edit and repackage the geant4 gdml parser.

If we have a specific solution to turn off caching we can submit a but report and ask for it in all versions.

Comments (2)

  1. Laurie Nevay reporter

    This is resolved as of v0.993. We introduced a preprocessor that opens and parsers the GDML file using the xercesc C++ library. This requires parsing and comprehension of the file as updated names may be used as variables later on in the file.

    This has been implemented and we can now load multiple GDML files by modifying all names to have unique prefixes.

  2. Laurie Nevay reporter

    The modified files are created in a temporary directory and removed at the end of running BDSIM leaving the original files untouched.

  3. Log in to comment