KAHIBARO
Discord Login Register

6.2. Solids

Geometrical shapes

Geant4 represents all detector components as geometrical solids. Every volume you place in the world starts as a solid, which defines its shape and size in 3D space. Later, this solid is combined with a material to form a logical volume, and then positioned as a physical volume.

A solid in Geant4 is purely geometrical. It has no material, no position, and no physical meaning until it is used inside a logical volume. You can think of solids as templates of shapes that you reuse for different parts of your detector.

Geant4 provides many predefined solid classes. For beginners, the most important are the basic shapes: boxes, cylinders and tubes, and spheres. More complex shapes and boolean combinations are covered elsewhere, so here we focus on the three core classes that you will use in many simple geometries.

All these solids live in the Geant4 geometry namespace and are created with new in C++. The typical pattern is:

  1. Create a solid with the desired dimensions.
  2. Use it to construct a G4LogicalVolume.
  3. Place the logical volume into the world with G4PVPlacement.

The dimensions you pass to the constructors always use the Geant4 unit system, for example cm, mm, or deg. You must include the appropriate headers, such as G4Box.hh, G4Tubs.hh, and G4Sphere.hh, in your detector construction code.

Always specify dimensions using Geant4 units, for example 5cm or 10mm. Never pass raw numbers without units. A number like 10 means 10 * CLHEP::mm only if you explicitly multiply by a unit.

`G4Box`

A G4Box represents a rectangular box or cube. It is one of the simplest and most frequently used solids in Geant4. You will often use a G4Box for the world volume, detector housings, shielding blocks, and simple detector elements.

The G4Box constructor takes the half lengths along the three Cartesian axes. This means you specify half the size in $x$, $y$, and $z$ directions. The full size of the box is therefore twice these values.

The constructor has the form:

cpp
G4Box(const G4String& name,
      G4double   halfX,
      G4double   halfY,
      G4double   halfZ);

Here:

All lengths must include units, for example 5*cm.

For example, a $10 \text{ cm} \times 20 \text{ cm} \times 30 \text{ cm}$ box can be defined as:

cpp
G4double xSize = 10*cm;
G4double ySize = 20*cm;
G4double zSize = 30*cm;
G4Box* boxSolid = new G4Box("MyBox",
                            0.5*xSize,
                            0.5*ySize,
                            0.5*zSize);

For G4Box, the constructor parameters are half lengths. If you want a box of size $L_x$, $L_y$, $L_z$, you must pass L_x/2, L_y/2, and L_z/2 to the constructor.

You will typically use this solid as:

cpp
G4LogicalVolume* boxLogic =
  new G4LogicalVolume(boxSolid, material, "MyBoxLV");

and then place it in the world geometry using G4PVPlacement in your detector construction.

`G4Tubs`

A G4Tubs solid defines a tube or cylindrical section. It can represent a full cylinder, a cylindrical shell, or a sector of a cylinder. This is useful for targets, collimators, detector layers, pipes, and many other cylindrical components.

The general G4Tubs constructor is:

cpp
G4Tubs(const G4String& name,
       G4double   rInner,
       G4double   rOuter,
       G4double   halfZ,
       G4double   phiStart,
       G4double   phiDelta);

The parameters are:

The z axis is the cylinder axis. If you want a full, solid cylinder aligned along z, you will usually write:

cpp
G4double radius   = 2*cm;
G4double length   = 10*cm;
G4Tubs* cylinderSolid = new G4Tubs("MyCylinder",
                                   0*cm,          // inner radius
                                   radius,        // outer radius
                                   0.5*length,    // half length in z
                                   0*deg,         // start angle
                                   360*deg);      // full cylinder

To create a hollow cylindrical shell, for example an outer radius of 5 cm and an inner radius of 4 cm:

cpp
G4Tubs* shellSolid = new G4Tubs("MyShell",
                                4*cm,    // inner radius
                                5*cm,    // outer radius
                                5*cm,    // half length
                                0*deg,
                                360*deg);

To create only a segment of a cylinder, for example a 90 degree sector:

cpp
G4Tubs* sectorSolid = new G4Tubs("MySector",
                                 0*cm,
                                 5*cm,
                                 5*cm,
                                 0*deg,     // start at 0
                                 90*deg);   // 90 degree span

For G4Tubs, halfZ is half the cylinder length, so the total length is 2halfZ. For a full cylinder, always use phiStart = 0deg and phiDelta = 360*deg.

You use G4Tubs in exactly the same way as G4Box in the rest of the geometry: you pass it to G4LogicalVolume with a material, then place it using G4PVPlacement.

`G4Sphere`

A G4Sphere solid describes a spherical or shell-shaped volume. It can represent a full sphere, a spherical shell, or a segment cut in polar and azimuthal angles. This can be used for spherical detectors, shielding, or source geometries.

The constructor is:

cpp
G4Sphere(const G4String& name,
         G4double   rInner,
         G4double   rOuter,
         G4double   phiStart,
         G4double   phiDelta,
         G4double   thetaStart,
         G4double   thetaDelta);

The parameters have the following meanings:

All angles must use angular units, typically deg.

For a full solid sphere of radius $R$:

cpp
G4double radius = 10*cm;
G4Sphere* fullSphereSolid = new G4Sphere("MySphere",
                                         0*cm,        // inner radius
                                         radius,      // outer radius
                                         0*deg,       // phi start
                                         360*deg,     // phi span
                                         0*deg,       // theta start
                                         180*deg);    // theta span

For a spherical shell with inner radius 9 cm and outer radius 10 cm:

cpp
G4Sphere* shellSphereSolid = new G4Sphere("MyShellSphere",
                                          9*cm,       // inner radius
                                          10*cm,      // outer radius
                                          0*deg,
                                          360*deg,
                                          0*deg,
                                          180*deg);

You can also define spherical segments by limiting the angular spans. For example, a hemisphere above the xy plane:

cpp
G4Sphere* hemisphereSolid = new G4Sphere("MyHemisphere",
                                         0*cm,
                                         10*cm,
                                         0*deg,
                                         360*deg,
                                         0*deg,     // from +z
                                         90*deg);   // down to the equator

For a full sphere, use phiStart = 0deg, phiDelta = 360deg, thetaStart = 0deg, and thetaDelta = 180deg. Remember that theta is the polar angle from the +z axis, not from the equatorial plane.

Just as with G4Box and G4Tubs, a G4Sphere is only geometry until combined with a material in a G4LogicalVolume, and then placed into your detector world as a G4VPhysicalVolume.

Views: 12

Comments

Please login to add a comment.

Don't have an account? Register now!