File indexing completed on 2026-09-15 08:28:56
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 "BiasingOperator.hh"
0032
0033 #include "G4Box.hh"
0034 #include "G4Element.hh"
0035 #include "G4ElementTable.hh"
0036 #include "G4LogicalVolume.hh"
0037 #include "G4Material.hh"
0038 #include "G4MaterialTable.hh"
0039 #include "G4NistManager.hh"
0040 #include "G4PVPlacement.hh"
0041 #include "G4ProductionCuts.hh"
0042 #include "G4Region.hh"
0043 #include "G4RegionStore.hh"
0044 #include "G4SDManager.hh"
0045 #include "G4SystemOfUnits.hh"
0046 #include "G4ThreeVector.hh"
0047 #include "G4Tubs.hh"
0048
0049
0050
0051 DetectorConstruction::DetectorConstruction()
0052 : G4VUserDetectorConstruction(),
0053 fSiliconTrackerLogical(nullptr),
0054 fEmCaloLogical(nullptr),
0055 fHadCaloLogical(nullptr)
0056 {}
0057
0058
0059
0060 DetectorConstruction::~DetectorConstruction() {}
0061
0062
0063
0064 G4VPhysicalVolume* DetectorConstruction::Construct()
0065 {
0066 G4cout << "\nDetectorConstruction....\n" << G4endl;
0067
0068
0069 G4NistManager* nistManager = G4NistManager::Instance();
0070 G4Material* air = nistManager->FindOrBuildMaterial("G4_AIR");
0071 G4Material* csi = nistManager->FindOrBuildMaterial("G4_CESIUM_IODIDE");
0072 G4Material* silicon = nistManager->FindOrBuildMaterial("G4_Si");
0073 G4Material* iron = nistManager->FindOrBuildMaterial("G4_Fe");
0074
0075
0076 G4Box* worldBox = new G4Box("WorldBox", 200.0 * cm, 200.0 * cm, 200.0 * cm);
0077 G4LogicalVolume* worldLogical = new G4LogicalVolume(worldBox, air, "WorldLogical", 0, 0, 0);
0078 G4PVPlacement* worldPhys =
0079 new G4PVPlacement(0, G4ThreeVector(), "WorldPhysical", worldLogical, 0, false, 0);
0080
0081
0082
0083 G4double halfDetectorXYsize = 100.0 * cm;
0084 G4Box* siliconBox = new G4Box("siliconBox", halfDetectorXYsize, halfDetectorXYsize, 10.0 * cm);
0085 fSiliconTrackerLogical =
0086 new G4LogicalVolume(siliconBox, silicon, "SiliconTrackerLogical", 0, 0, 0);
0087 new G4PVPlacement(0, G4ThreeVector(0.0, 0.0, 0.0), "SiliconTrackerPhysical",
0088 fSiliconTrackerLogical, worldPhys, false, 0);
0089
0090
0091 G4Box* emCaloBox = new G4Box("EmCaloBox", halfDetectorXYsize, halfDetectorXYsize, 20.0 * cm);
0092 fEmCaloLogical = new G4LogicalVolume(emCaloBox, csi, "EmCalorimeterLogical", 0, 0, 0);
0093 new G4PVPlacement(0, G4ThreeVector(0.0, 0.0, 35.0 * cm), "EmCalorimeterPhysical", fEmCaloLogical,
0094 worldPhys, false, 0);
0095
0096
0097 G4Box* hadCaloBox = new G4Box("HadCaloBox", halfDetectorXYsize, halfDetectorXYsize, 50.0 * cm);
0098 fHadCaloLogical = new G4LogicalVolume(hadCaloBox, iron, "HadCaloLogical", 0, 0, 0);
0099 new G4PVPlacement(0, G4ThreeVector(0.0, 0.0, 110.0 * cm), "HadCaloPhysical", fHadCaloLogical,
0100 worldPhys, false, 0);
0101
0102
0103 G4Region* trackerRegion = new G4Region("Tracker_region");
0104 trackerRegion->AddRootLogicalVolume(fSiliconTrackerLogical);
0105 std::vector<double> cuts;
0106 cuts.push_back(10.0 * cm);
0107 cuts.push_back(10.0 * cm);
0108 cuts.push_back(10.0 * cm);
0109 cuts.push_back(10.0 * cm);
0110 trackerRegion->SetProductionCuts(new G4ProductionCuts);
0111 trackerRegion->GetProductionCuts()->SetProductionCuts(cuts);
0112
0113
0114 G4Region* emCaloRegion = new G4Region("EM_calo_region");
0115 emCaloRegion->AddRootLogicalVolume(fEmCaloLogical);
0116 cuts.clear();
0117 cuts.push_back(20.0 * cm);
0118 cuts.push_back(20.0 * cm);
0119 cuts.push_back(20.0 * cm);
0120 cuts.push_back(20.0 * cm);
0121 emCaloRegion->SetProductionCuts(new G4ProductionCuts);
0122 emCaloRegion->GetProductionCuts()->SetProductionCuts(cuts);
0123
0124
0125 G4Region* hadCaloRegion = new G4Region("HAD_calo_region");
0126 hadCaloRegion->AddRootLogicalVolume(fHadCaloLogical);
0127 cuts.clear();
0128 cuts.push_back(50.0 * cm);
0129 cuts.push_back(50.0 * cm);
0130 cuts.push_back(50.0 * cm);
0131 cuts.push_back(50.0 * cm);
0132 hadCaloRegion->SetProductionCuts(new G4ProductionCuts);
0133 hadCaloRegion->GetProductionCuts()->SetProductionCuts(cuts);
0134
0135 return worldPhys;
0136 }
0137
0138
0139
0140 void DetectorConstruction::ConstructSDandField()
0141 {
0142
0143
0144 BiasingOperator* biasingOperator = new BiasingOperator;
0145 biasingOperator->AddParticle("proton");
0146 biasingOperator->AddParticle("neutron");
0147 biasingOperator->AddParticle("pi+");
0148 biasingOperator->AddParticle("pi-");
0149 biasingOperator->AttachTo(fSiliconTrackerLogical);
0150 }
0151
0152