File indexing completed on 2025-02-23 09:22:32
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
0031 #include "Par01DetectorConstruction.hh"
0032
0033 #include "Par01CalorimeterSD.hh"
0034 #include "Par01EMShowerModel.hh"
0035 #include "Par01PiModel.hh"
0036
0037 #include "G4Box.hh"
0038 #include "G4Colour.hh"
0039 #include "G4Element.hh"
0040 #include "G4ElementTable.hh"
0041 #include "G4LogicalVolume.hh"
0042 #include "G4Material.hh"
0043 #include "G4MaterialTable.hh"
0044 #include "G4NistManager.hh"
0045 #include "G4PVPlacement.hh"
0046 #include "G4ProductionCuts.hh"
0047 #include "G4RegionStore.hh"
0048 #include "G4SDManager.hh"
0049 #include "G4SystemOfUnits.hh"
0050 #include "G4ThreeVector.hh"
0051 #include "G4Tubs.hh"
0052 #include "G4VisAttributes.hh"
0053
0054
0055
0056 Par01DetectorConstruction::Par01DetectorConstruction()
0057 {
0058 ;
0059 }
0060
0061
0062
0063 Par01DetectorConstruction::~Par01DetectorConstruction()
0064 {
0065 ;
0066 }
0067
0068
0069
0070 G4VPhysicalVolume* Par01DetectorConstruction::Construct()
0071 {
0072 G4cout << "\nPar01DetectorConstruction....\n" << G4endl;
0073
0074
0075
0076 G4NistManager* nistManager = G4NistManager::Instance();
0077
0078
0079 G4Material* air = nistManager->FindOrBuildMaterial("G4_AIR");
0080 G4Material* csi = nistManager->FindOrBuildMaterial("G4_CESIUM_IODIDE");
0081 G4Material* helium = nistManager->FindOrBuildMaterial("G4_He");
0082 G4Material* iron = nistManager->FindOrBuildMaterial("G4_Fe");
0083
0084
0085
0086
0087
0088
0089 G4Box* WorldBox = new G4Box("WorldBox", 400 * cm, 400 * cm, 400 * cm);
0090 G4LogicalVolume* WorldLog = new G4LogicalVolume(WorldBox, air, "WorldLogical", 0, 0, 0);
0091 G4PVPlacement* WorldPhys =
0092 new G4PVPlacement(0, G4ThreeVector(), "WorldPhysical", WorldLog, 0, false, 0);
0093
0094 G4double detectSize = 125 * cm;
0095
0096
0097
0098
0099
0100
0101 G4Box* driftChamberBox = new G4Box("DriftChamberSolid", detectSize, detectSize, 40 * cm);
0102 G4LogicalVolume* driftChamberLog =
0103 new G4LogicalVolume(driftChamberBox, helium, "DriftChamberLogical", 0, 0, 0);
0104
0105
0106 new G4PVPlacement(0, G4ThreeVector(0., 0., 50 * cm), "DriftChamberPhysical", driftChamberLog,
0107 WorldPhys, false, 0);
0108
0109
0110
0111
0112
0113
0114 G4Box* calorimeterBox = new G4Box("CalorimeterSolid", detectSize, detectSize, 20 * cm);
0115 G4LogicalVolume* calorimeterLog =
0116 new G4LogicalVolume(calorimeterBox, air, "CalorimeterLogical", 0, 0, 0);
0117
0118 G4PVPlacement* calorimeterPhys = new G4PVPlacement(
0119 0, G4ThreeVector(0., 0., 120 * cm), "CalorimeterPhysical", calorimeterLog, WorldPhys, false, 0);
0120
0121
0122
0123
0124
0125
0126 G4double CrystalX = 2.5 * cm;
0127 G4double CrystalY = CrystalX;
0128 G4double CrystalZ = 20 * cm;
0129 G4Box* CrystalSolid = new G4Box("CrystalSolid", CrystalX, CrystalY, CrystalZ);
0130 fCrystalLog = new G4LogicalVolume(CrystalSolid, csi, "CrystalLogical", 0, 0, 0);
0131
0132 G4String tName1("Crystal");
0133
0134
0135
0136 G4int copyNo = 0;
0137 G4double xTlate, yTlate;
0138 fnX = 48;
0139 fnY = 48;
0140 for (G4int j = 0; j < fnY; j++) {
0141 yTlate = -detectSize + 3 * CrystalY + j * 2 * CrystalY;
0142 for (G4int i = 0; i < fnX; i++) {
0143 xTlate = -detectSize + 3 * CrystalX + i * 2 * CrystalX;
0144 new G4PVPlacement(0, G4ThreeVector(xTlate, yTlate, 0 * cm), tName1, fCrystalLog,
0145 calorimeterPhys, false, copyNo++);
0146 }
0147 }
0148
0149
0150
0151
0152
0153
0154
0155 G4Box* hadCaloBox = new G4Box("HadCaloSolid", detectSize, detectSize, 50 * cm);
0156 G4LogicalVolume* hadCaloLog = new G4LogicalVolume(hadCaloBox, air, "HadCaloLogical", 0, 0, 0);
0157
0158 G4PVPlacement* hadCaloPhys = new G4PVPlacement(
0159 0, G4ThreeVector(0., 0., 200 * cm), "HadCaloPhysical", hadCaloLog, WorldPhys, false, 0);
0160
0161
0162
0163
0164
0165
0166 G4double TowerX = 5 * cm;
0167 G4double TowerY = TowerX;
0168 G4double TowerZ = 45 * cm;
0169 G4Box* TowerSolid = new G4Box("TowerSolid", TowerX, TowerY, TowerZ);
0170 fTowerLog = new G4LogicalVolume(TowerSolid, iron, "TowerLogical", 0, 0, 0);
0171
0172 G4String tName2("Tower");
0173
0174
0175 copyNo = 0;
0176 fnXhad = 23;
0177 fnYhad = 23;
0178 for (G4int jj = 0; jj < fnYhad; jj++) {
0179 yTlate = -detectSize + 3 * TowerY + jj * 2 * TowerY;
0180 for (G4int i = 0; i < fnXhad; i++) {
0181 xTlate = -detectSize + 3 * TowerX + i * 2 * TowerX;
0182 new G4PVPlacement(0, G4ThreeVector(xTlate, yTlate, 0 * cm), tName2, fTowerLog, hadCaloPhys,
0183 false, copyNo++);
0184 }
0185 }
0186
0187
0188 G4Region* caloRegion = new G4Region("EM_calo_region");
0189 caloRegion->AddRootLogicalVolume(calorimeterLog);
0190 std::vector<double> cuts;
0191 cuts.push_back(1.0 * mm);
0192 cuts.push_back(1.0 * mm);
0193 cuts.push_back(1.0 * mm);
0194 cuts.push_back(1.0 * mm);
0195 caloRegion->SetProductionCuts(new G4ProductionCuts());
0196 caloRegion->GetProductionCuts()->SetProductionCuts(cuts);
0197
0198
0199 G4Region* hadRegion = new G4Region("HAD_calo_region");
0200 hadRegion->AddRootLogicalVolume(hadCaloLog);
0201 cuts.clear();
0202 cuts.push_back(1.0 * cm);
0203 cuts.push_back(1.0 * cm);
0204 cuts.push_back(1.0 * cm);
0205 cuts.push_back(1.0 * cm);
0206 hadRegion->SetProductionCuts(new G4ProductionCuts());
0207 hadRegion->GetProductionCuts()->SetProductionCuts(cuts);
0208
0209
0210 WorldLog->SetVisAttributes(G4VisAttributes::GetInvisible());
0211
0212 auto driftchamberTubeVisAtt = new G4VisAttributes(G4Colour(0.0, 1.0, 0.0));
0213 driftchamberTubeVisAtt->SetForceWireframe(true);
0214 driftChamberLog->SetVisAttributes(driftchamberTubeVisAtt);
0215
0216 auto calorimeterBoxVisAtt = new G4VisAttributes(G4Colour(0.0, 0.0, 1.0));
0217 calorimeterBoxVisAtt->SetForceWireframe(true);
0218 calorimeterLog->SetVisAttributes(calorimeterBoxVisAtt);
0219
0220 auto crystalVisAtt = new G4VisAttributes(G4Colour(1.0, 0.0, 0.0));
0221 crystalVisAtt->SetForceWireframe(true);
0222 fCrystalLog->SetVisAttributes(crystalVisAtt);
0223
0224 auto hadCaloBoxVisAtt = new G4VisAttributes(G4Colour(1.0, 0.0, 1.0));
0225 hadCaloBoxVisAtt->SetForceWireframe(true);
0226 hadCaloLog->SetVisAttributes(hadCaloBoxVisAtt);
0227
0228 auto towerVisAtt = new G4VisAttributes(G4Colour(0.5, 0.0, 1.0));
0229 towerVisAtt->SetForceWireframe(true);
0230 fTowerLog->SetVisAttributes(towerVisAtt);
0231
0232
0233
0234
0235
0236
0237
0238 return WorldPhys;
0239 }
0240
0241
0242
0243 void Par01DetectorConstruction::ConstructSDandField()
0244 {
0245
0246 G4SDManager* SDman = G4SDManager::GetSDMpointer();
0247 G4String calorimeterSDname = "Par01/Calorimeter";
0248 Par01CalorimeterSD* CalorimeterSD =
0249 new Par01CalorimeterSD(calorimeterSDname, fnX * fnY, "CalCollection");
0250 SDman->AddNewDetector(CalorimeterSD);
0251 fCrystalLog->SetSensitiveDetector(CalorimeterSD);
0252
0253 G4String hadCalorimeterSDname = "Par01/HadronCalorimeter";
0254 Par01CalorimeterSD* HadCalorimeterSD =
0255 new Par01CalorimeterSD(hadCalorimeterSDname, fnXhad * fnYhad, "HadCollection");
0256 SDman->AddNewDetector(HadCalorimeterSD);
0257 fTowerLog->SetSensitiveDetector(HadCalorimeterSD);
0258
0259
0260 G4RegionStore* regionStore = G4RegionStore::GetInstance();
0261
0262 G4Region* caloRegion = regionStore->GetRegion("EM_calo_region");
0263
0264 new Par01EMShowerModel("emShowerModel", caloRegion);
0265 }