KAHIBARO
Discord Login Register

26.6. Dividing the Phantom into Slices

Why Divide the Phantom into Slices?

In a proton beam in water simulation, the central observable is the depth dose curve, which describes how much energy the protons deposit as they penetrate deeper into the water. To obtain this curve you must know where, along the beam axis, the energy deposition occurs.

A homogeneous water phantom made of a single volume can tell you the total energy deposition, but it cannot tell you how the dose varies with depth. To get a depth dependent dose, you divide the phantom into many thin slices along the beam direction and record the energy deposited separately in each slice. Each slice then behaves like a small voxelized detector element.

For absolute beginners, the key idea is simple. You keep the same physical phantom size and material, but you implement it as a set of repeated sub volumes, each with its own copy number or index. Later, you use these indices to associate energy depositions with specific depths and build the depth dose profile.

Important: To obtain a depth dose curve, the water phantom must be segmented along the beam axis, and energy must be accumulated separately in each segment.

Choosing the Axis and Slice Granularity

In a typical proton beam in water example, the beam travels along one of the coordinate axes, most commonly the z axis. The phantom is then sliced along the same axis, so that each slice spans a small interval in z but covers the full transverse cross section.

You need to choose both the total phantom length and the number of slices. If the phantom has a physical length $L$ and you want $N$ slices, the thickness of each slice is
$$
\Delta z = \frac{L}{N}.
$$

Thin slices, with smaller $\Delta z$, give you a finer depth resolution and a more detailed Bragg peak shape, but they also increase memory usage and the number of volumes in your geometry. For a first example, a few hundred slices are usually enough to see the Bragg peak clearly without making the geometry overly complex.

Rule of thumb: Choose the slice thickness small compared to the expected width of the Bragg peak, but not so small that you create thousands of slices unnecessarily.

Implementing Slices with Replica Volumes

For a simple, regular segmentation of the water phantom into identical slabs, the most convenient technique is to use replica volumes. Replica volumes are created from a single parent logical volume and are automatically repeated along one axis, each with the same shape and material.

The typical structure for a proton in water example is:

  1. A world volume that contains everything.
  2. A water phantom logical volume placed inside the world.
  3. A set of water slices, defined as replicas, that fill the phantom along the beam axis.

Each slice is not defined as a separate logical volume in the sense of having different materials or shapes. Instead, you define one logical volume that corresponds to a single slice, and then use a replica placement class to repeat it along the chosen axis while filling the phantom.

In code, this is usually done by defining the phantom as a solid box, then defining a smaller box for the slice, and finally using a class like G4PVReplica to stack the slices along, for example, the z axis. The replica constructor takes the parent logical volume, the daughter logical volume representing one slice, the axis along which to replicate, the number of slices, and the slice thickness.

Since replica slices inherit the material and geometry from their logical volume definition, you do not need to define many distinct materials or solids. Geant4 automatically gives each slice a copy number, from 0 up to $N - 1$, that identifies its position along the axis.

Key point: Use replica volumes for uniform, regularly spaced slices. Geant4 assigns each slice a unique copy number that you can use later to map energy deposition to depth.

Alternative: Parameterized Slices

Replica volumes are perfect for equal width slices, but sometimes you might want non uniform segmentation. For example, you might refine the slice thickness near the Bragg peak region while keeping thicker slices elsewhere.

For such cases, Geant4 offers parameterized volumes. Parameterized volumes allow you to define the position, shape, and size of each slice using a user defined parameterization class. Inside this class, you implement methods that are called for each copy of the volume and that set the translation, rotation, and optionally the dimensions.

In a proton beam in water simulation for beginners, using parameterization is more advanced than necessary, but it is useful to know that it exists. A parameterization gives you flexibility to:

Vary the slice thickness with depth.
Implement non planar or irregular segmentation, if ever needed.
Change the segmentation parameters using configuration variables rather than hard coded values.

