物理ボリュームを配置したい(G4PVPlacement

1auto physical_volume = new G4PVPlacement{
2    const G4Transrom3D &Transform3D,
3    G4LogicalVolume *pLogicalVolume,  // 子ボリューム
4    const G4String &pName,            // 名前
5    G4LogicalVolume *pMotherVolume,   // 親ボリューム,
6    G4bool bMany,                     // ブーリアン演算,
7    G4int aCopyID,                    // コピー番号,
8    G4bool bCheckOverlaps             // 重なり確認
9};

G4PVPlacementG4VPhysicalVolumeを具象化したクラスです。 論理物体(logical volume)を物理物体(physical volume)として配置できます。

物理ボリュームを確認したい

1auto name = physical_volume->GetName();
2auto current_volume = physical_volume->GetLogicalVolume();
3auto mother_volume = physical_volume->GetMotherLogical();
4G4int copy_number = physical_volume->GetCopyNo();
5G4bool overlaps = physical_volume->CheckOverlaps();

複数の測定器を配置したい

 1const G4int n_detectors = 10;
 2G4RotationMatrix rotation = G4RotationMatrix();
 3G4ThreeVector direction = G4ThreeVector(0.*m, 0.*m, 0.*m);
 4G4Transform3D location = G4Transform3D(rotation, direction);
 5
 6G4int z = 0;
 7for (int i = 0; i < n_detectors; i++) {
 8    z = i * 10 * cm;
 9    direction = G4ThreeVector(0.*cm, 0.*cm, z);
10    location = G4Transform3D(rotation, direction);
11    new G4PVPlacement(
12        location,
13        pDetectorLogical,
14        "Detector Logical",
15        pWorldLogical,
16        false,
17        i,    // copy number
18        true
19    )
20}

複数の測定器を配置する場合は、コピー番号(copyNo)を変更することで、異なる物理物体としてアクセスできます。 区別する必要がない場合は、同じ値でOKです。