Error Loading GDML from Geant4

Hey there,
im quite new to Allpix and im trying to load in a geometry created in Geant4 without success.
Im creating the gdml in my Geant4 Simulation like this:

G4GDMLParser parser;
parser.Write("Test.gdml", logicWorld);

When trying to import it in allpix, i get this error:

(FATAL) [C:GeometryBuilderGeant4] Error during execution of run:
Caught Geant4 exception ReadError: Referenced volume 'world' was not found!
Please check your configuration and modules. Cannot continue.

Here is my detector config:

[detector1]
type = "cmsp1"

position = 1 1 1
orientation = 0 0 0

[world]
role = "passive"
type = "gdml"
file_name = "Test.gdml"
position = 0 1cm 3cm
orientation = 0 0 0

And here my main config:

[Allpix]
log_level = "WARNING"
log_format = "DEFAULT"
detectors_file = "detector.conf"
number_of_events = 1

[GeometryBuilderGeant4]


[DepositionGeant4]
physics_list = FTFP_BERT_EMY
particle_type = "Pi+"
source_type = "beam"
source_energy = 10MeV
source_position = 33um 66um -3cm
beam_size = 10um
beam_direction = 0 0 1
number_of_particles = 1
max_step_length = 1um



[GenericPropagation]
temperature = 293K
charge_per_step = 100

[SimpleTransfer]
max_depth_distance = 5um

[DefaultDigitizer]
threshold = 600e

[DetectorHistogrammer]

# replace by [VisualizationGeant4] to run the visualization
[VisualizationGeant4]

mode = "gui"

[ROOTObjectWriter]
exclude = DepositedCharge, PropagatedCharge

