Are disconnected solids resulting from Booleans valid in geant4?

I was wondering to what extent Geant4 handles disconnected solids, and whether or not they are valid constructs. It is possible to get disconnected solids from unions, intersections, and subtractions.

Consider for example a union of two spheres that are not overlapping. Mathematically this may be valid, but is it OK in geant4? And how about MultiUnions, is the behaviour the same?

How about a SubtractionSolid: a box cut in half by another box, resulting in two regions in space that are disconnected.

Or lastly, an IntersectionSolid: for example the intersection of the two ends of a horse shoe with a box.

Are these constructs valid? Is it possible to union disconnected parts with MultiUnion if it is not possible with plain Union solid? How about for subtractions? Thanks for your help!

From the documentation (
“a Boolean operation between two solids which are disjoint or far apart each other, is not a valid Boolean composition”
With MultiUnion you can have union of disconnected parts.

OK thank you, I had not found that part of the manual, that is quite clear and unambiguous.

So this is 100% explicit, a multi-union is not constrained in the way that the other three Boolean solids are? I can have a MultiUnion of arbitrarily many disconnected parts? Thank you again, I greatly appreciate your expertise.


I’d also like to clarify.

To confirm: It is ok to have a multunion of disjoint solids. e.g. multiunion of 5 solids resulting in say 2 contiguous solids.

Is it ok to then do a Boolean operation with this disjoint multiunion? e.g. intersection with solid described with a box - results in 2 disjoint contiguous solids.

Many thanks,

A MultiUnion is by definition a composite structure that does not necessarily translate to a contiguous solid. A such, it is recommended to define it as a final composition, rather using it as a component in a further Boolean operation… Still, it is possible to use it, for instance in a Boolean intersection/subtraction, provided you make really sure there’re no [part of] coincident surfaces involved in the operation, as that can lead to undefined behaviour.