KAHIBARO
Discord Login Register

Basic Geometrical Shapes

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:

cpp
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 Z

In 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:

cpp
auto solidTubs = new G4Tubs("MyTube",
                            rInner,
                            rOuter,
                            halfLengthZ,
                            startPhi,
                            deltaPhi);

Each argument has a clear geometric meaning:

ParameterMeaningTypical units
rInnerInner radius, 0 for a solid cylindermm, cm
rOuterOuter radius of the cylindermm, cm
halfLengthZHalf of the cylinder length along the $z$ axismm, cm
startPhiStarting azimuthal angledeg, rad
deltaPhiAngular span of the tubedeg, 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:

cpp
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:

cpp
auto solidSphere = new G4Sphere("MySphere",
                                rInner,
                                rOuter,
                                startPhi,
                                deltaPhi,
                                startTheta,
                                deltaTheta);

The arguments describe:

ParameterMeaningTypical units
rInnerInner radius, 0 for a solid spheremm, cm
rOuterOuter radius of the sphere or shellmm, cm
startPhiStarting azimuthal angle around the $z$ axisdeg, rad
deltaPhiAzimuthal angular spandeg, rad
startThetaStarting polar angle from the positive $z$ axisdeg, rad
deltaThetaPolar angular spandeg, 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$:

cpp
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:

cpp
auto solidCone = new G4Cons("MyCone",
                            rInner1,
                            rOuter1,
                            rInner2,
                            rOuter2,
                            halfLengthZ,
                            startPhi,
                            deltaPhi);

The parameters have the following meaning:

ParameterMeaningTypical units
rInner1Inner radius at the negative $z$ endmm, cm
rOuter1Outer radius at the negative $z$ endmm, cm
rInner2Inner radius at the positive $z$ endmm, cm
rOuter2Outer radius at the positive $z$ endmm, cm
halfLengthZHalf of the total length along the $z$ axismm, cm
startPhiStarting azimuthal angledeg, rad
deltaPhiAngular span of the conedeg, 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:

cpp
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

Comments

Please login to add a comment.

Don't have an account? Register now!