KAHIBARO
Discord Login Register

6.5. Creating the World Volume

World dimensions

Every Geant4 geometry must live inside a single top-level volume called the world volume. This is the root of the geometry tree. All other physical volumes are placed inside the world, directly or indirectly. If something is not inside the world, Geant4 will not simulate it.

The world volume is usually defined in your DetectorConstruction::Construct() method. Conceptually, you first choose its size, then its shape, and finally create the logical and physical volumes.

The world must be large enough to contain your entire detector and any region where particles may travel. For beginners, it is common to start with a simple box-shaped world using G4Box. A typical pattern is to decide the approximate size of your detector, then make the world somewhat larger than that. For example, if your detector fits inside a 50 cm cube, you might choose a world that is 1 m on each side to allow room for escaping particles and for future additions.

You define the world solid with something like

cpp
G4double worldSizeXYZ = 1.0*m;
auto worldSolid =
  new G4Box("World", worldSizeXYZ/2, worldSizeXYZ/2, worldSizeXYZ/2);

Note that volumetric dimensions in G4Box are half-lengths in each direction, so the full size is twice the values you pass. For a 1 m cube, you specify 0.5 m half-lengths.

It is important that all your other volumes fit completely inside the world with some safety margin. If any part of a volume extends outside the world, Geant4 will produce geometry errors and tracking problems. You can use the geometry overlap checking tools described in the geometry chapters to verify that the world fully contains everything.

Although a box is the most common choice, you can also use other shapes for the world, such as a sphere or cylinder, if that better matches your problem. The same rule applies: the world must be large enough and must fully contain the entire geometry and any possible particle paths.

The world volume must be the largest volume in your simulation and must fully contain all other volumes. Its solid defines the outer boundary for all particle transport.

World material

In addition to size and shape, the world needs a material. This is the material through which any particle travels when it is not inside other detector components. The choice of world material affects scattering, energy loss, and even whether low-energy particles reach your detector, especially if the world is not vacuum.

For most detector simulations, the world material is chosen as vacuum or air. A common approach is to use a standard material from the Geant4 NIST database, created by G4NistManager. In your Construct() method, you typically obtain the world material first, then use it when creating the logical volume.

For example, to use air as the world material:

cpp
auto nist = G4NistManager::Instance();
G4Material* worldMat = nist->FindOrBuildMaterial("G4_AIR");

You then associate this material with the world solid when you create the logical volume:

cpp
auto worldLogical =
  new G4LogicalVolume(worldSolid, worldMat, "WorldLV");

Finally, you place this logical volume as the root physical volume:

cpp
auto worldPhysical =
  new G4PVPlacement(
    nullptr,              // no rotation
    G4ThreeVector(),      // at (0,0,0)
    worldLogical,         // its logical volume
    "WorldPV",            // its name
    nullptr,              // no mother (this is the world)
    false,                // no boolean operations
    0,                    // copy number
    true                  // check overlaps
  );

The world is always placed with a null mother volume, since it is the top of the hierarchy. Every other physical volume will use some logical volume as its mother that ultimately traces back to this world.

If you need an almost perfect vacuum, for example in space simulations or to reduce unwanted interactions, you can either use a predefined low-density material from the NIST manager or define your own custom vacuum material with a very low density. The choice depends on how realistic you want the environment outside your detector to be.

Always assign a valid material to the world logical volume. A missing or null material will cause serious simulation errors. For most cases, use air or vacuum as the world material to minimize unwanted interactions outside your detector.

Once the world volume is correctly defined with appropriate dimensions and material, you can start placing your detector components inside it in the later geometry building steps. The world thus provides both the physical boundary for particle tracking and the reference frame for all geometry positions.

Views: 13

Comments

Please login to add a comment.

Don't have an account? Register now!