File indexing completed on 2025-10-14 08:09:01
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 "Materials.hh"
0033
0034 #include "G4Box.hh"
0035 #include "G4LogicalVolume.hh"
0036 #include "G4Material.hh"
0037 #include "G4PVPlacement.hh"
0038 #include "G4SystemOfUnits.hh"
0039 #include "G4Tubs.hh"
0040 #include "G4VisAttributes.hh"
0041
0042
0043 DetectorConstruction::DetectorConstruction() {}
0044
0045
0046 DetectorConstruction::~DetectorConstruction() {}
0047
0048
0049 G4VPhysicalVolume* DetectorConstruction::Construct()
0050 {
0051
0052 Materials* materialConstruction = new Materials;
0053 materialConstruction->Construct();
0054
0055 G4Material* mate;
0056 G4VisAttributes* va;
0057
0058
0059 const G4double DXYZ_AREA = 32. * cm;
0060 G4Box* areaSolid = new G4Box("AREA", DXYZ_AREA / 2., DXYZ_AREA / 2., DXYZ_AREA / 2.);
0061
0062 G4Material* vacuum = G4Material::GetMaterial("Vacuum");
0063 G4LogicalVolume* areaLV = new G4LogicalVolume(areaSolid, vacuum, "AREA_LV");
0064 G4PVPlacement* area = new G4PVPlacement(0, G4ThreeVector(), "AREA_PV", areaLV, 0, false, 0);
0065
0066 va = new G4VisAttributes(G4Color(1., 1., 1.));
0067 va->SetVisibility(false);
0068 areaLV->SetVisAttributes(va);
0069
0070
0071
0072 const G4double dvoxel = 10. * mm;
0073 const G4double dl = 10. * cm;
0074
0075 G4Box* svoxel = new G4Box("voxel", dvoxel, dl, dvoxel);
0076 mate = G4Material::GetMaterial("Vacuum");
0077 G4LogicalVolume* lvoxel = new G4LogicalVolume(svoxel, mate, "voxel");
0078 va = new G4VisAttributes(G4Color(0., 0.8, 0.8));
0079 va->SetVisibility(false);
0080 lvoxel->SetVisAttributes(va);
0081
0082 G4int ix, iz;
0083 G4int index = 0;
0084 for (iz = 0; iz < 5; iz++) {
0085 for (ix = -7; ix <= 7; ix++) {
0086 G4double x0 = (2. * ix) * cm;
0087 G4double z0 = (-13. + 2. * iz) * cm;
0088 new G4PVPlacement(0, G4ThreeVector(x0, 0., z0), lvoxel, "voxel", areaLV, false, index);
0089 index++;
0090 }
0091 }
0092
0093
0094 G4Tubs* stube = new G4Tubs("tube", 0. * mm, 19. / 2. * mm, dl, 0., 360. * deg);
0095 mate = G4Material::GetMaterial("Al");
0096 G4LogicalVolume* ltube = new G4LogicalVolume(stube, mate, "tube");
0097 va = new G4VisAttributes(G4Color(0., 0.8, 0.8));
0098 ltube->SetVisAttributes(va);
0099
0100 G4RotationMatrix* rmtube = new G4RotationMatrix;
0101 rmtube->rotateX(-90. * deg);
0102 new G4PVPlacement(rmtube, G4ThreeVector(), ltube, "tube", lvoxel, false, 0);
0103
0104
0105 const G4double dxycal = 25. * mm;
0106 const G4double dzcal = 3. * cm;
0107
0108 G4Box* scal = new G4Box("cal", dxycal, dxycal, dzcal);
0109 mate = G4Material::GetMaterial("CsI");
0110 G4LogicalVolume* lcal = new G4LogicalVolume(scal, mate, "cal");
0111 va = new G4VisAttributes(G4Color(0.5, 0.5, 0.));
0112 lcal->SetVisAttributes(va);
0113
0114 index = 0;
0115 for (ix = -2; ix <= 2; ix++) {
0116 G4double x0 = (5. * ix) * cm;
0117 new G4PVPlacement(0, G4ThreeVector(x0, 0., 2. * cm), lcal, "cal", areaLV, false, index);
0118 index++;
0119 }
0120
0121 return area;
0122 }
0123
0124
0125 void DetectorConstruction::ConstructSDandField() {}