Tracking with GDML Modules


I’m tracking a particle beam through a beam-pipe. In order to include a more complex model from external design (in particular the central beam-pipe in a detector), I’d like to use GDML modules.
In practice combining the plain pipe aka beamline.dgml and a more complex model aka central_chamber.gdml, as modules in a global GMDL file, say assemble.gdml:

    <material name="Vacuum" Z="1">
      <D unit="g/cm3" value="9.9999999999999998e-17"/>
      <atom unit="g/mole" value="1.008"/>

    <box name="global_solid" x="60000" y="60000" z="60000" lunit="cm" />

    <volume name="Global">
      <materialref ref="Vacuum"/>
      <solidref ref="global_solid"/>

      <physvol name="beamline" copynumber="1">
        <file name="beamline.gdml"/>
      <physvol name="central_chamber" copynumber="1">
        <file name="central_chamber.gdml"/> 

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

A first trial was successful insofar as my beam-pipe (gray elements) is combined with the external model (for simplicity just the red tube).

Exporting the geometry using TGeoManager in ROOT doesn’t crash and results in a GDML Geant can read. Hence, the Geant run also seems successful.

However, the tracking results are somewhat strange. While the beam starts in the gray elements (lower left corner of the picture), denoting their names correctly, the red pipe appears no to be recognized. Instead of upstream_beampipe the particle is apparently in the top volume, which is the world volume in beamline.gdml.

My suspicion is that the global world volumes of both GDML modules might get messed up but I am absolutely not sure, due to lack of experience. I hoped, somebody here could help.

Thanks in advance. Maybe it is an obvious problem but if not, I could provide the GDML files as well, if needed.


can you please try to specify explicitly the name of the volume you want to include, like this:


Ooops, seems that the XML code was eaten up by the editor:

<file name="beamline.gdml" volname="volume_to_include"/>

Dear Witek,

Thanks a lot for coming back to this issue. Following your suggestion, I tried specifying the volume like this:

      <physvol name="beamline">
        <file name="upstream_BPwall.gdml" volname="central_chamber"/>

I assumed that the volume specified by volname is the world volume of a child. However, the tracking in Geant (reading assemble.gdml and recognizing each module apparently in correct way) still shows only elements which are part of the last child volume integrated in assemble.gdml. It seems as if the geometry would be limited to this module.

Maybe I’m still missing something in the understanding …

Can you please send me all the GDML files?

I shared a folder on CERNBOX, let me know if it didn’t work. Thanks for having a closer look into it!


Sorry for the delay. I think I understand the problem now. Each of your files (both the top level, as well as the ones you want to assemble) contain the world volume which are big boxes (20x20x20 m).

When you combine those files, you create an overlap of those world volumes. You can see it from the Geant4 error message:

*** ExceptionHandler is not defined ***

*** G4Exception : GeomVol1002

  issued by : G4PVPlacement::CheckOverlaps()

Overlap with volume already placed !

      Overlap is detected for volume central_chamber_PV:0 (G4Box)

      with QC2L2:0 (G4Box) volume's

      local point (-6100,-4103.39,-1282.94), overlapping by at least: 3.9 m  

NOTE: Reached maximum fixed number -1- of overlaps reports for this volume !

*** This is just a warning message. ***

-------- WWWW ------- G4Exception-END -------- WWWW ———

So, when you want to include some modules from other GDML files, you should not include the whole world volume from that file (which would overlap with the rest of your geometry), but only the volume you want to place in your final geometry. This should be for instance your BeamPipe_assembly_0x205e730 (instead of central_chamber).

If you have several volumes in your modules files that you need to include, you can either do it one by one, or create some ‘envelope’ that would contain them, but making sure that it does not overlap with other included volumes.

I hope this helps. Let me know if you had other question.


Hi Witek,

No worries for the delay. Your suggestion indeed helped me to understand the problem much better. Now it seems as everything is fine when only including those volumes needed instead of their’ worlds. This point initially wasn’t perfectly clear to me.

Thanks a lot !