File indexing completed on 2025-01-18 09:17:11
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 "XraySPODetectorConstruction.hh"
0036 #include "XraySPODetectorMessenger.hh"
0037 #include "G4NistManager.hh"
0038 #include "G4Material.hh"
0039 #include "G4LogicalVolume.hh"
0040
0041 #include "G4PhysicalVolumeStore.hh"
0042
0043 #include "G4PhysicalConstants.hh"
0044 #include "G4SystemOfUnits.hh"
0045 #include <iomanip>
0046
0047
0048
0049 XraySPODetectorConstruction::XraySPODetectorConstruction()
0050 : fDetectorMessenger(nullptr)
0051 {
0052
0053 DefineMaterials();
0054 fReadFile = "";
0055
0056
0057 fDetectorMessenger = new XraySPODetectorMessenger(this);
0058 }
0059
0060
0061
0062 G4VPhysicalVolume* XraySPODetectorConstruction::Construct()
0063 {
0064 return ConstructDetector();
0065 }
0066
0067
0068
0069 void XraySPODetectorConstruction::DefineMaterials()
0070 {
0071 G4NistManager* man = G4NistManager::Instance();
0072
0073 man->FindOrBuildMaterial("G4_Al");
0074 man->FindOrBuildMaterial("G4_Si");
0075 man->FindOrBuildMaterial("G4_Fe");
0076 man->FindOrBuildMaterial("G4_Cu");
0077 man->FindOrBuildMaterial("G4_Ge");
0078 man->FindOrBuildMaterial("G4_Mo");
0079 man->FindOrBuildMaterial("G4_Ta");
0080 man->FindOrBuildMaterial("G4_W");
0081 man->FindOrBuildMaterial("G4_Au");
0082 man->FindOrBuildMaterial("G4_Pb");
0083 man->FindOrBuildMaterial("G4_PbWO4");
0084 man->FindOrBuildMaterial("G4_SODIUM_IODIDE");
0085 man->FindOrBuildMaterial("G4_AIR");
0086 man->FindOrBuildMaterial("G4_WATER");
0087
0088 G4Element* H = man->FindOrBuildElement("H");
0089 G4Element* O = man->FindOrBuildElement("O");
0090
0091 G4Material* H2O = new G4Material("Water", 1.000*g/cm3, 2);
0092 H2O->AddElement(H, 2);
0093 H2O->AddElement(O, 1);
0094 H2O->GetIonisation()->SetMeanExcitationEnergy(78.0*eV);
0095
0096 G4double density = universe_mean_density;
0097 G4double pressure = 3.e-18*pascal;
0098 G4double temperature = 2.73*kelvin;
0099 G4Material* Galactic = new G4Material("Galactic", 1., 1.008*g/mole, density, kStateGas, temperature, pressure);
0100
0101 fDefaultMaterial = Galactic;
0102 }
0103
0104
0105
0106
0107 void XraySPODetectorConstruction::SetReadFile(G4String &input_geometry)
0108 {
0109 fReadFile = std::move(input_geometry);
0110 }
0111
0112
0113
0114 G4VPhysicalVolume* XraySPODetectorConstruction::ConstructDetector()
0115 {
0116 if (fReadFile == "")
0117 {
0118 G4cout << "No geometry selected!" << G4endl;
0119 }
0120 else
0121 {
0122 auto *InnerRegion = new G4Region("InnerRegion");
0123 G4cout << "Build geometry from GDML file: " << fReadFile << G4endl;
0124 G4VPhysicalVolume* fWorldPhysVol;
0125 fParser.Read(fReadFile);
0126 fWorldPhysVol = fParser.GetWorldVolume();
0127 fWorld_log = fWorldPhysVol->GetLogicalVolume();
0128 G4int num_volumes = 9;
0129 auto *inner_volumes = new G4String[num_volumes];
0130 inner_volumes[0] = "cone_1"; inner_volumes[1] = "cone_2"; inner_volumes[2] = "cone_3"; inner_volumes[3] = "cone_4";
0131 inner_volumes[4] = "cone_5"; inner_volumes[5] = "cone_6"; inner_volumes[6] = "cone_7"; inner_volumes[7] = "cone_8";
0132
0133 G4cout << "Adding volumes to the InnerRegion" << G4endl;
0134
0135 for (G4int j = 0; j <= num_volumes; j++)
0136 {
0137 for (G4int i = 0; i < (G4int)fWorld_log->GetNoDaughters(); i++)
0138 {
0139 if (fWorld_log->GetDaughter(i)->GetLogicalVolume()->GetName() == inner_volumes[j])
0140 {
0141 InnerRegion->AddRootLogicalVolume(fWorld_log->GetDaughter(i)->GetLogicalVolume());
0142 G4cout << "Added: " << fWorld_log->GetDaughter(i)->GetLogicalVolume()->GetName() << G4endl;
0143 }
0144 }
0145 }
0146 fPhysiWorld = fWorldPhysVol;
0147 }
0148 return fPhysiWorld;
0149 }
0150
0151
0152