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 // $Id: BrachyDetectorConstructionTG186.cc 69765 2013-05-14 10:11:22Z gcosmo $ 40 // 41 // 41 #include "BrachyDetectorConstructionTG186.hh" << 42 #include "globals.hh" 42 #include "globals.hh" 43 #include "G4SystemOfUnits.hh" 43 #include "G4SystemOfUnits.hh" >> 44 #include "BrachyDetectorConstructionTG186.hh" 44 #include "G4Sphere.hh" 45 #include "G4Sphere.hh" 45 #include "G4RunManager.hh" 46 #include "G4RunManager.hh" 46 #include "G4Box.hh" 47 #include "G4Box.hh" 47 #include "G4Tubs.hh" 48 #include "G4Tubs.hh" 48 #include "G4LogicalVolume.hh" 49 #include "G4LogicalVolume.hh" 49 #include "G4ThreeVector.hh" 50 #include "G4ThreeVector.hh" 50 #include "G4PVPlacement.hh" 51 #include "G4PVPlacement.hh" 51 #include "G4Transform3D.hh" 52 #include "G4Transform3D.hh" 52 #include "G4RotationMatrix.hh" 53 #include "G4RotationMatrix.hh" 53 #include "G4TransportationManager.hh" 54 #include "G4TransportationManager.hh" >> 55 #include "BrachyMaterial.hh" 54 #include "G4VisAttributes.hh" 56 #include "G4VisAttributes.hh" 55 #include "G4Colour.hh" 57 #include "G4Colour.hh" 56 #include "G4NistManager.hh" << 57 58 58 BrachyDetectorConstructionTG186::BrachyDetecto << 59 BrachyDetectorConstructionTG186::BrachyDetectorConstructionTG186() 59 fTG186capsule(nullptr), fTG186capsuleLog(nu << 60 : 60 fTG186capsulePhys(nullptr), << 61 TG186capsule(0),TG186capsuleLog(0), 61 fTG186capsuleTip(nullptr), fTG186capsuleTip << 62 TG186capsulePhys(0), 62 fTG186capsuleTipPhys(nullptr), << 63 TG186capsuleTip(0),TG186capsuleTipLog(0), 63 fTG186iridiumCore(nullptr), fTG186iridiumCo << 64 TG186capsuleTipPhys(0), 64 fTG186iridiumCorePhys(nullptr), << 65 TG186iridiumCore(0),TG186iridiumCoreLog(0), 65 fTG186cable(nullptr), fTG186cableLog(nullpt << 66 TG186iridiumCorePhys(0), 66 fTG186cablePhys(nullptr), << 67 TG186cable(0),TG186cableLog(0), 67 fTG186simpleCapsuleVisAtt(nullptr), fTG186s << 68 TG186cablePhys(0), 68 fTG186simpleCableVisAtt(nullptr) << 69 TG186simpleCapsuleVisAtt(0),TG186simpleCapsuleTipVisAtt(0),TG186simpleIridiumVisAtt(0), 69 {} << 70 TG186simpleCableVisAtt(0) >> 71 { >> 72 pMat = new BrachyMaterial(); >> 73 } >> 74 >> 75 BrachyDetectorConstructionTG186::~BrachyDetectorConstructionTG186() >> 76 { >> 77 delete pMat; >> 78 } 70 79 71 void BrachyDetectorConstructionTG186::Construc 80 void BrachyDetectorConstructionTG186::ConstructTG186(G4VPhysicalVolume* mother) 72 { 81 { 73 G4Colour red (1.0, 0.0, 0.0) ; 82 G4Colour red (1.0, 0.0, 0.0) ; 74 G4Colour magenta (1.0, 0.0, 1.0) ; 83 G4Colour magenta (1.0, 0.0, 1.0) ; 75 84 76 G4NistManager* nist = G4NistManager::Instanc << 85 G4Material* capsuleMat = pMat -> GetMat("Stainless steel"); 77 auto iridium = nist -> FindOrBuildMaterial(" << 86 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 87 95 // Capsule main body 88 // Capsule main body 96 fTG186capsule = new G4Tubs("TG186-Capsule",0 << 89 TG186capsule = new G4Tubs("TG186-Capsule",0,0.5*mm,2.25*mm,0.*deg,360.*deg); 97 fTG186capsuleLog = new G4LogicalVolume(fTG18 << 90 TG186capsuleLog = new G4LogicalVolume(TG186capsule,capsuleMat,"TG186-CapsuleLog"); 98 fTG186capsulePhys = new G4PVPlacement(nullpt << 91 TG186capsulePhys = new G4PVPlacement(0, 99 G4ThreeVector 92 G4ThreeVector(0,0,-0.4*mm), 100 "TG186-Iridiu 93 "TG186-IridiumCapsulePhys", 101 fTG186capsule << 94 TG186capsuleLog, 102 mother, 95 mother, 103 false, 96 false, 104 0, true); 97 0, true); 105 98 106 // Capsule tip 99 // Capsule tip 107 fTG186capsuleTip = new G4Sphere("Tg186-Capsu << 100 TG186capsuleTip = new G4Sphere("Tg186-CapsuleTipIridium", 108 0.*mm, 101 0.*mm, 109 0.5*mm, 102 0.5*mm, 110 0.*deg, 103 0.*deg, 111 360.*deg, 104 360.*deg, 112 0.*deg, 105 0.*deg, 113 90.*deg); 106 90.*deg); 114 107 115 fTG186capsuleTipLog = new G4LogicalVolume(fT << 108 TG186capsuleTipLog = new G4LogicalVolume(TG186capsuleTip, 116 capsuleM 109 capsuleMat, 117 "Capsule 110 "CapsuleTipIridumLog"); 118 << 111 TG186capsuleTipPhys = new G4PVPlacement(0, 119 fTG186capsuleTipPhys = new G4PVPlacement(nul << 120 G4ThreeVe 112 G4ThreeVector(0.,0.,1.85*mm), 121 "TG186-Ca 113 "TG186-CapsuleTipIridiumPhys", 122 fTG186cap << 114 TG186capsuleTipLog, 123 mother, 115 mother, 124 false, 116 false, 125 0, true); 117 0, true); 126 118 127 fTG186cable = new G4Tubs("TG186-cable", << 119 TG186cable = new G4Tubs("TG186-cable", 128 0.*mm, 120 0.*mm, 129 0.5*mm, 121 0.5*mm, 130 1.0*mm, << 122 1.0*mm, 131 0.*deg, 123 0.*deg, 132 360.*deg); 124 360.*deg); 133 125 134 fTG186cableLog = new G4LogicalVolume(fTG186c << 126 TG186cableLog = new G4LogicalVolume(TG186cable, 135 capsuleM 127 capsuleMat, 136 "TG186-c 128 "TG186-cableLog"); 137 << 129 TG186cablePhys = new G4PVPlacement(0, 138 fTG186cablePhys = new G4PVPlacement(nullptr, << 139 G4ThreeVe 130 G4ThreeVector(0.,0.,-3.65*mm), 140 "TG186-Ca 131 "TG186-CablePhys", 141 fTG186cab << 132 TG186cableLog, 142 mother, 133 mother, 143 false, 134 false, 144 0, true); 135 0, true); 145 136 146 // Iridium core 137 // Iridium core 147 fTG186iridiumCore = new G4Tubs("TG186-IrCore << 138 TG186iridiumCore = new G4Tubs("TG186-IrCore",0,0.30*mm,1.75*mm,0.*deg,360.*deg); 148 << 139 TG186iridiumCoreLog = new G4LogicalVolume(TG186iridiumCore, 149 fTG186iridiumCoreLog = new G4LogicalVolume(f << 140 iridiumMat, 150 iridium << 151 "TG186- 141 "TG186-IridiumCoreLog"); 152 << 142 TG186iridiumCorePhys = new G4PVPlacement(0, 153 fTG186iridiumCorePhys = new G4PVPlacement(nu << 154 G4ThreeV 143 G4ThreeVector(0,0,0.4*mm), 155 "TG186-I 144 "TG186-IridiumCorePhys", 156 fTG186ir << 145 TG186iridiumCoreLog, 157 fTG186ca << 146 TG186capsulePhys, 158 false, 147 false, 159 0, true) 148 0, true); 160 149 161 fTG186simpleCapsuleVisAtt = new G4VisAttribu << 150 TG186simpleCapsuleVisAtt = new G4VisAttributes(red); 162 fTG186simpleCapsuleVisAtt -> SetVisibility(t << 151 TG186simpleCapsuleVisAtt -> SetVisibility(true); 163 fTG186simpleCapsuleVisAtt -> SetForceWirefra << 152 TG186simpleCapsuleVisAtt -> SetForceWireframe(true); 164 fTG186capsuleLog -> SetVisAttributes(fTG186s << 153 TG186capsuleLog -> SetVisAttributes(TG186simpleCapsuleVisAtt); 165 << 154 166 fTG186simpleCapsuleTipVisAtt = new G4VisAttr << 155 TG186simpleCapsuleTipVisAtt = new G4VisAttributes(red); 167 fTG186simpleCapsuleTipVisAtt -> SetVisibilit << 156 TG186simpleCapsuleTipVisAtt -> SetVisibility(true); 168 fTG186simpleCapsuleTipVisAtt -> SetForceSoli << 157 TG186simpleCapsuleTipVisAtt -> SetForceSolid(true); 169 fTG186capsuleTipLog -> SetVisAttributes(fTG1 << 158 TG186capsuleTipLog -> SetVisAttributes(TG186simpleCapsuleTipVisAtt); 170 << 159 171 fTG186simpleIridiumVisAtt = new G4VisAttribu << 160 TG186simpleIridiumVisAtt = new G4VisAttributes(magenta); 172 fTG186simpleIridiumVisAtt -> SetVisibility(t << 161 TG186simpleIridiumVisAtt -> SetVisibility(true); 173 fTG186simpleIridiumVisAtt -> SetForceWirefra << 162 TG186simpleIridiumVisAtt -> SetForceWireframe(true); 174 fTG186iridiumCoreLog -> SetVisAttributes(fTG << 163 TG186iridiumCoreLog -> SetVisAttributes(TG186simpleIridiumVisAtt); 175 << 164 176 fTG186simpleCableVisAtt = new G4VisAttribute << 165 TG186simpleCableVisAtt = new G4VisAttributes(red); 177 fTG186simpleCableVisAtt -> SetVisibility(tru << 166 TG186simpleCableVisAtt -> SetVisibility(true); 178 fTG186simpleCableVisAtt -> SetForceSolid(tru << 167 TG186simpleCableVisAtt -> SetForceSolid(true); 179 fTG186cableLog -> SetVisAttributes(fTG186sim << 168 TG186cableLog -> SetVisAttributes(TG186simpleCableVisAtt); 180 } 169 } 181 170 182 void BrachyDetectorConstructionTG186::CleanTG1 171 void BrachyDetectorConstructionTG186::CleanTG186() 183 { 172 { 184 173 185 delete fTG186simpleIridiumVisAtt; << 174 delete TG186simpleIridiumVisAtt; 186 fTG186simpleIridiumVisAtt = nullptr; << 175 TG186simpleIridiumVisAtt = 0; 187 176 188 delete fTG186iridiumCorePhys; << 177 delete TG186iridiumCorePhys; 189 fTG186iridiumCorePhys = nullptr; << 178 TG186iridiumCorePhys = 0; 190 179 191 delete fTG186iridiumCore; << 180 delete TG186iridiumCore; 192 fTG186iridiumCore = nullptr; << 181 TG186iridiumCore = 0; 193 182 194 delete fTG186iridiumCoreLog; << 183 delete TG186iridiumCoreLog; 195 fTG186iridiumCoreLog = nullptr ; << 184 TG186iridiumCoreLog = 0 ; 196 185 197 delete fTG186simpleCapsuleTipVisAtt; << 186 delete TG186simpleCapsuleTipVisAtt; 198 fTG186simpleCapsuleTipVisAtt = nullptr; << 187 TG186simpleCapsuleTipVisAtt = 0; 199 188 200 delete fTG186capsuleTipPhys; << 189 delete TG186capsuleTipPhys; 201 fTG186capsuleTipPhys = nullptr; << 190 TG186capsuleTipPhys = 0; 202 191 203 delete fTG186capsuleTip; << 192 delete TG186capsuleTip; 204 fTG186capsuleTip = nullptr; << 193 TG186capsuleTip = 0; 205 194 206 delete fTG186capsuleTipLog; << 195 delete TG186capsuleTipLog; 207 fTG186capsuleTipLog = nullptr; << 196 TG186capsuleTipLog = 0; 208 197 209 delete fTG186simpleCapsuleVisAtt; << 198 delete TG186simpleCapsuleVisAtt; 210 fTG186simpleCapsuleVisAtt = nullptr; << 199 TG186simpleCapsuleVisAtt = 0; 211 200 212 delete fTG186capsulePhys; << 201 delete TG186capsulePhys; 213 fTG186capsulePhys = nullptr; << 202 TG186capsulePhys = 0; 214 203 215 delete fTG186capsule; << 204 delete TG186capsule; 216 fTG186capsule = nullptr; << 205 TG186capsule = 0; 217 206 218 delete fTG186capsuleLog; << 207 delete TG186capsuleLog; 219 fTG186capsuleLog = nullptr; << 208 TG186capsuleLog = 0; 220 209 221 delete fTG186cable; << 210 delete TG186cable; 222 fTG186cable = nullptr; << 211 TG186cable = 0; 223 212 224 delete fTG186cableLog; << 213 delete TG186cableLog; 225 fTG186cableLog = nullptr; << 214 TG186cableLog = 0; 226 215 227 delete fTG186cablePhys; << 216 delete TG186cablePhys; 228 fTG186cablePhys = nullptr; << 217 TG186cablePhys = 0; 229 218 230 delete fTG186simpleCableVisAtt; << 219 delete TG186simpleCableVisAtt; 231 fTG186simpleCableVisAtt = nullptr; << 220 TG186simpleCableVisAtt = 0; 232 221 233 G4RunManager::GetRunManager() -> GeometryHas 222 G4RunManager::GetRunManager() -> GeometryHasBeenModified(); 234 } 223 } 235 224