Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 /// \file XraySPODetectorConstruction.cc 27 /// \brief Implementation of the DetectorConst 28 // 29 // Authors: P.Dondero (paolo.dondero@cern.ch), 30 // 31 //....oooOO0OOooo........oooOO0OOooo........oo 32 //....oooOO0OOooo........oooOO0OOooo........oo 33 34 35 #include "XraySPODetectorConstruction.hh" 36 #include "XraySPODetectorMessenger.hh" 37 #include "G4NistManager.hh" 38 #include "G4Material.hh" 39 #include "G4LogicalVolume.hh" 40 41 #include "G4PhysicalVolumeStore.hh" 42 43 #include "G4PhysicalConstants.hh" 44 #include "G4SystemOfUnits.hh" 45 #include <iomanip> 46 47 //....oooOO0OOooo........oooOO0OOooo........oo 48 49 XraySPODetectorConstruction::XraySPODetectorCo 50 : fDetectorMessenger(nullptr) 51 { 52 // materials 53 DefineMaterials(); 54 fReadFile = ""; 55 56 // create commands for interactive definitio 57 fDetectorMessenger = new XraySPODetectorMess 58 } 59 60 //....oooOO0OOooo........oooOO0OOooo........oo 61 62 G4VPhysicalVolume* XraySPODetectorConstruction 63 { 64 return ConstructDetector(); 65 } 66 67 //....oooOO0OOooo........oooOO0OOooo........oo 68 69 void XraySPODetectorConstruction::DefineMateri 70 { 71 G4NistManager* man = G4NistManager::Instance 72 73 man->FindOrBuildMaterial("G4_Al"); 74 man->FindOrBuildMaterial("G4_Si"); 75 man->FindOrBuildMaterial("G4_Fe"); 76 man->FindOrBuildMaterial("G4_Cu"); 77 man->FindOrBuildMaterial("G4_Ge"); 78 man->FindOrBuildMaterial("G4_Mo"); 79 man->FindOrBuildMaterial("G4_Ta"); 80 man->FindOrBuildMaterial("G4_W"); 81 man->FindOrBuildMaterial("G4_Au"); 82 man->FindOrBuildMaterial("G4_Pb"); 83 man->FindOrBuildMaterial("G4_PbWO4"); 84 man->FindOrBuildMaterial("G4_SODIUM_IODIDE") 85 man->FindOrBuildMaterial("G4_AIR"); 86 man->FindOrBuildMaterial("G4_WATER"); 87 88 G4Element* H = man->FindOrBuildElement("H"); 89 G4Element* O = man->FindOrBuildElement("O"); 90 91 G4Material* H2O = new G4Material("Water", 1. 92 H2O->AddElement(H, 2); 93 H2O->AddElement(O, 1); 94 H2O->GetIonisation()->SetMeanExcitationEnerg 95 96 G4double density = universe_mean_density; 97 G4double pressure = 3.e-18*pascal; 98 G4double temperature = 2.73*kelvin; 99 G4Material* Galactic = new G4Material("Gala 100 101 fDefaultMaterial = Galactic; 102 } 103 104 //....oooOO0OOooo........oooOO0OOooo........oo 105 106 107 void XraySPODetectorConstruction::SetReadFile( 108 { 109 fReadFile = std::move(input_geometry); 110 } 111 112 //....oooOO0OOooo........oooOO0OOooo........oo 113 114 G4VPhysicalVolume* XraySPODetectorConstruction 115 { 116 if (fReadFile == "") 117 { 118 G4cout << "No geometry selected!" << G4end 119 } 120 else 121 { 122 auto *InnerRegion = new G4Region("InnerReg 123 G4cout << "Build geometry from GDML file: 124 G4VPhysicalVolume* fWorldPhysVol; 125 fParser.Read(fReadFile); 126 fWorldPhysVol = fParser.GetWorldVolume(); 127 fWorld_log = fWorldPhysVol->GetLogicalVol 128 G4int num_volumes = 9; 129 auto *inner_volumes = new G4String[num_vol 130 inner_volumes[0] = "cone_1"; inner_volumes 131 inner_volumes[4] = "cone_5"; inner_volumes 132 133 G4cout << "Adding volumes to the InnerRegi 134 // Add volumes to the InnerRegion 135 for (G4int j = 0; j <= num_volumes; j++) 136 { 137 for (G4int i = 0; i < (G4int)fWorld_log- 138 { 139 if (fWorld_log->GetDaughter(i)->GetLog 140 { 141 InnerRegion->AddRootLogicalVolume(fW 142 G4cout << "Added: " << fWorld_log->G 143 } 144 } 145 } 146 fPhysiWorld = fWorldPhysVol; 147 } 148 return fPhysiWorld; 149 } 150 151 //....oooOO0OOooo........oooOO0OOooo........oo 152 153