PMTを作りたい(SetupPmtWindow

 1G4LogicalVolume *SetupPMT()
 2{
 3    // パラメーター設定
 4    G4String logical_name{"PMTWindow"};
 5    G4String material_name{"G4_PLEXIGLASS"};
 6    G4double radius{3.81 * cm};  // 3in.管
 7    G4double thickness{1.0 * mm};
 8
 9    // 形状を定義
10    // PMTの入射窓を、平たい円柱で作成
11    G4double r_min{0. * cm};
12    G4double r_max{radius};
13    G4double half_z{0.5 * thickness};
14    G4double s_phi{0. * deg};
15    G4double d_phi{0. * deg};
16
17    auto solid = new G4Tubs{
18        "pmtSolid",
19        r_min,    // 内径
20        r_max,    // 外径
21        half_z,   // 高さ(厚み)
22        s_phi,    // sphi,
23        d_phi,    // dphi,
24    };
25
26    // 材料を定義
27    // 入射窓はプレキシガラス(アクリル)に設定
28    G4NistManager *nm = new G4NistManager::Instance();
29    auto material = nm->FindOrBuildMaterial("G4_PLEXIGLASS")
30
31    // 論理ボリュームを定義
32    auto logical = new G4LogicalVolume(
33        solid,      // G4VSolid
34        material,   // G4Material
35        name,      // 名前(引数で指定)
36    )
37
38    return logical;
39}

光電子増倍管(PMT)の入射窓だけを作成しました。 PMTに入射した光子の数を知りたい場合は、G4SensitiveDetectorを追加し、データを残す必要があります(あとで追加する)

PMTを配置したい

 1G4LogicalVolume* SetupPmtArray()
 2{
 3    // 親ボリューム
 4    auto container = // 親ボリュームを作成する
 5
 6    // 子ボリューム = PMTを準備する
 7    auto element = SetupPmtWindow();
 8
 9    // PMTを5本並べる
10    std::vector<int> elements{101, 102, 103, 104, 105};
11    G4int n_elements = elements.size();
12    for (G4int id: elements) {
13        G4RotationMatrix rotation = G4RotationMatrix{};
14        G4ThreeVector direction = G4ThreeVector{};
15        G4Transform3D origin = G4Transform3D{rotation, direction};
16        new G4PVPlacement{
17            origin,
18            element,
19            "Container",
20            container,
21            false,
22            id,  // copy_number
23            true,
24        };
25    };
26
27    return container;
28}

複数本のPMTを配置したいケースは多いと思います。 ここでは横一列に並べようとしています。