File indexing completed on 2026-09-08 08:29:39
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 "ExGflash3DetectorConstruction.hh"
0036
0037
0038 #include "G4AutoDelete.hh"
0039 #include "G4Box.hh"
0040 #include "G4Colour.hh"
0041 #include "G4LogicalVolume.hh"
0042 #include "G4Material.hh"
0043 #include "G4NistManager.hh"
0044 #include "G4PVPlacement.hh"
0045 #include "G4SDManager.hh"
0046 #include "G4SystemOfUnits.hh"
0047 #include "G4ThreeVector.hh"
0048 #include "G4VPhysicalVolume.hh"
0049 #include "G4VisAttributes.hh"
0050 #include "globals.hh"
0051
0052
0053 #include "GFlashHitMaker.hh"
0054 #include "GFlashHomoShowerParameterisation.hh"
0055 #include "GFlashParticleBounds.hh"
0056 #include "GFlashShowerModel.hh"
0057
0058 #include "G4FastSimulationManager.hh"
0059
0060
0061
0062 ExGflash3DetectorConstruction::ExGflash3DetectorConstruction()
0063 {
0064 G4cout << "ExGflash3DetectorConstruction::Detector constructor" << G4endl;
0065 }
0066
0067
0068
0069 ExGflash3DetectorConstruction::~ExGflash3DetectorConstruction()
0070 {
0071 delete fFastShowerModel;
0072 delete fParameterisation;
0073 delete fParticleBounds;
0074 delete fHitMaker;
0075 }
0076
0077
0078
0079 G4VPhysicalVolume* ExGflash3DetectorConstruction::Construct()
0080 {
0081
0082 G4cout << "Defining the materials" << G4endl;
0083
0084 G4NistManager* nistManager = G4NistManager::Instance();
0085
0086 G4Material* air = nistManager->FindOrBuildMaterial("G4_AIR");
0087 G4Material* pbWO4 = nistManager->FindOrBuildMaterial("G4_PbWO4");
0088
0089
0090
0091
0092 G4double experimentalHall_x = 1000. * cm;
0093 G4double experimentalHall_y = 1000. * cm;
0094 G4double experimentalHall_z = 1000. * cm;
0095
0096 G4VSolid* experimentalHall_box = new G4Box("expHall_box",
0097 experimentalHall_x,
0098 experimentalHall_y,
0099 experimentalHall_z);
0100
0101 auto experimentalHallLog = new G4LogicalVolume(experimentalHall_box, air, "expHallLog",
0102 nullptr,
0103 nullptr,
0104 nullptr);
0105 G4VPhysicalVolume* experimentalHall_phys =
0106 new G4PVPlacement(nullptr,
0107 G4ThreeVector(),
0108 "expHall", experimentalHallLog, nullptr, false, 0);
0109
0110
0111
0112
0113
0114
0115 G4int nbOfCrystals = 10;
0116
0117
0118
0119
0120
0121
0122 G4double calo_xside = 31 * cm;
0123 G4double calo_yside = 31 * cm;
0124 G4double calo_zside = 24 * cm;
0125
0126 G4double crystalWidth = 3 * cm;
0127 G4double crystalLength = 24 * cm;
0128
0129 calo_xside = (crystalWidth * nbOfCrystals) + 1 * cm;
0130 calo_yside = (crystalWidth * nbOfCrystals) + 1 * cm;
0131 calo_zside = crystalLength;
0132
0133 auto calo_box = new G4Box("CMS calorimeter",
0134 calo_xside / 2.,
0135 calo_yside / 2., calo_zside / 2.);
0136 auto caloLog = new G4LogicalVolume(calo_box,
0137 pbWO4,
0138 "calo log",
0139 nullptr,
0140 nullptr,
0141 nullptr);
0142
0143 G4double xpos = 0.0;
0144 G4double ypos = 0.0;
0145 G4double zpos = 100.0 * cm;
0146 new G4PVPlacement(nullptr, G4ThreeVector(xpos, ypos, zpos), caloLog, "calorimeter",
0147 experimentalHallLog, false, 1);
0148
0149
0150
0151 experimentalHallLog->SetVisAttributes(G4VisAttributes::GetInvisible());
0152 auto caloVisAtt = new G4VisAttributes(G4Colour(1.0, 1.0, 1.0));
0153 caloLog->SetVisAttributes(caloVisAtt);
0154
0155
0156 fRegion = new G4Region("crystals");
0157 caloLog->SetRegion(fRegion);
0158 fRegion->AddRootLogicalVolume(caloLog);
0159
0160 return experimentalHall_phys;
0161 }
0162
0163
0164
0165 void ExGflash3DetectorConstruction::ConstructSDandField()
0166 {
0167
0168
0169
0170
0171
0172
0173 G4cout << "Creating shower parameterization models" << G4endl;
0174 fFastShowerModel = new GFlashShowerModel("fFastShowerModel", fRegion);
0175 fParameterisation = new GFlashHomoShowerParameterisation(fRegion->GetMaterialIterator()[0]);
0176 fFastShowerModel->SetParameterisation(*fParameterisation);
0177
0178 fParticleBounds = new GFlashParticleBounds();
0179 fFastShowerModel->SetParticleBounds(*fParticleBounds);
0180
0181 fHitMaker = new GFlashHitMaker();
0182
0183 fHitMaker->SetNameOfWorldWithSD("parallelWorld");
0184 fFastShowerModel->SetHitMaker(*fHitMaker);
0185 G4cout << "end shower parameterization." << G4endl;
0186
0187 }
0188
0189