Debugging overlapping volumes which are part of an assembly and Geant has munged the physvol names

Geant4 Version:
Geant4 version Name: geant4-10-07-patch-01 [MT] (5-February-2021)
<< in Multi-threaded mode >>
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
: NIM A 835 (2016), 186-225
Operating System:
MacOS 12.6.8

I am looking for advice on debugging some problems.

The problems are as a result of trying to use a python program that uses lxml to process a large GDML file and for a specified volume creates a directory structure with one directory per volume.

I am testing on a old gdml for CERN Alice experiment and specifying the name ‘Dipole’. As Dipole is actually an assembly in the main Alice gdml file an extra volume is created.

<volume name="rootDipole"><materialref ref="G4_AIR"/><solidref ref="WorldBox"/><physvol name="PV-Dipole"><volumeref ref="Dipole"/><positionref ref="center"/></physvol></volume>

(Similarly for sub assemblies but these are not referenced when trying to load Dipole into Geant4)

I am getting Exceptions in checking for overlapping volumes eg

-------- WWWW ------- G4Exception-START -------- WWWW -------

*** ExceptionHandler is not defined ***
*** G4Exception : GeomVol1002
      issued by : G4PVPlacement::CheckOverlaps()
Overlap with volume already placed !
          Overlap is detected for volume av_4_impr_1_DL0_pv_12:13 (G4Box)
          with av_4_impr_1_DC11_pv_5:6 (G4Tubs) volume's
          local point (463.087,-295,96.6925), overlapping by at least: 23.4067 cm 
NOTE: Reached maximum fixed number -1- of overlaps reports for this volume !
*** This is just a warning message. ***
-------- WWWW ------- G4Exception-END -------- WWWW -------

Now I know that Geant4 munges physical volumes for Assemblies.

Proceeding messages are

Checking overlaps for volume av_4_impr_1_DC11_pv_4 (G4Tubs) ... OK! 
Checking overlaps for volume av_4_impr_1_DC11_pv_5 (G4Tubs) ... OK! 
Checking overlaps for volume av_4_impr_1_DC11_pv_6 (G4Tubs) ... OK! 
Checking overlaps for volume av_4_impr_1_DC11_pv_7 (G4Tubs) ... OK! 
Checking overlaps for volume av_4_impr_1_DC12_pv_8 (G4Tubs) ... OK! 
Checking overlaps for volume av_4_impr_1_DC12_pv_9 (G4Tubs) ... OK! 
Checking overlaps for volume av_4_impr_1_DC12_pv_10 (G4Tubs) ... OK! 
Checking overlaps for volume av_4_impr_1_DC12_pv_11 (G4Tubs) ... OK! 
Checking overlaps for volume av_4_impr_1_DL0_pv_12 (G4Box) ... 

So by my reconning and looking at the Dipole_struct.xml I make
4_impr_1_DL0_pv_12 the first physvol referencing DL0

<physvol name="DL0_1" copynumber="1">
        <volumeref ref="DL0"/>
        <positionref ref="DL0_1inDCoilpos"/>
        <rotationref ref="DL0_1inDCoilrot"/>

and av_4_impr_1_DC11_pv_5 the second physvol referencing DC11 i.e.

<physvol name="DC11_2" copynumber="2">
        <volumeref ref="DC11"/>
        <positionref ref="DC11_2inDCoilpos"/>
        <rotationref ref="DC11_2inDCoilrot"/>

Looking at Dipole_define.xml

<position name="DL0_1inDCoilpos" x="-55.615730285644531" y="-244.72003173828125" z="0" unit="cm"/>
<rotation name="DL0_1inDCoilrot" x="0" y="-0" z="-61" unit="deg"/>

<position name="DC11_2inDCoilpos" x="-116.839111328125" y="-210.78335571289062" z="136.94999694824219" unit="cm"/>
<rotation name="DC11_2inDCoilrot" x="90" y="-29.000000000000011" z="-90" unit="deg"/>

My question is any advice on how I can check what I am seeing.

I strongly suspect there is a problem in my code but as the values used have been copied ( python deep copy ) of the elements in the original Alice.gdml file how come I am seeing overlaps. My understanding is CERN use Root rather than Geant4, is it less strict on overlaps?

Any other advice?

Files are available at CERN-Dipole-Test

I know the file does not look right in the FreeCAD gdml workbench but that is why I want to load into Geant4 for confirmation of what it should look like for debugging.

Okay I tried a couple of gdml files sourced from CERN and warnings about overlaps are quite common.

I had to up the size of the WorldBox solid of the root volume that was added because the extracted ‘Volume’ was an assembly and Geant4 loaded okay