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