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