File indexing completed on 2025-02-23 09:22:30
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
0032
0033
0034
0035
0036 #include "ExGflash1DetectorConstruction.hh"
0037
0038 #include "ExGflash1SensitiveDetector.hh"
0039
0040
0041 #include "G4AutoDelete.hh"
0042 #include "G4Box.hh"
0043 #include "G4Colour.hh"
0044 #include "G4LogicalVolume.hh"
0045 #include "G4Material.hh"
0046 #include "G4NistManager.hh"
0047 #include "G4PVPlacement.hh"
0048 #include "G4SDManager.hh"
0049 #include "G4SystemOfUnits.hh"
0050 #include "G4ThreeVector.hh"
0051 #include "G4VPhysicalVolume.hh"
0052 #include "G4VisAttributes.hh"
0053 #include "globals.hh"
0054
0055
0056 #include "GFlashHitMaker.hh"
0057 #include "GFlashHomoShowerParameterisation.hh"
0058 #include "GFlashParticleBounds.hh"
0059 #include "GFlashShowerModel.hh"
0060
0061 #include "G4FastSimulationManager.hh"
0062
0063
0064
0065 ExGflash1DetectorConstruction::ExGflash1DetectorConstruction()
0066 {
0067 G4cout << "ExGflash1DetectorConstruction::Detector constructor" << G4endl;
0068 }
0069
0070
0071
0072 ExGflash1DetectorConstruction::~ExGflash1DetectorConstruction()
0073 {
0074 delete fFastShowerModel;
0075 delete fParameterisation;
0076 delete fParticleBounds;
0077 delete fHitMaker;
0078 }
0079
0080
0081
0082 G4VPhysicalVolume* ExGflash1DetectorConstruction::Construct()
0083 {
0084
0085 G4cout << "Defining the materials" << G4endl;
0086
0087 G4NistManager* nistManager = G4NistManager::Instance();
0088
0089 G4Material* air = nistManager->FindOrBuildMaterial("G4_AIR");
0090 G4Material* pbWO4 = nistManager->FindOrBuildMaterial("G4_PbWO4");
0091
0092
0093
0094
0095 G4double experimentalHall_x = 1000. * cm;
0096 G4double experimentalHall_y = 1000. * cm;
0097 G4double experimentalHall_z = 1000. * cm;
0098
0099 G4VSolid* experimentalHall_box = new G4Box("expHall_box",
0100 experimentalHall_x,
0101 experimentalHall_y,
0102 experimentalHall_z);
0103
0104 auto experimentalHallLog = new G4LogicalVolume(experimentalHall_box, air, "expHallLog",
0105 nullptr,
0106 nullptr,
0107 nullptr);
0108 G4VPhysicalVolume* experimentalHallPhys =
0109 new G4PVPlacement(nullptr,
0110 G4ThreeVector(),
0111 "expHall", experimentalHallLog, nullptr, false, 0);
0112
0113
0114
0115
0116
0117
0118 G4int nbOfCrystals = 10;
0119
0120
0121
0122
0123
0124
0125 G4double calo_xside = 31 * cm;
0126 G4double calo_yside = 31 * cm;
0127 G4double calo_zside = 24 * cm;
0128
0129 G4double crystalWidth = 3 * cm;
0130 G4double crystalLength = 24 * cm;
0131
0132 calo_xside = (crystalWidth * nbOfCrystals) + 1 * cm;
0133 calo_yside = (crystalWidth * nbOfCrystals) + 1 * cm;
0134 calo_zside = crystalLength;
0135
0136 auto calo_box = new G4Box("CMS calorimeter",
0137 calo_xside / 2.,
0138 calo_yside / 2., calo_zside / 2.);
0139 auto caloLog = new G4LogicalVolume(calo_box,
0140 air,
0141 "calo log",
0142 nullptr,
0143 nullptr,
0144 nullptr);
0145
0146 G4double xpos = 0.0;
0147 G4double ypos = 0.0;
0148 G4double zpos = 100.0 * cm;
0149 new G4PVPlacement(nullptr, G4ThreeVector(xpos, ypos, zpos), caloLog, "calorimeter",
0150 experimentalHallLog, false, 1);
0151
0152
0153 G4VSolid* crystal_box = new G4Box("Crystal",
0154 crystalWidth / 2, crystalWidth / 2, crystalLength / 2);
0155
0156 fCrystalLog = new G4LogicalVolume(crystal_box,
0157 pbWO4,
0158 "CrystalLog");
0159
0160 for (G4int i = 0; i < nbOfCrystals; i++) {
0161 for (G4int j = 0; j < nbOfCrystals; j++) {
0162 G4int n = i * 10 + j;
0163 G4ThreeVector crystalPos((i * crystalWidth) - 135, (j * crystalWidth) - 135, 0);
0164 fCrystalPhys[n] = new G4PVPlacement(nullptr,
0165 crystalPos,
0166 fCrystalLog,
0167 "crystal",
0168 caloLog, false, i);
0169 }
0170 }
0171 G4cout << "There are " << nbOfCrystals << " crystals per row in the calorimeter, so in total "
0172 << nbOfCrystals * nbOfCrystals << " crystals" << G4endl;
0173 G4cout << "They have width of " << crystalWidth / cm << " cm and a length of "
0174 << crystalLength / cm << " cm. The Material is " << pbWO4 << G4endl;
0175
0176 experimentalHallLog->SetVisAttributes(G4VisAttributes::GetInvisible());
0177 auto caloVisAtt = new G4VisAttributes(G4Colour(1.0, 1.0, 1.0));
0178 auto crystalVisAtt = new G4VisAttributes(G4Colour(1.0, 1.0, 0.0));
0179 caloLog->SetVisAttributes(caloVisAtt);
0180 fCrystalLog->SetVisAttributes(crystalVisAtt);
0181
0182
0183 fRegion = new G4Region("crystals");
0184 caloLog->SetRegion(fRegion);
0185 fRegion->AddRootLogicalVolume(caloLog);
0186
0187 return experimentalHallPhys;
0188 }
0189
0190
0191
0192 void ExGflash1DetectorConstruction::ConstructSDandField()
0193 {
0194
0195 G4SDManager* SDman = G4SDManager::GetSDMpointer();
0196 auto CaloSD = new ExGflash1SensitiveDetector("Calorimeter", this);
0197 SDman->AddNewDetector(CaloSD);
0198 fCrystalLog->SetSensitiveDetector(CaloSD);
0199
0200
0201 G4NistManager* nistManager = G4NistManager::Instance();
0202 G4Material* pbWO4 = nistManager->FindOrBuildMaterial("G4_PbWO4");
0203
0204
0205
0206
0207 G4cout << "Creating shower parameterization models" << G4endl;
0208 fFastShowerModel = new GFlashShowerModel("fFastShowerModel", fRegion);
0209 fParameterisation = new GFlashHomoShowerParameterisation(pbWO4);
0210 fFastShowerModel->SetParameterisation(*fParameterisation);
0211
0212 fParticleBounds = new GFlashParticleBounds();
0213 fFastShowerModel->SetParticleBounds(*fParticleBounds);
0214
0215 fHitMaker = new GFlashHitMaker();
0216 fFastShowerModel->SetHitMaker(*fHitMaker);
0217 G4cout << "end shower parameterization." << G4endl;
0218
0219 }
0220
0221