The basic usage pattern is to derive from a G4 parameterization base class, define how each slice is placed and sized, and then place a single parameterized volume instance inside the phantom. Geant4 treats this as many virtual volumes, each identified by the copy number passed to the parameterization methods.

Remember: Parameterized volumes can provide non uniform slice thickness and more control, but they require a custom parameterization class and are conceptually more complex than replicas.

Assigning Copy Numbers and Indexing Slices

Whether you use replicas or parameterized volumes, each slice in the phantom must be uniquely identifiable. Geant4 automatically provides this by assigning each physical slice volume a copy number.

For a simple replica along the z axis, the copy number is an integer that increases in order along the axis. For example, if you have $N$ slices, they will have copy numbers from 0 to $N - 1$. The physical meaning of the copy number is your depth bin index. Given the phantom origin and the slice thickness, you can convert a copy number $i$ into a physical depth $z_i$ using
$$
z_i = z_{\text{phantom\_start}} + \left(i + \frac{1}{2}\right)\Delta z,
$$
if you want the depth of the center of slice $i$.

This mapping is not handled automatically. You will use it later in your analysis code when you create the depth dose curve. The important part at the geometry level is that each slice has a copy number that can be queried from the step or touchable information in your sensitive detector or stepping action.

Critical: The slice copy number is your depth index. You must retrieve it from the step information to know which slice received a given energy deposition.

Connecting Slices to Energy Deposition

Once the phantom is divided into slices, you can treat each slice volume as a detector element that collects energy. There are two common approaches in Geant4 to connect the geometry to the scoring of energy deposition.

One approach is to assign a sensitive detector to the logical volume representing the slices. In this case, every time a step deposits energy in a slice, the ProcessHits method of your sensitive detector is called. Using the slice copy number, you can record the energy in a hit or directly accumulate it into an array indexed by the copy number.

Another approach is to use a stepping action. In the stepping action, you check whether the current step is inside the phantom or specifically inside a slice logical volume. If so, you get the pre step point touchable, extract the slice copy number, and then add the step's total energy deposit to an accumulator for that slice in your event or run level data structure.

Both approaches rely on the division of the phantom into slices during geometry construction. From the point of view of the tracking, the important difference between a single volume and many slices is that now each step can be associated with a unique segment index along the depth.

In a proton beam in water example, a typical pattern is to maintain an array or vector of size $N_{\text{slices}}$ in the run or event action. For each step in a slice, you add the deposited energy to the corresponding element. When the run finishes, you have the total energy deposited per slice, from which you can compute dose per depth bin.

Essential link: Slicing the phantom by geometry is only useful if you also use the slice copy numbers to accumulate energy deposition separately for each slice.

Practical Considerations for the Proton in Water Example

In the context of the proton beam in water practical example, the slicing strategy must be designed to support later steps in the chapter sequence, namely calculating depth dose and observing the Bragg peak.

Choose the phantom dimensions so that the beam stops well inside the water, with some margin beyond the Bragg peak. Then choose the number of slices such that the Bragg peak region is sampled by multiple slices. If you know the approximate range of the proton energy you use, you can estimate the required phantom depth using range tables or reference data, and then decide the slice thickness.

Since the phantom is uniform water, each slice has the same material, and the variation in energy deposition across slices is purely due to physics, not geometry or material changes. This simplifies interpretation. You can later normalize the per slice energy by the slice volume and number of primary protons to get a depth dose curve in dose units, but this belongs to the subsequent chapters on recording energy deposition and calculating depth dose.

For beginners, the most straightforward implementation is:

Define the phantom world and water volume.
Use a replica or similar mechanism to divide the water volume into thin slabs along the proton beam axis.
Ensure that your user actions or sensitive detectors make use of the copy numbers of these slabs to bin the deposited energy by depth.

By structuring the water phantom in this way, you prepare the simulation to produce the classic Bragg peak distribution that characterizes proton interactions in matter.

Views: 9

Comments

Please login to add a comment.

Don't have an account? Register now!