KAHIBARO
Discord Login Register

7.5. Geometry Overlap

Detecting overlaps

In complex GATE geometries, volumes can accidentally occupy the same space. This is called a geometry overlap. Overlaps are dangerous, because Geant4 assumes that every point in space belongs to a single well defined volume. If two or more volumes share the same region, particle tracking becomes ambiguous and results, such as dose or detector response, can be unreliable.

In GATE, overlaps are detected using the underlying Geant4 geometry checks. When you build a simulation, Geant4 tests whether a new volume intersects any existing volume that is not its parent or child. These checks can be global, over the whole geometry, or local, around a specific volume that you suspect is problematic.

In practice, you usually rely on two tools to detect overlaps: text reports in the terminal, and 3D visualization. When overlaps are present, Geant4 prints messages indicating which physical volumes intersect, and often gives an approximate location. You should read these messages carefully, because they show the names of the volumes. Good naming conventions for your volumes help a lot when you need to interpret these reports.

Visualization is equally important. By enabling geometry visualization, then zooming and rotating, you can often see where two solids pass through each other or where a volume sticks out of its parent. Viewing semi transparent shapes is especially effective for this. If a detector block should exactly touch a neighbor but in the viewer they clearly penetrate each other, that is a sign of overlap or at least a suspicious placement.

Random test points are another common method to detect overlaps. Internally, Geant4 can generate many points on each volume surface and check whether they violate the geometry hierarchy. In GATE configurations, some overlap checks give a number of test points per volume. More test points increase the chance of finding small overlaps, but also slow down initialization. For simple learning examples, a modest number is enough, while for a final scanner model you may want to increase it and run a full check.

You should be aware that very small numerical overlaps, on the order of $10^{-9}$ m, can be caused by floating point rounding. Geant4 uses a small tolerance region, often called a “tolerance” or “surface thickness”, to decide whether something is a real overlap or just numerical noise. Messages about tiny overlaps close to this tolerance may still be harmless, but systematic, large overlaps are never acceptable.

Whenever you change any dimension, repetition pattern, or rotation, run the geometry overlap checks again. Adding nested volumes or complicated boolean solids, such as unions and subtractions, can easily create hidden overlaps that only appear at certain angles or positions. Simulation problems that are hard to explain, like particles getting stuck, very slow tracking, or strange dose patterns, often trace back to undetected geometry overlaps.

Important: Always check for geometry overlaps after modifying your geometry. Overlaps can break the assumption that every point belongs to exactly one volume and can seriously corrupt tracking, dose, and detector results.

Preventing invalid geometries

Preventing overlaps is easier than debugging them. The main idea is to design your geometry so that volumes either clearly share boundaries or clearly have a margin between them. Avoid relying on exact floating point equalities for critical alignments. For example, when repeating crystals to fill a detector block, match the spacing to the crystal size by simple arithmetic and avoid accumulated rounding from many manual calculations.

Consistent parent child relationships help to keep your geometry valid. Every volume is placed inside a parent volume, and its full shape must remain inside that parent. If a child extends even slightly beyond the parent walls, you create an invalid geometry. Before adding a new child volume, check its half lengths and its placement. The sum of its half length in a given direction and its absolute coordinate in that direction must be strictly smaller than the parent half length, otherwise it will poke out.

A small numerical safety margin is often useful. Instead of placing two boxes so that their faces exactly touch, you can separate them by a tiny distance, smaller than any physical scale of interest but larger than typical numerical uncertainty. For instance, if your detector crystals are several millimeters thick, a spacing of $0.001$ mm between neighboring faces is negligible physically but helps avoid ambiguous boundaries.

Rotations need extra care. When you rotate a volume, its effective extent in each axis changes. If you compute positions assuming the unrotated size, a rotated module may end up passing through neighboring volumes or the scanner ring. For ring geometries, such as PET scanners, first confirm the radius that keeps all modules inside the world, then derive positions from that radius using simple trigonometric expressions. Test a single module with visualization, then add repetition only after you are sure it fits.

Boolean solids require particular attention. When you create a new solid as a union, intersection, or subtraction of other shapes, the resulting boundary surfaces can be complex. If two boolean solids share the same base shape and you place them too close, the resulting solids may overlap in unexpected ways. To avoid this, try to build boolean shapes that use slightly shifted or padded components so that the final solid is clearly distinct from its neighbors.

Good parameterization also helps prevent invalid geometries. Instead of hard coding numbers scattered in your script, define a few key parameters, such as ring radius, block size, number of modules, and crystal pitch, and derive every position and dimension from them. This approach reduces the risk of inconsistent values. It also makes it easier to adjust a single parameter, for example the ring radius, and know that the whole layout will update coherently.

Whenever you discover an overlap, adjust the dimensions or positions at the level of the underlying parameters, not by inserting arbitrary corrections for a single volume. Patch fixes may remove one visible overlap but introduce others in regions that you have not inspected. A clear mathematical layout, combined with careful use of margins, usually gives a geometry that is both valid and easier to maintain.

Finally, always validate changes step by step. Begin with a simple geometry, such as a world and one detector module. Check for overlaps and inspect it visually. Then add repetition or additional structures in small increments. This incremental strategy makes it much easier to identify which specific change introduced an invalid geometry, and it keeps your simulation more robust as it grows.

Views: 15

Comments

Please login to add a comment.

Don't have an account? Register now!