- changed status to resolved
GDML Preprocessor variable error
Issue #224
resolved
Our GDML preprocessor does not replace variable names in expressions. For example:
<constant name=“size” value=“25.0”/>
<position name=“position” x=“2.0*size” y=“size” z=“75.0” unit=“m”/>
For a GDML file loaded in component "DR1" we would rename "size" to "DR1_size". The x variable in the position would still be 2.0size whereas it should be 2.0DR1_size.
This is valid GDML so we should support it.
Comments (1)
-
reporter - Log in to comment
This is actually extremely difficult to implement. Well, it's trivial to implement but similar names are mangled incorrectly. For example if you have pos1 and pos12 and pospos12 as names in the GDML file the name mangling would not work correctly. To correctly implement this, we would need dynamic regular expressions, which I don't think is possible with the c++ regex library.
I've updated the manual to reflect this. The way around this would be to load the GDML file in a Geant4 program (example) and export it again. This would flatten and simplify the representation.