Are constant material properties missing a hash in the name for GDML?

I am adding properties using AddConstProperty() to a number of different G4MaterialPropertiesTable().

Several of the constants have the same name, eg ELECTRICFIELD. So there is an ELECTRICFIELD for material1 and a different ELECTRICFIELD for material2 etc…
However, when writing out the created geometry to a GDML file, there is no distinction between these properties in the definitions. As such the GDML file can not then be read in, instead the following error is seen;

-------- EEEE ------- G4Exception-START -------- EEEE -------

*** ExceptionHandler is not defined ***
*** G4Exception : InvalidExpression
issued by : G4GDMLEvaluator::DefineConstant()
Redefinition of constant or variable: ELECTRICFIELD
*** Fatal Exception ***
-------- EEEE -------- G4Exception-END --------- EEEE -------

1 Like

Hi,

thanks a lot for reporting this and sorry for the delay.

I have started debugging this and realized that there is more than one problem. The const properties are written out as constants (scalars), but the parser (reader) expects them to be matrices of dimensions 1x1. In other words, even if you have one const property, the generated GDML file (as far as I can see at the current moment) would not be possible to read it.

I will try to provide a fix to all those problems as soon as possible.

2 Likes

Hi @witoldp,

Is there maybe an issue open for this we could follow?

Hi, sorry for a (very long) wait. Please find a patch in the attached file. Let me know if that works for you.
Cheers,
Witek
gdml.patch.txt (3.1 KB)

1 Like

Looks good thanks!
I’ve tried it on some cut down geometry and it does exactly we want.
Thanks
Sam

1 Like