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