KAHIBARO
Discord Login Register

8.4 Repeated Geometry

Replica volumes

In many detector designs you need to repeat identical elements in a very regular pattern, for example a stack of layers, or a row of crystals. Creating each element as a separate volume is possible, but it is verbose and often inefficient. Geant4 offers replica volumes to describe such regular arrays with a single logical description.

A replica volume is created when you divide a mother volume into identical slices along one dimension or in a regular pattern. Each slice is a replica. All replicas share the same logical volume, so they all have the same shape and material. You cannot change the material or shape of a single replica independently. Replica volumes are built to be extremely efficient in both memory and navigation, which is why they are preferred for simple regular structures.

To use replicas, you first define the solid and logical volume for the repeating element. The full size of the logical volume must match the size of one replica, not the whole mother. Then you place the replicas into the mother volume using the appropriate replica placement class. The mother volume will be subdivided automatically. The local coordinate system of each replica is defined so that its center lies at the center of that slice within the mother.

There are three main types of replication: linear, radial and angular. In a linear replication, you divide a mother volume into equal slabs along one Cartesian axis $x$, $y$, or $z$. In a radial replication, you divide a cylindrical mother volume into shells along the radius. In an angular replication, you split a cylindrical mother into wedges around the azimuthal angle.

Geant4 uses the number of replicas, their thickness, and the size of the mother volume to define the division. The total size of the mother must be compatible with the number of replicas and the thickness, otherwise the division will not be valid. During tracking, Geant4 determines which replica a point belongs to by an index. This replica index can be retrieved in user code, for example in a sensitive detector, and is often used as a detector ID. This is the key to building efficient detector arrays where each physical channel corresponds to one replica index.

You should use replica volumes when the geometry is strictly regular and can be described as identical slices or wedges. Replica placement is not flexible enough when each copy needs an arbitrary rotation or position, or when only some copies should exist. In that case, parameterized volumes are more appropriate. Another limitation is that replicas cannot overlap their mother volume boundaries or be used as world volumes. They must be placed inside a valid containing volume.

Replica volumes require that all replicas:

  1. Share the same logical volume, shape, and material.
  2. Fill the mother volume exactly without overlaps or gaps.
  3. Differ only by their index and position inside the mother.

When implemented correctly, replicas provide a very compact and fast way to model detectors such as calorimeter layers, segmented scintillators, and many similar systems.

Parameterized volumes

Sometimes detector layouts are regular in structure but still need some variation between elements. You might want a row of crystals with different lengths, or a grid of cells with slightly different dimensions. In other cases the geometry is still repeated, but defined by some analytical rule instead of simple equal subdivisions. Parameterized volumes address this need.

A parameterized volume uses a single logical volume as a template, then uses a user defined parameterization class to specify the position, rotation, and optionally the size of each copy. During navigation, Geant4 asks the parameterization for the properties of the current copy, using its copy number as input. The same code can then define hundreds or thousands of volumes, without each one being written explicitly in the geometry description.

To create parameterized volumes, you start by defining the solid and logical volume for the type of cell you want to repeat. This solid can be scalable along one or more dimensions that you plan to vary, for example the length of a box. Next, you write a parameterization class that implements the appropriate Geant4 base, and in this class you implement methods that compute transforms and, if needed, dimensions for a given copy index. When you place the parameterized volumes into a mother volume, you specify how many copies you want and along which axis or pattern they should be generated. Geant4 then uses your parameterization every time it needs to know where a particular copy is, or how big it is.

Parameterization is more flexible than replication because you can give each copy a different size or orientation, as long as all copies still share the same logical volume type. The material is usually common to all copies, although some advanced use cases can modify it. The number of copies is fixed when you define the parameterization. Within that range of copy numbers you are free to implement almost any mapping from index to geometry properties that is convenient.

In a detector context parameterized volumes are particularly useful for constructing non uniform calorimeters, grids with varying cell sizes, or arrays where some dimensions follow an analytical function. Each hit recorded inside a parameterized volume can still be associated with a unique copy number, which again can be used as a detector ID. The main difference from replicas is that this ID no longer just encodes a simple equal slicing; instead, it can refer to arbitrarily positioned cells, as described in your parameterization.

There are some constraints that you must respect. All parameterized copies must remain entirely inside the mother volume, and they must not overlap each other. Geant4 assumes the parameterization describes a valid geometry, and does not automatically correct conflicts. If your parameterization formula produces overlapping volumes or volumes that extend beyond the mother boundary, you will encounter geometry errors. For that reason it is good practice to keep the parameterization logic as simple and predictable as possible, and to verify the result visually and with overlap checking.

When using parameterized volumes, always ensure that:

  1. Every copy fits completely inside the mother volume.
  2. No two parameterized copies overlap each other.
  3. All copies are described consistently by the parameterization code.

For repeated geometry in Geant4, your choice is usually between replica and parameterized volumes. Replicas offer maximum performance for strictly regular arrays. Parameterized volumes offer greater flexibility for more complex repeated structures, at the cost of slightly more user code and more care in validating the resulting geometry.

Views: 8

Comments

Please login to add a comment.

Don't have an account? Register now!