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: S.Guatelli 31 // Code developed by: S.Guatelli 32 // 32 // 33 /// *************************************** 33 /// **************************************** 34 // * * 34 // * * 35 // * BrachyDetectorConstructionI.cc 35 // * BrachyDetectorConstructionI.cc * 36 // * * 36 // * * 37 // **************************************** 37 // **************************************** 38 // 38 // 39 // 39 // 40 #include "BrachyDetectorConstructionI.hh" << 41 #include "globals.hh" 40 #include "globals.hh" 42 #include "G4SystemOfUnits.hh" 41 #include "G4SystemOfUnits.hh" >> 42 #include "BrachyDetectorConstructionI.hh" 43 #include "G4CSGSolid.hh" 43 #include "G4CSGSolid.hh" 44 #include "G4Sphere.hh" 44 #include "G4Sphere.hh" 45 #include "G4MaterialPropertyVector.hh" 45 #include "G4MaterialPropertyVector.hh" 46 #include "G4RunManager.hh" 46 #include "G4RunManager.hh" 47 #include "G4Box.hh" 47 #include "G4Box.hh" 48 #include "G4Tubs.hh" 48 #include "G4Tubs.hh" 49 #include "G4LogicalVolume.hh" 49 #include "G4LogicalVolume.hh" 50 #include "G4ThreeVector.hh" 50 #include "G4ThreeVector.hh" 51 #include "G4PVPlacement.hh" 51 #include "G4PVPlacement.hh" 52 #include "G4Transform3D.hh" 52 #include "G4Transform3D.hh" 53 #include "G4RotationMatrix.hh" 53 #include "G4RotationMatrix.hh" 54 #include "G4TransportationManager.hh" 54 #include "G4TransportationManager.hh" >> 55 #include "BrachyMaterial.hh" 55 #include "G4VisAttributes.hh" 56 #include "G4VisAttributes.hh" 56 #include "G4Colour.hh" 57 #include "G4Colour.hh" 57 #include "G4NistManager.hh" << 58 58 59 BrachyDetectorConstructionI::BrachyDetectorCon 59 BrachyDetectorConstructionI::BrachyDetectorConstructionI(): 60 fDefaultTub(nullptr), fCapsule(nullptr), fCaps << 60 defaultTub(0), capsule(0), capsuleTip(0),iodiumCore(0), defaultTubLog(0), 61 fCapsuleLog(nullptr), fCapsuleTipLog(nullptr), << 61 capsuleLog(0), capsuleTipLog(0), iodiumCoreLog(0),defaultTubPhys(0), 62 fCapsulePhys(nullptr),fCapsuleTipPhys1(nullptr << 62 capsulePhys(0),capsuleTipPhys1(0),capsuleTipPhys2(0), iodiumCorePhys(0), 63 fSimpleIodineVisAtt(nullptr), fSimpleCapsuleVi << 63 simpleiodiumVisAtt(0), simpleCapsuleVisAtt(0), simpleCapsuleTipVisAtt(0) 64 {} << 64 { >> 65 pMaterial = new BrachyMaterial(); >> 66 } >> 67 >> 68 BrachyDetectorConstructionI::~BrachyDetectorConstructionI() >> 69 { >> 70 delete pMaterial; >> 71 } 65 72 66 void BrachyDetectorConstructionI::ConstructIod << 73 void BrachyDetectorConstructionI::ConstructIodium(G4VPhysicalVolume* mother) 67 { 74 { 68 // Model of the Bebig Isoseed I-125 brachy s << 75 // source Bebig Isoseed I-125 ... 69 G4NistManager* nist = G4NistManager::Instanc << 76 70 G4Material* titanium = nist -> FindOrBuildMa << 77 //Get materials for source construction ... 71 G4Material* iodine = nist -> FindOrBuildMate << 78 G4Material* titanium = pMaterial -> GetMat("titanium"); 72 G4Material* air = nist -> FindOrBuildMateria << 79 G4Material* air = pMaterial -> GetMat("Air"); 73 << 80 G4Material* iodium = pMaterial -> GetMat("Iodine"); >> 81 74 G4Colour red (1.0, 0.0, 0.0) ; 82 G4Colour red (1.0, 0.0, 0.0) ; 75 G4Colour magenta (1.0, 0.0, 1.0) ; 83 G4Colour magenta (1.0, 0.0, 1.0) ; 76 G4Colour lblue (0.0, 0.0, .75); 84 G4Colour lblue (0.0, 0.0, .75); 77 85 78 // Air tub 86 // Air tub 79 fDefaultTub = new G4Tubs("DefaultTub",0.*mm, << 87 defaultTub = new G4Tubs("DefaultTub",0.*mm, 0.40*mm, 1.84*mm, 0.*deg, 360.*deg); 80 fDefaultTubLog = new G4LogicalVolume(fDefaul << 88 defaultTubLog = new G4LogicalVolume(defaultTub,air,"DefaultTub_Log"); 81 fDefaultTubPhys = new G4PVPlacement(nullptr, << 89 defaultTubPhys = new G4PVPlacement(0, 82 G4ThreeV 90 G4ThreeVector(), 83 "default 91 "defaultTub_Phys", 84 fDefault << 92 defaultTubLog, 85 mother, 93 mother, 86 false, 94 false, 87 0, true) 95 0, true); 88 // Capsule main body ... << 96 // Capsule main body ... 89 fCapsule = new G4Tubs("fCapsule", 0.35*mm,0. << 97 G4double capsuleR = 0.35*mm; 90 fCapsuleLog = new G4LogicalVolume(fCapsule,t << 98 capsule = new G4Tubs("Capsule", capsuleR,0.40*mm,1.84*mm,0.*deg,360.*deg); 91 fCapsulePhys = new G4PVPlacement(nullptr, << 99 capsuleLog = new G4LogicalVolume(capsule,titanium,"CapsuleLog"); >> 100 capsulePhys = new G4PVPlacement(0, 92 G4ThreeVecto 101 G4ThreeVector(), 93 "fCapsulePhy << 102 "CapsulePhys", 94 fCapsuleLog, << 103 capsuleLog, 95 fDefaultTubP << 104 defaultTubPhys, 96 false, 105 false, 97 0, true); 106 0, true); 98 // fCapsule tips << 107 // Capsule tips 99 fCapsuleTip = new G4Sphere("fCapsuleTip", << 108 capsuleTip = new G4Sphere("CapsuleTip", 100 0.*mm, 109 0.*mm, 101 0.40*mm, 110 0.40*mm, 102 0.*deg, 111 0.*deg, 103 360.*deg, 112 360.*deg, 104 0.*deg, 113 0.*deg, 105 90.*deg); 114 90.*deg); 106 << 115 capsuleTipLog = new G4LogicalVolume(capsuleTip,titanium,"CapsuleTipLog"); 107 fCapsuleTipLog = new G4LogicalVolume(fCapsul << 116 capsuleTipPhys1 = new G4PVPlacement(0, 108 fCapsuleTipPhys1 = new G4PVPlacement(nullptr << 109 G4ThreeV 117 G4ThreeVector(0.,0.,1.84*mm), 110 "Iodinef << 118 "IodineCapsuleTipPhys1", 111 fCapsule << 119 capsuleTipLog, 112 mother, 120 mother, 113 false, 121 false, 114 0, true) 122 0, true); 115 123 116 auto rotateMatrix = new G4RotationMatrix(); << 124 G4RotationMatrix* rotateMatrix = new G4RotationMatrix(); 117 rotateMatrix -> rotateX(180.0*deg); 125 rotateMatrix -> rotateX(180.0*deg); 118 fCapsuleTipPhys2 = new G4PVPlacement(rotateM << 126 capsuleTipPhys2 = new G4PVPlacement(rotateMatrix, 119 G4ThreeV 127 G4ThreeVector(0,0,-1.84*mm), 120 "Iodinef << 128 "IodineCapsuleTipPhys2", 121 fCapsule << 129 capsuleTipLog, 122 mother, 130 mother, 123 false, 131 false, 124 0, true) 132 0, true); 125 133 126 // Radiactive core ... 134 // Radiactive core ... 127 fIodineCore = new G4Tubs("ICore",0.085*mm,0. << 135 iodiumCore = new G4Tubs("ICore",0.085*mm,0.35*mm,1.75*mm,0.*deg,360.*deg); 128 fIodineCoreLog = new G4LogicalVolume(fIodine << 136 iodiumCoreLog = new G4LogicalVolume(iodiumCore,iodium,"iodiumCoreLog"); 129 fIodineCorePhys = new G4PVPlacement(nullptr, << 137 iodiumCorePhys = new G4PVPlacement(0, 130 G4ThreeVe 138 G4ThreeVector(0.,0.,0.), 131 "IodineCo << 139 "iodiumCorePhys", 132 fIodineCo << 140 iodiumCoreLog, 133 fDefaultT << 141 defaultTubPhys, 134 false, 142 false, 135 0, true); 143 0, true); 136 144 137 // Visual attributes ... 145 // Visual attributes ... 138 146 139 fSimpleIodineVisAtt = new G4VisAttributes(ma << 147 simpleiodiumVisAtt= new G4VisAttributes(magenta); 140 fSimpleIodineVisAtt -> SetVisibility(true); << 148 simpleiodiumVisAtt -> SetVisibility(true); 141 fSimpleIodineVisAtt -> SetForceSolid(true); << 149 simpleiodiumVisAtt -> SetForceSolid(true); 142 fIodineCoreLog -> SetVisAttributes(fSimpleIo << 150 iodiumCoreLog -> SetVisAttributes(simpleiodiumVisAtt); 143 << 151 144 fSimpleCapsuleVisAtt = new G4VisAttributes(r << 152 simpleCapsuleVisAtt= new G4VisAttributes(red); 145 fSimpleCapsuleVisAtt -> SetVisibility(true); << 153 simpleCapsuleVisAtt -> SetVisibility(true); 146 fSimpleCapsuleVisAtt -> SetForceWireframe(tr << 154 simpleCapsuleVisAtt -> SetForceWireframe(true); 147 fCapsuleLog -> SetVisAttributes( fSimpleCaps << 155 capsuleLog -> SetVisAttributes( simpleCapsuleVisAtt); 148 << 156 149 fSimpleCapsuleTipVisAtt = new G4VisAttribute << 157 simpleCapsuleTipVisAtt= new G4VisAttributes(red); 150 fSimpleCapsuleTipVisAtt -> SetVisibility(tru << 158 simpleCapsuleTipVisAtt -> SetVisibility(true); 151 fSimpleCapsuleTipVisAtt -> SetForceSolid(tru << 159 simpleCapsuleTipVisAtt -> SetForceSolid(true); 152 fCapsuleTipLog -> SetVisAttributes(fSimpleCa << 160 capsuleTipLog -> SetVisAttributes( simpleCapsuleTipVisAtt); 153 } 161 } 154 162 155 void BrachyDetectorConstructionI::CleanIodine( << 163 void BrachyDetectorConstructionI::CleanIodium() 156 { 164 { 157 delete fSimpleIodineVisAtt; fSimpleIodineVisAt << 165 delete simpleiodiumVisAtt; simpleiodiumVisAtt = 0; 158 delete fSimpleCapsuleVisAtt; fSimpleCapsuleVis << 166 delete simpleCapsuleVisAtt; simpleCapsuleVisAtt = 0; 159 delete fSimpleCapsuleTipVisAtt; fSimpleCapsule << 167 delete simpleCapsuleTipVisAtt; simpleCapsuleTipVisAtt = 0; 160 delete fCapsuleTipPhys1; fCapsuleTipPhys1 = nu << 168 delete capsuleTipPhys1; capsuleTipPhys1 = 0; 161 delete fCapsuleTipPhys2; fCapsuleTipPhys2 = nu << 169 delete capsuleTipPhys2; capsuleTipPhys2 = 0; 162 delete fIodineCorePhys; fIodineCorePhys = null << 170 delete iodiumCorePhys; iodiumCorePhys = 0; 163 delete fCapsulePhys; fCapsulePhys = nullptr; << 171 delete capsulePhys; capsulePhys = 0; 164 delete fDefaultTubPhys; fDefaultTubPhys = null << 172 delete defaultTubPhys; defaultTubPhys = 0; 165 delete fDefaultTubLog; fDefaultTubLog = nullpt << 173 delete defaultTubLog; defaultTubLog = 0; 166 delete fCapsuleLog; fCapsuleLog = nullptr; << 174 delete capsuleLog; capsuleLog = 0; 167 delete fCapsuleTipLog; fCapsuleTipLog = nullpt << 175 delete capsuleTipLog; capsuleTipLog = 0; 168 delete fIodineCoreLog; fIodineCoreLog = nullpt << 176 delete iodiumCoreLog; iodiumCoreLog = 0; 169 delete fDefaultTub; fDefaultTub = nullptr; << 177 delete defaultTub; defaultTub = 0; 170 delete fCapsule; fCapsule = nullptr; << 178 delete capsule; capsule = 0; 171 delete fCapsuleTip; fCapsuleTip = nullptr; << 179 delete capsuleTip; capsuleTip = 0; 172 delete fIodineCore; fIodineCore = nullptr; << 180 delete iodiumCore; iodiumCore = 0; 173 181 174 G4RunManager::GetRunManager() -> GeometryHasBe 182 G4RunManager::GetRunManager() -> GeometryHasBeenModified(); 175 } 183 } 176 184