File indexing completed on 2025-04-10 08:07:12
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 "ExGflash2DetectorConstruction.hh"
0037
0038 #include "ExGflash2SensitiveDetector.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
0057 ExGflash2DetectorConstruction::ExGflash2DetectorConstruction()
0058 {
0059 G4cout << "ExGflash2DetectorConstruction::Detector constructor" << G4endl;
0060 }
0061
0062
0063
0064 ExGflash2DetectorConstruction::~ExGflash2DetectorConstruction() = default;
0065
0066
0067
0068 G4VPhysicalVolume* ExGflash2DetectorConstruction::Construct()
0069 {
0070
0071 G4cout << "Defining the materials" << G4endl;
0072
0073 G4NistManager* nistManager = G4NistManager::Instance();
0074
0075 G4Material* air = nistManager->FindOrBuildMaterial("G4_AIR");
0076 G4Material* pbWO4 = nistManager->FindOrBuildMaterial("G4_PbWO4");
0077
0078
0079
0080
0081 G4double experimentalHall_x = 1000. * cm;
0082 G4double experimentalHall_y = 1000. * cm;
0083 G4double experimentalHall_z = 1000. * cm;
0084
0085 G4VSolid* experimentalHall_box = new G4Box("expHall_box",
0086 experimentalHall_x,
0087 experimentalHall_y,
0088 experimentalHall_z);
0089
0090 auto experimentalHallLog = new G4LogicalVolume(experimentalHall_box, air, "expHallLog",
0091 nullptr,
0092 nullptr,
0093 nullptr);
0094 G4VPhysicalVolume* experimentalHallPhys =
0095 new G4PVPlacement(nullptr,
0096 G4ThreeVector(),
0097 "expHall", experimentalHallLog, nullptr, false, 0);
0098
0099
0100
0101
0102
0103
0104 G4int nbOfCrystals = 10;
0105
0106
0107
0108
0109
0110
0111 G4double calo_xside = 31 * cm;
0112 G4double calo_yside = 31 * cm;
0113 G4double calo_zside = 24 * cm;
0114
0115 G4double crystalWidth = 3 * cm;
0116 G4double crystalLength = 24 * cm;
0117
0118 calo_xside = (crystalWidth * nbOfCrystals) + 1 * cm;
0119 calo_yside = (crystalWidth * nbOfCrystals) + 1 * cm;
0120 calo_zside = crystalLength;
0121
0122 auto calo_box = new G4Box("CMS calorimeter",
0123 calo_xside / 2.,
0124 calo_yside / 2., calo_zside / 2.);
0125 auto caloLog = new G4LogicalVolume(calo_box,
0126 air,
0127 "calo log",
0128 nullptr,
0129 nullptr,
0130 nullptr);
0131
0132 G4double xpos = 0.0;
0133 G4double ypos = 0.0;
0134 G4double zpos = 100.0 * cm;
0135 new G4PVPlacement(nullptr, G4ThreeVector(xpos, ypos, zpos), caloLog, "calorimeter",
0136 experimentalHallLog, false, 1);
0137
0138
0139 G4VSolid* crystal_box = new G4Box("Crystal",
0140 crystalWidth / 2, crystalWidth / 2, crystalLength / 2);
0141
0142 fCrystalLog = new G4LogicalVolume(crystal_box,
0143 pbWO4,
0144 "CrystalLog");
0145
0146 for (G4int i = 0; i < nbOfCrystals; i++) {
0147 for (G4int j = 0; j < nbOfCrystals; j++) {
0148 G4int n = i * 10 + j;
0149 G4ThreeVector crystalPos((i * crystalWidth) - 135, (j * crystalWidth) - 135, 0);
0150 fCrystalPhys[n] = new G4PVPlacement(nullptr,
0151 crystalPos,
0152 fCrystalLog,
0153 "crystal",
0154 caloLog, false, i);
0155 }
0156 }
0157 G4cout << "There are " << nbOfCrystals << " crystals per row in the calorimeter, so in total "
0158 << nbOfCrystals * nbOfCrystals << " crystals" << G4endl;
0159 G4cout << "They have width of " << crystalWidth / cm << " cm and a length of "
0160 << crystalLength / cm << " cm. The Material is " << pbWO4 << G4endl;
0161
0162 experimentalHallLog->SetVisAttributes(G4VisAttributes::GetInvisible());
0163 auto caloVisAtt = new G4VisAttributes(G4Colour(1.0, 1.0, 1.0));
0164 auto crystalVisAtt = new G4VisAttributes(G4Colour(1.0, 1.0, 0.0));
0165 caloLog->SetVisAttributes(caloVisAtt);
0166 fCrystalLog->SetVisAttributes(crystalVisAtt);
0167
0168
0169
0170 return experimentalHallPhys;
0171 }
0172
0173
0174
0175 void ExGflash2DetectorConstruction::ConstructSDandField()
0176 {
0177
0178 G4SDManager* SDman = G4SDManager::GetSDMpointer();
0179 auto CaloSD = new ExGflash2SensitiveDetector("Calorimeter", this);
0180 SDman->AddNewDetector(CaloSD);
0181 fCrystalLog->SetSensitiveDetector(CaloSD);
0182
0183
0184 }
0185
0186