GEANT4 visualization taking a lot of time to load

Please fill out the following information to help in answering your question, and also see tips for posting code snippets. If you don’t provide this information it will take more time to help with your problem!

_Geant4 Version 11.2.1
_Operating System: macOS Senoma

Hello, I am running a Geant4 example that is working well and the visualization is opening up.
The simulation does G4SubtrationSolid of many tubes from a solid as in the picture below. But when I want to increase the number of tubes the code works and all and there are no overlaps so the for loops are correct. But the visualization takes a really long time to open. The UI session opens up but it is only white and is processing.

Is there away to make the process faster? Something I can edit in my vis.mac or any other way in the DetectorConstruction to make the visualization open faster for more complex geometry?

Thank you.


This sounds like a case when it is better to use “mother-daughter”, rather than Boolean subtraction. I.e., simply place the hollow rubes inside the mother volume.

The problem is in the way we convert a Boolean solid into a polyhedron for visualisation. It is fraught with difficulties, rounding errors, etc., especially if there are many subtractions. You may be assured, it does not affect the tracking. But using mother-daughter is more performant anyway, since it can take advantage of geometry voxelisation.


Thank you for the help.
Wouldn’t that cause overlaps? I want to basically create a G4Solid of Plexiglass and take out some the cylindrical shape and fill it with Air. If I simply place the G4Tubs of air inside the Plexiglass that would cause overlaps wouldn’t it? Would that be okay? Because I don’t want the particle beam to interact with the plexiglass if it enters through the air columns.

Thank you John.


No, it’s fine. Just put air cylinders inside the plexiglass. (Specify their mother as the Plexiglas volume, not the same mother as that of the plexiglass - plexiglass volume in the world (say), air cylinders in the plexiglass.) That’s how Geant4 works - its most efficient geometry mode. The hierarchical structure of Geant4 geometry makes tracking very efficient.

The air cylinders should, of course, have the same length as the plexiglass (in the appropriate dimension). The material of a daughter replaces the material of the mother, so it’s a sort of subtraction. It leads to a very thin “skin” where the end of the cylinder is coincident with the plexiglass surface. If you visualise it in surface mode, the plexiglass will obscure the cylinders - wireframe mode will show them, Nevertheless, particles will be tracked correctly, the “skin” will be ignored.


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