Basic Geometrical Shapes
Table of Contents
Boxes
Geant4 represents every piece of detector geometry as a solid shape. For simple geometries, boxes are often the first and most useful building block. A box in Geant4 is defined by the class G4Box.
A G4Box represents a rectangular solid with three half lengths. When you construct it, you specify the size along each Cartesian axis as half the full dimension. If you want a box that is $X$ by $Y$ by $Z$ in size, you pass $X/2$, $Y/2$, and $Z/2$ (with units) to the constructor.
A typical constructor call looks like:
auto solidBox = new G4Box("MyBox",
5.0*cm, // half length in X
2.5*cm, // half length in Y
1.0*cm); // half length in ZIn every Geant4 solid constructor that uses lengths, the arguments are half lengths, not full sizes. Forgetting this will create volumes that are twice the intended size.
The first argument is a name string used only for identification and debugging. It does not affect the physics. The second, third, and fourth arguments are the half lengths in the $x$, $y$, and $z$ directions, given in Geant4 units.
Choosing box dimensions is often guided by the detector design. For example, a planar silicon sensor can be modeled as a thin box with a large area and small thickness, while a shielding block can be modeled as a thick, wide box positioned around a sensitive volume. Because G4Box is so simple, it is also a convenient starting point for testing geometry placement and overlaps before introducing more complex shapes.
Once defined, your G4Box solid is combined with a material in a logical volume, then placed in the world or inside another volume, as covered in the chapters on logical and physical volumes.
Cylinders
Cylindrical shapes such as detector barrels, targets, and shielding pipes are modeled with the class G4Tubs. This solid represents a tube segment defined in cylindrical coordinates. It can describe both full cylinders and hollow tubes, as well as partial angular sections.
The basic G4Tubs constructor has the form:
auto solidTubs = new G4Tubs("MyTube",
rInner,
rOuter,
halfLengthZ,
startPhi,
deltaPhi);Each argument has a clear geometric meaning:
| Parameter | Meaning | Typical units |
|---|---|---|
rInner | Inner radius, 0 for a solid cylinder | mm, cm |
rOuter | Outer radius of the cylinder | mm, cm |
halfLengthZ | Half of the cylinder length along the $z$ axis | mm, cm |
startPhi | Starting azimuthal angle | deg, rad |
deltaPhi | Angular span of the tube | deg, rad |
To create a full solid cylinder of radius $R$ and total length $L$, you use an inner radius of zero, an outer radius of $R$, a half length of $L/2$, and angular values corresponding to a full circle. For example:
auto solidCylinder = new G4Tubs("MyCylinder",
0.0*cm, // inner radius
5.0*cm, // outer radius
10.0*cm, // half length in Z
0.0*deg, // start angle
360.0*deg); // total angle
A hollow tube, such as a pipe or a detector ring, is created by giving a nonzero inner radius that is smaller than the outer radius. A partial ring can be defined by choosing a deltaPhi smaller than $360^\circ$. This technique is useful for modeling sectors or wedges of cylindrical detectors.
You must always respect the condition $r_{\text{inner}} < r_{\text{outer}}$ and use half the total cylinder length as halfLengthZ. Incorrect ordering of radii or mixing full length with half length will produce invalid geometry.
Cylindrical solids are typically aligned along the global $z$ axis by default. If your detector concept uses a different orientation, you adjust the orientation when you place the logical volume, using rotations in the placement step.
Spheres
Spherical and shell-like geometries are represented by the G4Sphere class. This solid describes a spherical shell or a full sphere, and can be restricted in both polar and azimuthal angles. You can model simple spheres, spherical detectors, or partial spherical segments.
The constructor has the form:
auto solidSphere = new G4Sphere("MySphere",
rInner,
rOuter,
startPhi,
deltaPhi,
startTheta,
deltaTheta);The arguments describe:
| Parameter | Meaning | Typical units |
|---|---|---|
rInner | Inner radius, 0 for a solid sphere | mm, cm |
rOuter | Outer radius of the sphere or shell | mm, cm |
startPhi | Starting azimuthal angle around the $z$ axis | deg, rad |
deltaPhi | Azimuthal angular span | deg, rad |
startTheta | Starting polar angle from the positive $z$ axis | deg, rad |
deltaTheta | Polar angular span | deg, rad |
For a complete solid sphere of radius $R$, you set the inner radius to zero, the outer radius to $R$, and cover the full angular range in both $\phi$ and $\theta$:
auto solidFullSphere = new G4Sphere("FullSphere",
0.0*cm, // inner radius
5.0*cm, // outer radius
0.0*deg, // start phi
360.0*deg, // delta phi
0.0*deg, // start theta
180.0*deg); // delta theta
A spherical shell is obtained by choosing a nonzero inner radius smaller than the outer radius. Restricting deltaTheta and deltaPhi allows you to model spherical segments, like domes or caps. For example, setting startTheta = 0 and deltaTheta = 90*deg produces a spherical cap that covers the region from the positive $z$ axis down to the equator.
When using G4Sphere, the radii must satisfy $r_{\text{inner}} < r_{\text{outer}}$, and the angular intervals must be chosen within the conventional ranges, typically $\phi$ between $0$ and $360^\circ$ and $\theta$ between $0$ and $180^\circ$. Invalid combinations lead to incorrect or empty volumes.
Spherical solids are particularly useful when you want to model isotropic environments, spherical shielding, or detectors that surround a source in all directions. As with other shapes, the sphere is combined with a material and placed as part of the overall geometry.
Cones
Conical and tapered geometries appear frequently in collimators, mechanical supports, and focusing structures. In Geant4, these shapes are represented by the G4Cons class, which describes a frustum of a cone that can be full or partial in angle, and can also be hollow.
The general constructor is:
auto solidCone = new G4Cons("MyCone",
rInner1,
rOuter1,
rInner2,
rOuter2,
halfLengthZ,
startPhi,
deltaPhi);The parameters have the following meaning:
| Parameter | Meaning | Typical units |
|---|---|---|
rInner1 | Inner radius at the negative $z$ end | mm, cm |
rOuter1 | Outer radius at the negative $z$ end | mm, cm |
rInner2 | Inner radius at the positive $z$ end | mm, cm |
rOuter2 | Outer radius at the positive $z$ end | mm, cm |
halfLengthZ | Half of the total length along the $z$ axis | mm, cm |
startPhi | Starting azimuthal angle | deg, rad |
deltaPhi | Angular span of the cone | deg, rad |
A simple solid cone, narrowing from a larger base at negative $z$ to a smaller top at positive $z$, can be defined by setting all inner radii to zero and choosing different outer radii at each end:
auto solidFullCone = new G4Cons("FullCone",
0.0*cm, // inner radius at -Z
5.0*cm, // outer radius at -Z
0.0*cm, // inner radius at +Z
2.0*cm, // outer radius at +Z
10.0*cm, // half length in Z
0.0*deg, // start phi
360.0*deg); // total angle
To create a hollow conical shell, for example for a collimator, you give nonzero inner radii at one or both ends and ensure that the inner radii remain smaller than the corresponding outer radii. By restricting deltaPhi, you can define a conical sector, which is useful for wedge-shaped components.
For G4Cons, you must always satisfy $r_{\text{inner}i} < r_{\text{outer}i}$ at each end ($i = 1, 2$), and use half the total cone length as halfLengthZ. Violating these constraints gives invalid or inverted geometry.
Cones are often aligned with the $z$ axis in their local coordinate system. As with other primitives, if the detector design requires a different orientation, you rotate the logical volume at placement time. By combining G4Cons with boxes, cylinders, and other basic shapes, you can construct more realistic tapered structures that approximate complex mechanical designs.
Views: 11
KAHIBARO