Problem with elements in exported GDML files

With the latest root version (and maybe with some previous ones) I get an error attempting to load GDML files created by ROOT to Geant4.
On examination of the files, I see that there is a problem with atomic masses of elements and materials (a factor of 1e-19), for example:

<element name="HYDROGEN_elm" formula="H" Z="1">
      <atom unit="g/mole" value="1.00794e-19"/>
<material name="Vacuum">
     <D unit="g/cm3" value="1e-41"/>
     <fraction n="1" ref="HYDROGEN_elm"/>
<element name="TUNGSTEN_elm" formula="W" Z="74">
     <atom unit="g/mole" value="1.8384e-17"/>
<material name="W">
     <D unit="g/cm3" value="1.9300000000000002e-15"/>
     <fraction n="1" ref="TUNGSTEN_elm"/>
<element name="CARBON_elm" formula="C" Z="6">
      <atom unit="g/mole" value="1.2010699999999999e-18"/>

Can someone please confirm and fix? Using ROOT several versions back does not have this problem.


Hi Andrey,
I cannot pin where the problem comes from, but could you check the transient values of material densities in the ROOT geometry? Something like: gGeoManager->GetListOfMaterials()->Print() Check if the values match the ones you see in the gdml file.

I inserted the code you asked for right before making GDML export and it seems ok:

Mixture Glass Aeff=22.5531 Zeff=11.2055 rho=2.5 radlen=1.05297 intlen=3.87926 index=1
Element #0 : CA Z= 20.00 A= 40.08 w= 0.061
Element #1 : MG Z= 12.00 A= 24.30 w= 0.025
Element #2 : NA Z= 11.00 A= 22.99 w= 0.102
Element #3 : O Z= 8.00 A= 16.00 w= 0.468
Element #4 : SI Z= 14.00 A= 28.09 w= 0.344
Mixture LYSO Aeff=133.283 Zeff=54.6427 rho=7.1 radlen=0.122234 intlen=2.14567 index=2
Element #0 : LU Z= 71.00 A=174.97 w= 0.714
Element #1 : O Z= 8.00 A= 16.00 w= 0.181
Element #2 : SI Z= 14.00 A= 28.09 w= 0.064
Element #3 : Y Z= 39.00 A= 88.91 w= 0.040


Maybe it will help:
I have checked root 6.20/08, and GDML is fine for that version.

Hi Andrey,
There is currently an inconsistency in the GDML export class when using Geant4 units (default). I’m fixing this, but meanwhile, to be able to export correctly the materials, you can use:


Thank you Andrei!

This issue is fixed now in the master by changing the default to ROOT units, see:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.