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 // 27 // ------------------------------------------- 28 // GEANT 4 - Brachytherapy exa 29 // ------------------------------------------- 30 // 31 // Code developed by: 32 // S. Guatelli, D. Cutajar, J. Poder 33 // Centre For Medical Radiation Physics, Unive 34 // 35 // **************************************** 36 // * * 37 // * BrachyDetectorConstructionFlexi.cc* 38 // * * 39 // **************************************** 40 // 41 // 42 #include "globals.hh" 43 #include "G4SystemOfUnits.hh" 44 #include "BrachyDetectorConstructionFlexi.hh" 45 #include "G4RunManager.hh" 46 #include "G4Tubs.hh" 47 #include "G4Cons.hh" 48 #include "G4LogicalVolume.hh" 49 #include "G4ThreeVector.hh" 50 #include "G4PVPlacement.hh" 51 #include "G4Transform3D.hh" 52 #include "G4RotationMatrix.hh" 53 #include "G4TransportationManager.hh" 54 #include "G4VisAttributes.hh" 55 #include "G4Colour.hh" 56 #include "G4NistManager.hh" 57 58 BrachyDetectorConstructionFlexi::BrachyDetecto 59 : fSteelShell(nullptr), fLogicalSteelShell(n 60 fEnd1SteelShell(nullptr), fLogicalEnd1Stee 61 fEnd2SteelShell(nullptr), fLogicalEnd2Stee 62 fCable(nullptr), fLogicalCable(nullptr), f 63 fIridiumCore(nullptr), fLogicalIridiumCore 64 fSteelAttributes(nullptr), fEndAttributes( 65 {} 66 67 void BrachyDetectorConstructionFlexi::Construc 68 { 69 G4NistManager* nist = G4NistManager::Instanc 70 71 G4Material* iridiumMat = nist -> FindOrBuild 72 G4Material* airMat = nist -> FindOrBuildMate 73 74 //Define Stainless-steel-304 - Flexi source 75 G4int Z; //atomic number of the element 76 G4Element* elC = nist -> FindOrBuildElement( 77 G4Element* elMn = nist -> FindOrBuildElement 78 G4Element* elSi = nist -> FindOrBuildElement 79 G4Element* elCr = nist -> FindOrBuildElement 80 G4Element* elFe = nist -> FindOrBuildElement 81 G4Element* elNi = nist -> FindOrBuildElement 82 83 constexpr G4double d = 7.999*g/cm3; 84 auto steelMat = new G4Material("Stainless st 85 steelMat -> AddElement(elMn, 0.02); 86 steelMat -> AddElement(elSi, 0.01); 87 steelMat -> AddElement(elCr, 0.19); 88 steelMat -> AddElement(elNi, 0.10); 89 steelMat -> AddElement(elFe, 0.6792); 90 steelMat -> AddElement(elC, 0.0008); 91 92 //Define dimensions of the outer Steel shell 93 94 G4double shellr_min = 0.00 * mm; 95 G4double shellr_max = 0.85 * mm; 96 G4double shell_length = 3.6 * mm; 97 fSteelShell = new G4Tubs("steel_shell",shell 98 fLogicalSteelShell = new G4LogicalVolume(fSt 99 fPhysicalSteelShell = new G4PVPlacement(null 100 101 //Define dimensions of the air gap between Ste 102 G4double airr_min = 0.00 * mm; 103 G4double airr_max = 0.67 * mm; 104 G4double air_length = 3.6 * mm; 105 fAirGap = new G4Tubs("air_gap", airr_min, ai 106 fLogicalAirGap = new G4LogicalVolume(fAirGap 107 fPhysicalAirGap = new G4PVPlacement(nullptr, 108 109 //Define the non-cable weld end of the Steel s 110 G4double end1r_min = 0.0 * mm; 111 G4double end1r_max = 0.85 * mm; 112 G4double end1length = 0.65 * mm; 113 fEnd1SteelShell = new G4Tubs("End_1_steel_sh 114 fLogicalEnd1SteelShell = new G4LogicalVolume 115 G4double end1offset_x = 0.0 * mm; 116 G4double end1offset_y = 0.0 * mm; 117 G4double end1offset_z = 2.125 * mm; 118 fPhysicalEnd1SteelShell = new G4PVPlacement( 119 120 //Define the cable weld end of the Steel shell 121 G4double end2r_min1 = 0.0 * mm; 122 G4double end2r_max1 = 0.85 * mm; 123 G4double end2r_min2 = 0.0 * mm; 124 G4double end2r_max2 = 0.5 * mm; 125 G4double end2length = 0.4 * mm; 126 fEnd2SteelShell = new G4Cons("End_2_steel_sh 127 fLogicalEnd2SteelShell = new G4LogicalVolume 128 G4double end2offset_x = 0.0 * mm; 129 G4double end2offset_y = 0.0 * mm; 130 G4double end2offset_z = -2.0 * mm; 131 fPhysicalEnd2SteelShell = new G4PVPlacement( 132 133 //Define the cable 134 G4double cable_min = 0.0 * mm; 135 G4double cable_max = 0.5 * mm; 136 G4double cablelength = 5.0 * mm; 137 fCable = new G4Tubs("cable",cable_min, cable 138 fLogicalCable = new G4LogicalVolume(fCable, 139 G4double cableoffset_x = 0.0 * mm; 140 G4double cableoffset_y = 0.0 * mm; 141 G4double cableoffset_z = -4.7 * mm; 142 fPhysicalCable = new G4PVPlacement(nullptr,G 143 144 // Define the Iridium core 145 G4double corer_min = 0.0 * mm; 146 G4double corer_max = 0.6 * mm; 147 G4double core_length = 3.5 * mm; 148 fIridiumCore = new G4Tubs("iridium_core",cor 149 fLogicalIridiumCore = new G4LogicalVolume(fI 150 fPhysicalIridiumCore = new G4PVPlacement(nul 151 152 // Visualisations 153 154 //Shell/cable attributes 155 fSteelAttributes = new G4VisAttributes(G4Col 156 fSteelAttributes -> SetVisibility(true); 157 fSteelAttributes -> SetForceAuxEdgeVisible(t 158 159 fEndAttributes = new G4VisAttributes(G4Colou 160 fEndAttributes -> SetVisibility(true); 161 fEndAttributes -> SetForceAuxEdgeVisible(tru 162 fLogicalSteelShell -> SetVisAttributes(fStee 163 fLogicalEnd1SteelShell -> SetVisAttributes(f 164 fLogicalEnd2SteelShell -> SetVisAttributes(f 165 fLogicalCable -> SetVisAttributes(fSteelAttr 166 167 G4Colour magenta (1.0, 0.0, 1.0) ; 168 169 fSimpleIridiumVisAtt = new G4VisAttributes(m 170 fSimpleIridiumVisAtt -> SetVisibility(true); 171 fSimpleIridiumVisAtt -> SetForceWireframe(tr 172 fLogicalIridiumCore -> SetVisAttributes(fSim 173 } 174 175 void BrachyDetectorConstructionFlexi::CleanFle 176 { 177 delete fSimpleIridiumVisAtt; 178 fSimpleIridiumVisAtt = nullptr; 179 180 delete fEndAttributes; 181 fEndAttributes = nullptr; 182 183 delete fSteelAttributes; 184 fSteelAttributes = nullptr; 185 186 delete fPhysicalIridiumCore; 187 fPhysicalIridiumCore = nullptr ; 188 189 delete fLogicalIridiumCore; 190 fLogicalIridiumCore = nullptr; 191 192 delete fIridiumCore; 193 fIridiumCore = nullptr; 194 195 delete fPhysicalCable; 196 fPhysicalCable = nullptr; 197 198 delete fLogicalCable; 199 fLogicalCable = nullptr; 200 201 delete fCable; 202 fCable = nullptr; 203 204 delete fPhysicalEnd2SteelShell; 205 fPhysicalEnd2SteelShell = nullptr; 206 207 delete fLogicalEnd2SteelShell; 208 fLogicalEnd2SteelShell = nullptr; 209 210 delete fEnd2SteelShell; 211 fEnd2SteelShell = nullptr; 212 213 delete fPhysicalEnd1SteelShell; 214 fPhysicalEnd1SteelShell = nullptr; 215 216 delete fLogicalEnd1SteelShell; 217 fLogicalEnd1SteelShell = nullptr; 218 219 delete fEnd1SteelShell; 220 fEnd1SteelShell = nullptr; 221 222 delete fPhysicalAirGap; 223 fPhysicalAirGap = nullptr; 224 225 delete fLogicalAirGap; 226 fLogicalAirGap = nullptr; 227 228 delete fAirGap; 229 fAirGap = nullptr; 230 231 delete fPhysicalSteelShell; 232 fPhysicalSteelShell = nullptr; 233 234 delete fLogicalSteelShell; 235 fLogicalSteelShell = nullptr; 236 237 delete fSteelShell; 238 fSteelShell = nullptr; 239 240 G4RunManager::GetRunManager() -> GeometryHas 241 } 242