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