GeometryBuilderGeant4 module, passive volumes in GDML: Question/Issue

Dear ALLPIX Squared developpers & users,

I would like to implement a complex detector geometry in ALLPIX Squared using the passive volumes in GDML format of GeometryBuilderGeant4 module. Until now, I have directly coded them in the module.

The geometry consists in a sandwhich of several layers. For simplicity, I attach you the files corresponding to a geometry with just 3 passive volumes in the WorldBox (from sensor to outside):

  1. Front plate → Purple volume
  2. Titane collimator → Yellow volume
  3. Copper container → Brown volume

NB: In attached figures, the sensor is in blue, bonding is in orange and the support is in green

dialeil-detector-gdml.conf (238 Bytes)
dialeil-LEAPS.gdml.txt (12.4 KB)
dialeil-simulation.conf (4.1 KB)
materials.xml.txt (8.7 KB)

NB: To use files, please remove the “.txt” termination of “materials.xml.txt” and “dialeil-LEAPS.gdml.txt” files. These terminations have added to upload files in this topic.

If I implement in the GDML file just the first two layers, the two layers are shown by viewer:

If I implement the three layers, the second layer disappears:

Before asking you, I have tried with no success 1) to change the relative positions between layers 2) to assembly all volumes in a “assembly” volume.

Many thanks in advance for any tip or feedback. I would really appretiate it.

Best regards,

Paco

Hi @iguaz

thanks for all the info, I started looking into it. To run your example I would also need the dialeil-geometry detector model file…

Also, I fxed the forum to allow .gdml and .xml uploads :slight_smile:

Simon

Thanks, @simonspa, for starting looking at this question/issue.

I attach you the missing file (dialeil-geometry.conf):

dialeil-geometry.conf (670 Bytes)

Best regards,

Paco

Hi @iguaz

very odd indeed - I have to dig a bit deeper, up till now I only found that we get these volumes from the Geant4 GDML parser with two volumes:

|12:57:20.620|   (TRACE) [I:GeometryBuilderGeant4] Building passive material: assembly1
|12:57:20.620|   (DEBUG) [I:GeometryBuilderGeant4] Number of daughter volumes 2
|12:57:20.620|   (DEBUG) [I:GeometryBuilderGeant4] Volume 0: platePhys
|12:57:20.620|   (DEBUG) [I:GeometryBuilderGeant4] Volume 1: colPhys

…and with three volumes:

|15:25:09.688|   (DEBUG) [I:GeometryBuilderGeant4] Number of daughter volumes 3
|15:25:09.688|   (DEBUG) [I:GeometryBuilderGeant4] Volume 0: platePhys
|15:25:09.688|   (DEBUG) [I:GeometryBuilderGeant4] Volume 1: fcontPhys
|15:25:09.688|   (DEBUG) [I:GeometryBuilderGeant4] Volume 2: fcontPhys_

so something is fishy with the reader. I’ll keep digging a bit more :slight_smile:

/Simon

Hi @iguaz

after playing more with it I believe that this must be an issue with your GDML file somehow. When I swap the fcont and col volumes, I see the (previously missing) colPhys, but at the position of the fcont, so with a gap to the plate.

I have also tried wrapping them in an assembly volume

<assembly name="AssemblyVol2">
    <physvol>
    <!-- ... -->
    </physvol>
</assembly>

and placed that in the world volume, but to no avail. The examples we have in examples/gdml_reader work fine with multiple volumes and all.

Maybe in the Geant4 forums someone can help you fix this?

/Simon

Dear @simonspa,

Thanks for having dedicated some time to check my problem with GDML geometry file.

You are probably right. I will recheck the geometry, may be in a simplified way, to find the error.

Best regards,

Paco

Dear @simonspa,

I come back to you because I have found a solution to my problem, but it is modifying ALLPIX Squared code.

It is in GeometryBuilderGeant4 module, in passive_model folder, GDMLModel.hpp file.

I have just commented the following line:

                // Remove the daughter from its world volume in order to add it to the global one
                gdml_world_log->RemoveDaughter(gdml_daughter);

To illustrate the effect, I attach you the files of a complex geometry with different elements.

dialeil-simulation.conf (4.1 KB)
dialeil-detector-gdml.conf (238 Bytes)
materials.xml (8.4 KB)
dialeil-LEAPS.gdml (14.3 KB)

If the line is not commented, the log says:

|19:16:22.879|   (DEBUG) [I:GeometryBuilderGeant4] Number of daughter volumes 7
|19:16:22.879|   (DEBUG) [I:GeometryBuilderGeant4] Volume 0: platePhys
|19:16:22.879|   (DEBUG) [I:GeometryBuilderGeant4] Volume 1: fcontPhys
|19:16:22.879|   (DEBUG) [I:GeometryBuilderGeant4] Volume 2: windPhys
|19:16:22.879|   (DEBUG) [I:GeometryBuilderGeant4] Volume 3: samplePhys
|19:16:22.879|   (DEBUG) [I:GeometryBuilderGeant4] Volume 4: samplePhys_
|19:16:22.879|   (DEBUG) [I:GeometryBuilderGeant4] Volume 5: samplePhys__
|19:16:22.879|   (DEBUG) [I:GeometryBuilderGeant4] Volume 6: samplePhys___

And the visualization of the geometry is the following:

Meanwhile, if the line is commented, the log says:

|19:13:38.926|   (DEBUG) [I:GeometryBuilderGeant4] Number of daughter volumes 7
|19:13:38.926|   (DEBUG) [I:GeometryBuilderGeant4] Volume 0: platePhys
|19:13:38.926|   (DEBUG) [I:GeometryBuilderGeant4] Volume 1: colPhys
|19:13:38.926|   (DEBUG) [I:GeometryBuilderGeant4] Volume 2: fcontPhys
|19:13:38.926|   (DEBUG) [I:GeometryBuilderGeant4] Volume 3: bcontPhys
|19:13:38.926|   (DEBUG) [I:GeometryBuilderGeant4] Volume 4: windPhys
|19:13:38.926|   (DEBUG) [I:GeometryBuilderGeant4] Volume 5: ftubePhys
|19:13:38.926|   (DEBUG) [I:GeometryBuilderGeant4] Volume 6: samplePhys

And the visualization of the geometry is the following:

Best regards,

Paco

Hi @iguaz ,

very interesting issue. If I remove the line you’re pointing at, our examples start to fail, as we’re placing volumes outside their mother volume. You defined a rather large world volume in your gdml, maybe the volumes still fit into the mother volume, and that’s why it doesn’t fail in your case. This is just a hypothesis for the moment, as I didn’t have the time to test your case.

Meaning: I think for us this is the solution yet, but we’ll keep investigating. If for now it works for you, of course go ahead with the fix, there shouldn’t be much harm in it.

Cheers
Paul

Hi @iguaz

thanks for digging into this - with your additional information and the very important hint to the removal of daughters I was able to pinpoint this and fix it, see GDML: Fix Enumeration of Daughter Volumes (!726) · Merge requests · Allpix Squared / Allpix Squared

Essentially the issue is:

  • We do need to remove the volumes from their GDML world, so your option does not generally work
  • However, when removing we were changing the indices of the remaining daughters and at the end were simply reading the wrong volumes - I’m even surprised Geant4 didn’t crash or throw us an exception.

Here is your original geometry with the new code:

image

Let me know if that works for you!

/Simon

…and for reference, your updated GDML files produce this: