Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // 26 // 27 // ------------------------------------------- 27 // -------------------------------------------------------------- 28 // GEANT 4 - Brachytherapy exa 28 // GEANT 4 - Brachytherapy example 29 // ------------------------------------------- 29 // -------------------------------------------------------------- 30 // 30 // 31 // Code developed by: 31 // Code developed by: 32 // D. Cutajar 32 // D. Cutajar 33 // 33 // 34 // **************************************** 34 // **************************************** 35 // * * 35 // * * 36 // * BrachyDetectorConstructionTG186.cc 36 // * BrachyDetectorConstructionTG186.cc * 37 // * * 37 // * * 38 // **************************************** 38 // **************************************** 39 // 39 // 40 // 40 // 41 #include "BrachyDetectorConstructionTG186.hh" << 42 #include "globals.hh" 41 #include "globals.hh" 43 #include "G4SystemOfUnits.hh" 42 #include "G4SystemOfUnits.hh" >> 43 #include "BrachyDetectorConstructionTG186.hh" 44 #include "G4Sphere.hh" 44 #include "G4Sphere.hh" 45 #include "G4RunManager.hh" 45 #include "G4RunManager.hh" 46 #include "G4Box.hh" 46 #include "G4Box.hh" 47 #include "G4Tubs.hh" 47 #include "G4Tubs.hh" 48 #include "G4LogicalVolume.hh" 48 #include "G4LogicalVolume.hh" 49 #include "G4ThreeVector.hh" 49 #include "G4ThreeVector.hh" 50 #include "G4PVPlacement.hh" 50 #include "G4PVPlacement.hh" 51 #include "G4Transform3D.hh" 51 #include "G4Transform3D.hh" 52 #include "G4RotationMatrix.hh" 52 #include "G4RotationMatrix.hh" 53 #include "G4TransportationManager.hh" 53 #include "G4TransportationManager.hh" >> 54 #include "BrachyMaterial.hh" 54 #include "G4VisAttributes.hh" 55 #include "G4VisAttributes.hh" 55 #include "G4Colour.hh" 56 #include "G4Colour.hh" 56 #include "G4NistManager.hh" << 57 57 58 BrachyDetectorConstructionTG186::BrachyDetecto << 58 BrachyDetectorConstructionTG186::BrachyDetectorConstructionTG186() 59 fTG186capsule(nullptr), fTG186capsuleLog(nu << 59 : 60 fTG186capsulePhys(nullptr), << 60 TG186capsule(0),TG186capsuleLog(0), 61 fTG186capsuleTip(nullptr), fTG186capsuleTip << 61 TG186capsulePhys(0), 62 fTG186capsuleTipPhys(nullptr), << 62 TG186capsuleTip(0),TG186capsuleTipLog(0), 63 fTG186iridiumCore(nullptr), fTG186iridiumCo << 63 TG186capsuleTipPhys(0), 64 fTG186iridiumCorePhys(nullptr), << 64 TG186iridiumCore(0),TG186iridiumCoreLog(0), 65 fTG186cable(nullptr), fTG186cableLog(nullpt << 65 TG186iridiumCorePhys(0), 66 fTG186cablePhys(nullptr), << 66 TG186cable(0),TG186cableLog(0), 67 fTG186simpleCapsuleVisAtt(nullptr), fTG186s << 67 TG186cablePhys(0), 68 fTG186simpleCableVisAtt(nullptr) << 68 TG186simpleCapsuleVisAtt(0),TG186simpleCapsuleTipVisAtt(0),TG186simpleIridiumVisAtt(0), 69 {} << 69 TG186simpleCableVisAtt(0) >> 70 { >> 71 pMat = new BrachyMaterial(); >> 72 } >> 73 >> 74 BrachyDetectorConstructionTG186::~BrachyDetectorConstructionTG186() >> 75 { >> 76 delete pMat; >> 77 } 70 78 71 void BrachyDetectorConstructionTG186::Construc 79 void BrachyDetectorConstructionTG186::ConstructTG186(G4VPhysicalVolume* mother) 72 { 80 { 73 G4Colour red (1.0, 0.0, 0.0) ; 81 G4Colour red (1.0, 0.0, 0.0) ; 74 G4Colour magenta (1.0, 0.0, 1.0) ; 82 G4Colour magenta (1.0, 0.0, 1.0) ; 75 83 76 G4NistManager* nist = G4NistManager::Instanc << 84 G4Material* capsuleMat = pMat -> GetMat("Stainless steel"); 77 auto iridium = nist -> FindOrBuildMaterial(" << 85 G4Material* iridiumMat = pMat -> GetMat("Iridium"); 78 << 79 // Stainless steel (Medical Physics, Vol 25, << 80 constexpr G4double d = 8.02*g/cm3; << 81 G4int Z; //atomic number of the element << 82 G4Element* elMn = nist -> FindOrBuildElement << 83 G4Element* elSi = nist -> FindOrBuildElement << 84 G4Element* elCr = nist -> FindOrBuildElement << 85 G4Element* elFe = nist -> FindOrBuildElement << 86 G4Element* elNi = nist -> FindOrBuildElement << 87 auto capsuleMat = new G4Material("Stainless << 88 capsuleMat -> AddElement(elMn, 0.02); << 89 capsuleMat -> AddElement(elSi, 0.01); << 90 capsuleMat -> AddElement(elCr, 0.19); << 91 capsuleMat -> AddElement(elNi, 0.10); << 92 capsuleMat -> AddElement(elFe, 0.68); << 93 << 94 86 95 // Capsule main body 87 // Capsule main body 96 fTG186capsule = new G4Tubs("TG186-Capsule",0 << 88 TG186capsule = new G4Tubs("TG186-Capsule",0,0.5*mm,2.25*mm,0.*deg,360.*deg); 97 fTG186capsuleLog = new G4LogicalVolume(fTG18 << 89 TG186capsuleLog = new G4LogicalVolume(TG186capsule,capsuleMat,"TG186-CapsuleLog"); 98 fTG186capsulePhys = new G4PVPlacement(nullpt << 90 TG186capsulePhys = new G4PVPlacement(0, 99 G4ThreeVector 91 G4ThreeVector(0,0,-0.4*mm), 100 "TG186-Iridiu 92 "TG186-IridiumCapsulePhys", 101 fTG186capsule << 93 TG186capsuleLog, 102 mother, 94 mother, 103 false, 95 false, 104 0, true); 96 0, true); 105 97 106 // Capsule tip 98 // Capsule tip 107 fTG186capsuleTip = new G4Sphere("Tg186-Capsu << 99 TG186capsuleTip = new G4Sphere("Tg186-CapsuleTipIridium", 108 0.*mm, 100 0.*mm, 109 0.5*mm, 101 0.5*mm, 110 0.*deg, 102 0.*deg, 111 360.*deg, 103 360.*deg, 112 0.*deg, 104 0.*deg, 113 90.*deg); 105 90.*deg); 114 106 115 fTG186capsuleTipLog = new G4LogicalVolume(fT << 107 TG186capsuleTipLog = new G4LogicalVolume(TG186capsuleTip, 116 capsuleM 108 capsuleMat, 117 "Capsule 109 "CapsuleTipIridumLog"); 118 << 110 TG186capsuleTipPhys = new G4PVPlacement(0, 119 fTG186capsuleTipPhys = new G4PVPlacement(nul << 120 G4ThreeVe 111 G4ThreeVector(0.,0.,1.85*mm), 121 "TG186-Ca 112 "TG186-CapsuleTipIridiumPhys", 122 fTG186cap << 113 TG186capsuleTipLog, 123 mother, 114 mother, 124 false, 115 false, 125 0, true); 116 0, true); 126 117 127 fTG186cable = new G4Tubs("TG186-cable", << 118 TG186cable = new G4Tubs("TG186-cable", 128 0.*mm, 119 0.*mm, 129 0.5*mm, 120 0.5*mm, 130 1.0*mm, << 121 1.0*mm, 131 0.*deg, 122 0.*deg, 132 360.*deg); 123 360.*deg); 133 124 134 fTG186cableLog = new G4LogicalVolume(fTG186c << 125 TG186cableLog = new G4LogicalVolume(TG186cable, 135 capsuleM 126 capsuleMat, 136 "TG186-c 127 "TG186-cableLog"); 137 << 128 TG186cablePhys = new G4PVPlacement(0, 138 fTG186cablePhys = new G4PVPlacement(nullptr, << 139 G4ThreeVe 129 G4ThreeVector(0.,0.,-3.65*mm), 140 "TG186-Ca 130 "TG186-CablePhys", 141 fTG186cab << 131 TG186cableLog, 142 mother, 132 mother, 143 false, 133 false, 144 0, true); 134 0, true); 145 135 146 // Iridium core 136 // Iridium core 147 fTG186iridiumCore = new G4Tubs("TG186-IrCore << 137 TG186iridiumCore = new G4Tubs("TG186-IrCore",0,0.30*mm,1.75*mm,0.*deg,360.*deg); 148 << 138 TG186iridiumCoreLog = new G4LogicalVolume(TG186iridiumCore, 149 fTG186iridiumCoreLog = new G4LogicalVolume(f << 139 iridiumMat, 150 iridium << 151 "TG186- 140 "TG186-IridiumCoreLog"); 152 << 141 TG186iridiumCorePhys = new G4PVPlacement(0, 153 fTG186iridiumCorePhys = new G4PVPlacement(nu << 154 G4ThreeV 142 G4ThreeVector(0,0,0.4*mm), 155 "TG186-I 143 "TG186-IridiumCorePhys", 156 fTG186ir << 144 TG186iridiumCoreLog, 157 fTG186ca << 145 TG186capsulePhys, 158 false, 146 false, 159 0, true) 147 0, true); 160 148 161 fTG186simpleCapsuleVisAtt = new G4VisAttribu << 149 TG186simpleCapsuleVisAtt = new G4VisAttributes(red); 162 fTG186simpleCapsuleVisAtt -> SetVisibility(t << 150 TG186simpleCapsuleVisAtt -> SetVisibility(true); 163 fTG186simpleCapsuleVisAtt -> SetForceWirefra << 151 TG186simpleCapsuleVisAtt -> SetForceWireframe(true); 164 fTG186capsuleLog -> SetVisAttributes(fTG186s << 152 TG186capsuleLog -> SetVisAttributes(TG186simpleCapsuleVisAtt); 165 << 153 166 fTG186simpleCapsuleTipVisAtt = new G4VisAttr << 154 TG186simpleCapsuleTipVisAtt = new G4VisAttributes(red); 167 fTG186simpleCapsuleTipVisAtt -> SetVisibilit << 155 TG186simpleCapsuleTipVisAtt -> SetVisibility(true); 168 fTG186simpleCapsuleTipVisAtt -> SetForceSoli << 156 TG186simpleCapsuleTipVisAtt -> SetForceSolid(true); 169 fTG186capsuleTipLog -> SetVisAttributes(fTG1 << 157 TG186capsuleTipLog -> SetVisAttributes(TG186simpleCapsuleTipVisAtt); 170 << 158 171 fTG186simpleIridiumVisAtt = new G4VisAttribu << 159 TG186simpleIridiumVisAtt = new G4VisAttributes(magenta); 172 fTG186simpleIridiumVisAtt -> SetVisibility(t << 160 TG186simpleIridiumVisAtt -> SetVisibility(true); 173 fTG186simpleIridiumVisAtt -> SetForceWirefra << 161 TG186simpleIridiumVisAtt -> SetForceWireframe(true); 174 fTG186iridiumCoreLog -> SetVisAttributes(fTG << 162 TG186iridiumCoreLog -> SetVisAttributes(TG186simpleIridiumVisAtt); 175 << 163 176 fTG186simpleCableVisAtt = new G4VisAttribute << 164 TG186simpleCableVisAtt = new G4VisAttributes(red); 177 fTG186simpleCableVisAtt -> SetVisibility(tru << 165 TG186simpleCableVisAtt -> SetVisibility(true); 178 fTG186simpleCableVisAtt -> SetForceSolid(tru << 166 TG186simpleCableVisAtt -> SetForceSolid(true); 179 fTG186cableLog -> SetVisAttributes(fTG186sim << 167 TG186cableLog -> SetVisAttributes(TG186simpleCableVisAtt); 180 } 168 } 181 169 182 void BrachyDetectorConstructionTG186::CleanTG1 170 void BrachyDetectorConstructionTG186::CleanTG186() 183 { 171 { 184 172 185 delete fTG186simpleIridiumVisAtt; << 173 delete TG186simpleIridiumVisAtt; 186 fTG186simpleIridiumVisAtt = nullptr; << 174 TG186simpleIridiumVisAtt = 0; 187 175 188 delete fTG186iridiumCorePhys; << 176 delete TG186iridiumCorePhys; 189 fTG186iridiumCorePhys = nullptr; << 177 TG186iridiumCorePhys = 0; 190 178 191 delete fTG186iridiumCore; << 179 delete TG186iridiumCore; 192 fTG186iridiumCore = nullptr; << 180 TG186iridiumCore = 0; 193 181 194 delete fTG186iridiumCoreLog; << 182 delete TG186iridiumCoreLog; 195 fTG186iridiumCoreLog = nullptr ; << 183 TG186iridiumCoreLog = 0 ; 196 184 197 delete fTG186simpleCapsuleTipVisAtt; << 185 delete TG186simpleCapsuleTipVisAtt; 198 fTG186simpleCapsuleTipVisAtt = nullptr; << 186 TG186simpleCapsuleTipVisAtt = 0; 199 187 200 delete fTG186capsuleTipPhys; << 188 delete TG186capsuleTipPhys; 201 fTG186capsuleTipPhys = nullptr; << 189 TG186capsuleTipPhys = 0; 202 190 203 delete fTG186capsuleTip; << 191 delete TG186capsuleTip; 204 fTG186capsuleTip = nullptr; << 192 TG186capsuleTip = 0; 205 193 206 delete fTG186capsuleTipLog; << 194 delete TG186capsuleTipLog; 207 fTG186capsuleTipLog = nullptr; << 195 TG186capsuleTipLog = 0; 208 196 209 delete fTG186simpleCapsuleVisAtt; << 197 delete TG186simpleCapsuleVisAtt; 210 fTG186simpleCapsuleVisAtt = nullptr; << 198 TG186simpleCapsuleVisAtt = 0; 211 199 212 delete fTG186capsulePhys; << 200 delete TG186capsulePhys; 213 fTG186capsulePhys = nullptr; << 201 TG186capsulePhys = 0; 214 202 215 delete fTG186capsule; << 203 delete TG186capsule; 216 fTG186capsule = nullptr; << 204 TG186capsule = 0; 217 205 218 delete fTG186capsuleLog; << 206 delete TG186capsuleLog; 219 fTG186capsuleLog = nullptr; << 207 TG186capsuleLog = 0; 220 208 221 delete fTG186cable; << 209 delete TG186cable; 222 fTG186cable = nullptr; << 210 TG186cable = 0; 223 211 224 delete fTG186cableLog; << 212 delete TG186cableLog; 225 fTG186cableLog = nullptr; << 213 TG186cableLog = 0; 226 214 227 delete fTG186cablePhys; << 215 delete TG186cablePhys; 228 fTG186cablePhys = nullptr; << 216 TG186cablePhys = 0; 229 217 230 delete fTG186simpleCableVisAtt; << 218 delete TG186simpleCableVisAtt; 231 fTG186simpleCableVisAtt = nullptr; << 219 TG186simpleCableVisAtt = 0; 232 220 233 G4RunManager::GetRunManager() -> GeometryHas 221 G4RunManager::GetRunManager() -> GeometryHasBeenModified(); 234 } 222 } 235 223