File indexing completed on 2026-04-01 07:50:11
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 #include "DetectorConstruction.hh"
0030
0031 #include "G4Box.hh"
0032 #include "G4Cons.hh"
0033 #include "G4LogicalVolume.hh"
0034 #include "G4NistManager.hh"
0035 #include "G4PVPlacement.hh"
0036 #include "G4SystemOfUnits.hh"
0037 #include "G4Trd.hh"
0038
0039 namespace B1
0040 {
0041
0042
0043
0044 G4VPhysicalVolume* DetectorConstruction::Construct()
0045 {
0046
0047 G4NistManager* nist = G4NistManager::Instance();
0048
0049
0050
0051 G4double env_sizeXY = 20 * cm, env_sizeZ = 30 * cm;
0052 G4Material* env_mat = nist->FindOrBuildMaterial("G4_WATER");
0053
0054
0055
0056 G4bool checkOverlaps = true;
0057
0058
0059
0060
0061 G4double world_sizeXY = 1.2 * env_sizeXY;
0062 G4double world_sizeZ = 1.2 * env_sizeZ;
0063 G4Material* world_mat = nist->FindOrBuildMaterial("G4_AIR");
0064
0065 auto solidWorld =
0066 new G4Box("World",
0067 0.5 * world_sizeXY, 0.5 * world_sizeXY, 0.5 * world_sizeZ);
0068
0069 auto logicWorld = new G4LogicalVolume(solidWorld,
0070 world_mat,
0071 "World");
0072
0073 auto physWorld = new G4PVPlacement(nullptr,
0074 G4ThreeVector(),
0075 logicWorld,
0076 "World",
0077 nullptr,
0078 false,
0079 0,
0080 checkOverlaps);
0081
0082
0083
0084
0085 auto solidEnv = new G4Box("Envelope",
0086 0.5 * env_sizeXY, 0.5 * env_sizeXY, 0.5 * env_sizeZ);
0087
0088 auto logicEnv = new G4LogicalVolume(solidEnv,
0089 env_mat,
0090 "Envelope");
0091
0092 new G4PVPlacement(nullptr,
0093 G4ThreeVector(),
0094 logicEnv,
0095 "Envelope",
0096 logicWorld,
0097 false,
0098 0,
0099 checkOverlaps);
0100
0101
0102
0103
0104 G4Material* shape1_mat = nist->FindOrBuildMaterial("G4_A-150_TISSUE");
0105 G4ThreeVector pos1 = G4ThreeVector(0, 2 * cm, -7 * cm);
0106
0107
0108 G4double shape1_rmina = 0. * cm, shape1_rmaxa = 2. * cm;
0109 G4double shape1_rminb = 0. * cm, shape1_rmaxb = 4. * cm;
0110 G4double shape1_hz = 3. * cm;
0111 G4double shape1_phimin = 0. * deg, shape1_phimax = 360. * deg;
0112 auto solidShape1 = new G4Cons("Shape1", shape1_rmina, shape1_rmaxa, shape1_rminb, shape1_rmaxb,
0113 shape1_hz, shape1_phimin, shape1_phimax);
0114
0115 auto logicShape1 = new G4LogicalVolume(solidShape1,
0116 shape1_mat,
0117 "Shape1");
0118
0119 new G4PVPlacement(nullptr,
0120 pos1,
0121 logicShape1,
0122 "Shape1",
0123 logicEnv,
0124 false,
0125 0,
0126 checkOverlaps);
0127
0128
0129
0130
0131 G4Material* shape2_mat = nist->FindOrBuildMaterial("G4_BONE_COMPACT_ICRU");
0132 G4ThreeVector pos2 = G4ThreeVector(0, -1 * cm, 7 * cm);
0133
0134
0135 G4double shape2_dxa = 12 * cm, shape2_dxb = 12 * cm;
0136 G4double shape2_dya = 10 * cm, shape2_dyb = 16 * cm;
0137 G4double shape2_dz = 6 * cm;
0138 auto solidShape2 =
0139 new G4Trd("Shape2",
0140 0.5 * shape2_dxa, 0.5 * shape2_dxb, 0.5 * shape2_dya, 0.5 * shape2_dyb,
0141 0.5 * shape2_dz);
0142
0143 auto logicShape2 = new G4LogicalVolume(solidShape2,
0144 shape2_mat,
0145 "Shape2");
0146
0147 new G4PVPlacement(nullptr,
0148 pos2,
0149 logicShape2,
0150 "Shape2",
0151 logicEnv,
0152 false,
0153 0,
0154 checkOverlaps);
0155
0156
0157
0158 fScoringVolume = logicShape2;
0159
0160
0161
0162
0163 return physWorld;
0164 }
0165
0166
0167
0168 }