KAHIBARO
Discord Login Register

24.3. Creating the Shield

Choosing a Simple Shield Geometry

In this example you build a very simple shielding setup. The goal is to create a block of material between a source and an observation region so that you can study how many particles pass through.

A common and practical choice is a rectangular slab that fully covers the source area and is thick in the beam direction. In Geant4 this is easily represented with a box shape. You will place this shield between the source volume and a downstream scoring or detector volume.

The shield is just another volume in your geometry hierarchy. The world volume already exists, and you may already have a source region or vacuum gap. The shield volume will be a daughter of the world, positioned with a translation along the beam axis so that particles must pass through it.

It is helpful to agree on a simple coordinate system. For example, you can place the source near $z = -z_{0}$, the shield centered near $z = 0$, and the detector or scoring plane near $z = +z_{0}$. The exact values are unimportant, but consistency will make your later analysis and visualization easier.

Implementing the Shield Geometry

To create the shield in C++ you follow the same pattern used for any other volume: define a solid shape, define a logical volume with a material, and then place a physical volume in the world.

A typical implementation in your DetectorConstruction::Construct() method looks like this, assuming the world is already created:

cpp
// Example dimensions
G4double shieldXY = 20.0*cm;     // transverse half-size
G4double shieldThickness = 5.0*cm; // half-thickness along z
// Solid for the shield slab: full size is 2*shieldXY by 2*shieldXY by 2*shieldThickness
auto shieldSolid =
  new G4Box("ShieldSolid", shieldXY, shieldXY, shieldThickness);
// Get a material chosen elsewhere (for example "G4_Pb" or "G4_CONCRETE")
auto nist = G4NistManager::Instance();
auto shieldMaterial = nist->FindOrBuildMaterial("G4_Pb");
// Logical volume
auto shieldLogical =
  new G4LogicalVolume(shieldSolid, shieldMaterial, "ShieldLogical");
// Place the shield in the world along +z
G4double shieldZpos = 0.0*cm;  // center at z = 0
new G4PVPlacement(
  nullptr,                      // no rotation
  G4ThreeVector(0., 0., shieldZpos),
  shieldLogical,
  "ShieldPhysical",
  worldLogical,                 // assume you already have worldLogical
  false,
  0,
  true);

The shield is completely defined by its thickness, transverse size, material, and its position. For simple attenuation studies you only need one such slab. More advanced studies can add multiple layers, but those belong in the chapter about comparing different materials.

The shield geometry must not overlap the source or detector volumes. Leave a clear gap, even a small one, so that each region is well separated in space.

Aligning the Shield with the Source and Detector

For a meaningful shielding study, particles should travel from the source, through the shield, and toward the detector in a well defined direction. The relative positioning of these three elements must be consistent with how you configure the primary particle direction.

If your primary particles are emitted along the positive $z$ axis, a simple layout is:

  1. Source volume or region centered at a negative $z$ position.
  2. Shield centered around $z = 0$.
  3. Scoring or detector volume at positive $z$.

Using this convention, you might choose positions like:

cpp
G4double sourceZ = -15.0*cm;
G4double shieldZ = 0.0*cm;
G4double detectorZ = +30.0*cm;

and then, in your primary generator, set the particle direction to

cpp
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0., 0., 1.));

This alignment ensures that every emitted particle that travels straight along +z must encounter the shield before reaching the detector.

If you want to simulate a parallel beam with a finite cross section, make the shield cross section larger than the beam footprint so that particles cannot miss the shield at its edges. For an isotropic source close to the shield, many particles will miss the slab, so the measured attenuation will not correspond to a simple one dimensional slab formula; this may be interesting in itself, but you should be aware of the geometry implications.

Varying Shield Thickness

The key parameter in a shielding study is the shield thickness. To study attenuation, you will typically run several simulations with different thickness values of the same material.

In Geant4, you cannot easily resize a placed volume at runtime without rebuilding the geometry. For beginners, the most straightforward approach is to treat the thickness as a configuration parameter in your DetectorConstruction class, use that parameter when constructing the shield, and recreate the geometry whenever you need to change it.

You can provide a setter in your detector construction:

cpp
class DetectorConstruction : public G4VUserDetectorConstruction {
  public:
    DetectorConstruction();
    virtual ~DetectorConstruction();
    void SetShieldThickness(G4double val) { fShieldThickness = val; }
    virtual G4VPhysicalVolume* Construct() override;
  private:
    G4double fShieldThickness; // half-thickness
};

Then, in Construct():

cpp
auto shieldSolid =
  new G4Box("ShieldSolid", shieldXY, shieldXY, fShieldThickness);

To change the thickness between runs, either modify the value in code and recompile, or expose a UI command that calls SetShieldThickness and then issues /run/reinitializeGeometry. Introducing such commands is best described in other chapters, but the concept is that the thickness becomes a single parameter that controls the shield shape.

When you later compute transmission and attenuation, you will associate each output file or run with a particular physical thickness value, usually the full thickness $d = 2 \times fShieldThickness$.

Always keep track of whether your variable represents half-thickness (used by G4Box) or full thickness (used in analytical formulas, for example $I(d) = I_0 e^{-\mu d}$). Mixing them will give incorrect attenuation results.

Avoiding Overlaps and Debugging Placement

Incorrect placement of the shield can cause overlapping volumes with the source or detector, or can move the shield out of the beam path. Both problems will give unphysical results.

To avoid overlaps, compute positions carefully and leave small gaps between neighboring volumes. For example, if the source region extends from $z = -20$ cm to $z = -10$ cm and the shield extends from $z = -2.5$ cm to $z = +2.5$ cm, then there is a clear 7.5 cm gap between them and no overlap.

Geant4 provides built in overlap checking that you can enable using the pSurfChk flag in G4PVPlacement or with visualization commands. In the constructor above, the last argument true activates optional surface checking for that placement. If an overlap is detected, Geant4 will print warnings that help you correct the geometry.

You should also use the visualization system to draw the world, the shield, and the detector. Rotating the view and zooming in on the region where the shield sits is an effective way to confirm that particles will encounter the shield as intended. This is especially important when you move on to thicker shields or add multiple layers.

If your shielding volume overlaps with the detector or the world boundary, Geant4 geometry navigation can fail and you may see missing hits, no energy deposition, or even segmentation faults. Always check for overlaps whenever you change the shield geometry.

Preparing for Multiple Materials

Although the detailed comparison of materials belongs to the next chapter, you can already design your shield construction so that changing the material is simple. Similar to the thickness parameter, introduce a configurable material name:

cpp
void DetectorConstruction::SetShieldMaterial(const G4String& name) {
  fShieldMaterialName = name;
}

and in Construct():

cpp
auto shieldMaterial =
  nist->FindOrBuildMaterial(fShieldMaterialName);

You can then build shields of lead, aluminum, or concrete simply by choosing different material names before you construct the geometry. This structure makes your shielding studies systematic, since each run will use the same geometry except for the one parameter you change, such as thickness or material.

With the shield geometry in place, correctly aligned, and parameterized by thickness and material, you are ready to simulate how many particles are transmitted and to use those results to calculate transmission and attenuation.

Views: 6

Comments

Please login to add a comment.

Don't have an account? Register now!