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