Describing Multilayer or Nested Geometry

Dear Geant4 community,

I am trying to model the Earth’s atmosphere by dividing it into 100–1000 concentric shells of either equal thickness or equal mass column density (the number of layers and splitting method are passed to my DetectorConstruction constructor). I implemented this by defining each layer as a G4Sphere with its own Rmin and Rmax, parameterizing their radii and air density via G4VPVParameterisation, and inserting them into the world volume using G4PVParameterised.

Now I wish to refine this model to account for the Earth’s ellipsoidal shape.

The problem is that Geant4 does not provide a primitive for a hollow ellipsoidal shell. If I try to build one with G4SubtractionSolid, I cannot parameterize it with G4VPVParameterisation, because that class has no virtual ComputeDimensions overload for G4SubtractionSolid (and even if it did, G4SubtractionSolid exposes no public API to query or modify its child solids).

If I were to use G4Ellipsoid solids directly without defining them as shells (i.e. just parametrizing solid ellipsoids and embedding them in the world volume), this would inevitably lead to overlapping volumes, and I’m unsure if Geant4 would handle this correctly.

The simplest solution, which I know would definitely work, is to define 100-1000 individual G4Ellipsoid volumes and nest them manually, but that sacrifices all the performance benefits of G4PVParameterised.

My question:
Is there a way to describe the required ellipsoidal multilayer geometry while keeping the simulation code as fast and efficient as possible? As I understand it, I need to avoid unnecessary duplication of logical volumes. I would also be interested to learn how others have implemented “layered” structures (e.g. stacks of hollow boxes), for which no built‑in hollow primitive exists either.

Thank you for any guidance or examples!

1 Like

Have you compared the performance of these solutions? How different is their performance? It would be interesting to know.

I believe that the performance of the solution with nested shapes should be good enough. The only thing I would recommend is to use G4Orb instead of G4Sphere for the spherical model case.

1 Like