水タンクを作りたい
1// 水タンクの寸法
2G4double diameter = 39.3*m;
3G4double height = 41.4*m
4
5// ソリッド(形状)の作成
6// 内径, 外径, 高さ, sphi, dphi
7G4double rmin, rmax, z, sphi, dphi;
8G4Tubs *pTankSolid = new G4Tubs(
9 "TankSolid",
10 rmin=0.,
11 rmax=0.5*diameter,
12 z=0.5*height,
13 sphi=0.*deg,
14 dphi=360.*deg,
15)
16
17// ロジカルボリュームの作成
18G4LogicalVolume *pTankLogical = new G4LogicalVolume(
19 pTankSolid, // G4VSolid : 形状
20 pWater, // G4Material : 素材(「水」は先に作っておく)
21 "TankLogical", // G4String : 名前
22)
23
24// 物理ボリュームの作成
25G4RotationMatrix rotation = G4RotationMatrix(0., 90.*deg, 0.); // タンクを縦置きにする
26G4ThreeVector direction = G4ThreeVector(0., 0., 0.);
27G4Transform3D location = G4Transform3D(rotation, direction);
28
29new G4PVPlacement(
30 location, // G4Transform3D : 配置する場所
31 pTankLogical, // G4LogicalVolume : 子ボリューム
32 "TankPhysical", // G4String : 名前
33 pWorldLogical, // G4LogicalVolume : 親ボリューム
34 false, // no boolean operation
35 0, // G4int : copy number
36 true,
37)
水タンクを配置してみました。 タンクのサイズはスーパーカミオカンデ(直径39.3m、高さ41.4m)にしてあります。
色をつけたい(SetVisAttributes
)
1G4VisAttributes *attributes = new G4VisAttributes(true, G4Colour(0., 0.5, 1.));
2pTankLogical->SetVisAttributes(attributes)