And this is my gdml (sadly as a new user i cant upload files here):

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<gdml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://service-spi.web.cern.ch/service-spi/app/releases/GDML/schema/gdml.xsd">

  <define/>

  <materials>
    <isotope N="28" Z="14" name="Si280x58a88daf6840">
      <atom unit="g/mole" value="27.9769"/>
    </isotope>
    <isotope N="29" Z="14" name="Si290x58a88daf6720">
      <atom unit="g/mole" value="28.9765"/>
    </isotope>
    <isotope N="30" Z="14" name="Si300x58a88daf6250">
      <atom unit="g/mole" value="29.9738"/>
    </isotope>
    <element name="Si0x58a88daf6890">
      <fraction n="0.922296077703922" ref="Si280x58a88daf6840"/>
      <fraction n="0.0468319531680468" ref="Si290x58a88daf6720"/>
      <fraction n="0.0308719691280309" ref="Si300x58a88daf6250"/>
    </element>
    <isotope N="31" Z="15" name="P310x58a88db5a130">
      <atom unit="g/mole" value="30.9738"/>
    </isotope>
    <element name="P0x58a88db65c10">
      <fraction n="1" ref="P310x58a88db5a130"/>
    </element>
    <material name="NotchSilicon0x58a88db6eb30" state="solid">
      <T unit="K" value="293.15"/>
      <MEE unit="eV" value="173"/>
      <D unit="g/cm3" value="2.33"/>
      <fraction n="0.99999998" ref="Si0x58a88daf6890"/>
      <fraction n="2e-08" ref="P0x58a88db65c10"/>
    </material>
    <material name="GuideSilicon0x58a88db65d50" state="solid">
      <T unit="K" value="293.15"/>
      <MEE unit="eV" value="173"/>
      <D unit="g/cm3" value="2.33"/>
      <fraction n="0.99999999" ref="Si0x58a88daf6890"/>
      <fraction n="1e-08" ref="P0x58a88db65c10"/>
    </material>
    <isotope N="10" Z="5" name="B100x58a88db5c8f0">
      <atom unit="g/mole" value="10.0129"/>
    </isotope>
    <isotope N="11" Z="5" name="B110x58a88db58f00">
      <atom unit="g/mole" value="11.0093"/>
    </isotope>
    <element name="B0x58a88db65a90">
      <fraction n="0.199" ref="B100x58a88db5c8f0"/>
      <fraction n="0.801" ref="B110x58a88db58f00"/>
    </element>
    <material name="StopSilicon0x58a88db70030" state="solid">
      <T unit="K" value="293.15"/>
      <MEE unit="eV" value="172.999999735943"/>
      <D unit="g/cm3" value="2.33"/>
      <fraction n="0.999999998" ref="Si0x58a88daf6890"/>
      <fraction n="2e-09" ref="B0x58a88db65a90"/>
    </material>
    <material name="CollectorSilicon0x58a88db6f1e0" state="solid">
      <T unit="K" value="293.15"/>
      <MEE unit="eV" value="173"/>
      <D unit="g/cm3" value="2.33"/>
      <fraction n="0.9999999992" ref="Si0x58a88daf6890"/>
      <fraction n="8e-10" ref="P0x58a88db65c10"/>
    </material>
    <material name="BulkSilicon0x58a88db6f920" state="solid">
      <T unit="K" value="293.15"/>
      <MEE unit="eV" value="173"/>
      <D unit="g/cm3" value="2.33"/>
      <fraction n="0.99999999998" ref="Si0x58a88daf6890"/>
      <fraction n="2e-11" ref="P0x58a88db65c10"/>
    </material>
    <isotope N="1" Z="1" name="H10x58a88db71030">
      <atom unit="g/mole" value="1.00782503081372"/>
    </isotope>
    <isotope N="2" Z="1" name="H20x58a88db71080">
      <atom unit="g/mole" value="2.01410199966617"/>
    </isotope>
    <element name="H0x58a88db710d0">
      <fraction n="0.999885" ref="H10x58a88db71030"/>
      <fraction n="0.000115" ref="H20x58a88db71080"/>
    </element>
    <material name="G4_Galactic0x58a88db70ef0" state="gas">
      <T unit="K" value="2.73"/>
      <P unit="pascal" value="3e-18"/>
      <MEE unit="eV" value="21.8"/>
      <D unit="g/cm3" value="1e-25"/>
      <fraction n="1" ref="H0x58a88db710d0"/>
    </material>
  </materials>

  <solids>
    <box lunit="mm" name="Notch0x58a88db7bd00" x="0.0036" y="0.0168" z="0.001"/>
    <box lunit="mm" name="Guide0x58a88db7bb10" x="0.0072" y="0.024" z="0.001"/>
    <box lunit="mm" name="Stop0x58a88db7bef0" x="0.0072" y="0.0072" z="0.001"/>
    <box lunit="mm" name="Collector0x58a88db7b920" x="0.048" y="0.048" z="0.01"/>
    <box lunit="mm" name="Bulk0x58a88d9fcf00" x="0.048" y="0.048" z="0.45"/>
    <box lunit="mm" name="world0x58a88db5b230" x="3.33333333333333" y="3.33333333333333" z="10"/>
  </solids>

  <structure>
    <volume name="Notch0x58a88db7bde0">
      <materialref ref="NotchSilicon0x58a88db6eb30"/>
      <solidref ref="Notch0x58a88db7bd00"/>
    </volume>
    <volume name="Guide0x58a88db7bbf0">
      <materialref ref="GuideSilicon0x58a88db65d50"/>
      <solidref ref="Guide0x58a88db7bb10"/>
      <physvol name="Notch0x58a88db7c100">
        <volumeref ref="Notch0x58a88db7bde0"/>
      </physvol>
    </volume>
    <volume name="Stop0x58a88db7bfd0">
      <materialref ref="StopSilicon0x58a88db70030"/>
      <solidref ref="Stop0x58a88db7bef0"/>
    </volume>
    <volume name="Collector0x58a88db7ba00">
      <materialref ref="CollectorSilicon0x58a88db6f1e0"/>
      <solidref ref="Collector0x58a88db7b920"/>
      <physvol name="Guide0x58a88db861d0">
        <volumeref ref="Guide0x58a88db7bbf0"/>
        <position name="Guide0x58a88db861d0_pos" unit="mm" x="0" y="0" z="0.0045"/>
      </physvol>
      <physvol name="Stop0x58a88db66170">
        <volumeref ref="Stop0x58a88db7bfd0"/>
        <position name="Stop0x58a88db66170_pos" unit="mm" x="0" y="0.0204" z="0.0045"/>
      </physvol>
      <physvol copynumber="1" name="Stop0x58a88db88fb0">
        <volumeref ref="Stop0x58a88db7bfd0"/>
        <position name="Stop0x58a88db88fb0_pos" unit="mm" x="0" y="-0.0204" z="0.0045"/>
      </physvol>
    </volume>
    <volume name="Bulk0x58a88db64f00">
      <materialref ref="BulkSilicon0x58a88db6f920"/>
      <solidref ref="Bulk0x58a88d9fcf00"/>
      <physvol name="Collector0x58a88daf8fc0">
        <volumeref ref="Collector0x58a88db7ba00"/>
        <position name="Collector0x58a88daf8fc0_pos" unit="mm" x="0" y="0" z="0.23"/>
      </physvol>
    </volume>
    <volume name="world0x58a88db62aa0">
      <materialref ref="G4_Galactic0x58a88db70ef0"/>
      <solidref ref="world0x58a88db5b230"/>
      <physvol name="Bulk0x58a88db87870">
        <volumeref ref="Bulk0x58a88db64f00"/>
      </physvol>
    </volume>
  </structure>

  <setup name="Default" version="1.0">
    <world ref="world0x58a88db62aa0"/>
  </setup>

</gdml>

Is there a tutorial on how to properly export geometries from Geant4 into Allpix?
Thank you for reading!

Regards
Tim

Hi @Tim ,

I am by no means an expert on this, but I still had a little play around. it seems that the world volume does not play nice when there is an 0x in the name. I haven’t investigated further than this, but I just wanted to tell you immediately that things seem to work better if you replace world0x58a88db62aa0 with e.g. worldBox in your GDML file.

A different error then appears however, concerning overlaps:

|17:31:31.474| (WARNING) [I:GeometryBuilderGeant4] Caught Geant4 exception GeomVol1002: Overlap with mother volume !
                                                             Overlap is detected for volume Collector0x58a88daf8fc0:0 (G4Box)
                                                             with its mother volume Bulk0x58a88db64f00 (G4Box)
                                                             at mother local point (0.00894271,-0.0112323,0.235), overlapping by at least: 10 um 
                                                   NOTE: Reached maximum fixed number -1- of overlaps reports for this volume !
|17:31:31.474|   (ERROR) [I:GeometryBuilderGeant4] Overlapping volumes detected.

If I move the Collector slightly (e.g. to 0.22 in z instead of 0.23) things work nicely. It’s hard to see if things turn up in the scene however, I guess because they are so small…

So, I have no general answer I’m afraid, but some investigations that may be of help

Kind regards,
Håkan