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 fDefaultTub(nullptr), fCapsule(nullptr), fCapsuleTip(nullptr), fIodineCore(nullptr), fDefaultTubLog(nullptr), 61 fCapsuleLog(nullptr), fCapsuleTipLog(nullptr), 61 fCapsuleLog(nullptr), fCapsuleTipLog(nullptr), fIodineCoreLog(nullptr), fDefaultTubPhys(nullptr), 62 fCapsulePhys(nullptr),fCapsuleTipPhys1(nullptr 62 fCapsulePhys(nullptr),fCapsuleTipPhys1(nullptr),fCapsuleTipPhys2(nullptr), fIodineCorePhys(nullptr), 63 fSimpleIodineVisAtt(nullptr), fSimpleCapsuleVi 63 fSimpleIodineVisAtt(nullptr), fSimpleCapsuleVisAtt(nullptr), fSimpleCapsuleTipVisAtt(nullptr) 64 {} << 64 { >> 65 fMaterial = new BrachyMaterial(); >> 66 } >> 67 >> 68 BrachyDetectorConstructionI::~BrachyDetectorConstructionI() >> 69 { >> 70 delete fMaterial; >> 71 } 65 72 66 void BrachyDetectorConstructionI::ConstructIod 73 void BrachyDetectorConstructionI::ConstructIodine(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 = fMaterial -> GetMat("titanium"); 72 G4Material* air = nist -> FindOrBuildMateria << 79 G4Material* air = fMaterial -> GetMat("Air"); 73 << 80 G4Material* Iodine = fMaterial -> 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 fDefaultTub = new G4Tubs("DefaultTub",0.*mm, 0.40*mm, 1.84*mm, 0.*deg, 360.*deg); 80 fDefaultTubLog = new G4LogicalVolume(fDefaul 88 fDefaultTubLog = new G4LogicalVolume(fDefaultTub,air,"DefaultTub_Log"); 81 fDefaultTubPhys = new G4PVPlacement(nullptr, 89 fDefaultTubPhys = new G4PVPlacement(nullptr, 82 G4ThreeV 90 G4ThreeVector(), 83 "default 91 "defaultTub_Phys", 84 fDefault 92 fDefaultTubLog, 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; >> 98 fCapsule = new G4Tubs("fCapsule", capsuleR,0.40*mm,1.84*mm,0.*deg,360.*deg); 90 fCapsuleLog = new G4LogicalVolume(fCapsule,t 99 fCapsuleLog = new G4LogicalVolume(fCapsule,titanium,"fCapsuleLog"); 91 fCapsulePhys = new G4PVPlacement(nullptr, 100 fCapsulePhys = new G4PVPlacement(nullptr, 92 G4ThreeVecto 101 G4ThreeVector(), 93 "fCapsulePhy 102 "fCapsulePhys", 94 fCapsuleLog, 103 fCapsuleLog, 95 fDefaultTubP 104 fDefaultTubPhys, 96 false, 105 false, 97 0, true); 106 0, true); 98 // fCapsule tips 107 // fCapsule tips 99 fCapsuleTip = new G4Sphere("fCapsuleTip", 108 fCapsuleTip = new G4Sphere("fCapsuleTip", 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 107 fCapsuleTipLog = new G4LogicalVolume(fCapsul 116 fCapsuleTipLog = new G4LogicalVolume(fCapsuleTip,titanium,"fCapsuleTipLog"); 108 fCapsuleTipPhys1 = new G4PVPlacement(nullptr 117 fCapsuleTipPhys1 = new G4PVPlacement(nullptr, 109 G4ThreeV 118 G4ThreeVector(0.,0.,1.84*mm), 110 "Iodinef 119 "IodinefCapsuleTipPhys1", 111 fCapsule 120 fCapsuleTipLog, 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 fCapsuleTipPhys2 = new G4PVPlacement(rotateMatrix, 119 G4ThreeV 128 G4ThreeVector(0,0,-1.84*mm), 120 "Iodinef 129 "IodinefCapsuleTipPhys2", 121 fCapsule 130 fCapsuleTipLog, 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 fIodineCore = new G4Tubs("ICore",0.085*mm,0.35*mm,1.75*mm,0.*deg,360.*deg); 128 fIodineCoreLog = new G4LogicalVolume(fIodine << 137 fIodineCoreLog = new G4LogicalVolume(fIodineCore,Iodine,"IodineCoreLog"); 129 fIodineCorePhys = new G4PVPlacement(nullptr, 138 fIodineCorePhys = new G4PVPlacement(nullptr, 130 G4ThreeVe 139 G4ThreeVector(0.,0.,0.), 131 "IodineCo 140 "IodineCorePhys", 132 fIodineCo 141 fIodineCoreLog, 133 fDefaultT 142 fDefaultTubPhys, 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 fSimpleIodineVisAtt = new G4VisAttributes(magenta); 140 fSimpleIodineVisAtt -> SetVisibility(true); 149 fSimpleIodineVisAtt -> SetVisibility(true); 141 fSimpleIodineVisAtt -> SetForceSolid(true); 150 fSimpleIodineVisAtt -> SetForceSolid(true); 142 fIodineCoreLog -> SetVisAttributes(fSimpleIo 151 fIodineCoreLog -> SetVisAttributes(fSimpleIodineVisAtt); 143 152 144 fSimpleCapsuleVisAtt = new G4VisAttributes(r 153 fSimpleCapsuleVisAtt = new G4VisAttributes(red); 145 fSimpleCapsuleVisAtt -> SetVisibility(true); 154 fSimpleCapsuleVisAtt -> SetVisibility(true); 146 fSimpleCapsuleVisAtt -> SetForceWireframe(tr 155 fSimpleCapsuleVisAtt -> SetForceWireframe(true); 147 fCapsuleLog -> SetVisAttributes( fSimpleCaps 156 fCapsuleLog -> SetVisAttributes( fSimpleCapsuleVisAtt); 148 157 149 fSimpleCapsuleTipVisAtt = new G4VisAttribute 158 fSimpleCapsuleTipVisAtt = new G4VisAttributes(red); 150 fSimpleCapsuleTipVisAtt -> SetVisibility(tru 159 fSimpleCapsuleTipVisAtt -> SetVisibility(true); 151 fSimpleCapsuleTipVisAtt -> SetForceSolid(tru 160 fSimpleCapsuleTipVisAtt -> SetForceSolid(true); 152 fCapsuleTipLog -> SetVisAttributes(fSimpleCa 161 fCapsuleTipLog -> SetVisAttributes(fSimpleCapsuleTipVisAtt); 153 } 162 } 154 163 155 void BrachyDetectorConstructionI::CleanIodine( 164 void BrachyDetectorConstructionI::CleanIodine() 156 { 165 { 157 delete fSimpleIodineVisAtt; fSimpleIodineVisAt 166 delete fSimpleIodineVisAtt; fSimpleIodineVisAtt = nullptr; 158 delete fSimpleCapsuleVisAtt; fSimpleCapsuleVis 167 delete fSimpleCapsuleVisAtt; fSimpleCapsuleVisAtt = nullptr; 159 delete fSimpleCapsuleTipVisAtt; fSimpleCapsule 168 delete fSimpleCapsuleTipVisAtt; fSimpleCapsuleTipVisAtt = nullptr; 160 delete fCapsuleTipPhys1; fCapsuleTipPhys1 = nu 169 delete fCapsuleTipPhys1; fCapsuleTipPhys1 = nullptr; 161 delete fCapsuleTipPhys2; fCapsuleTipPhys2 = nu 170 delete fCapsuleTipPhys2; fCapsuleTipPhys2 = nullptr; 162 delete fIodineCorePhys; fIodineCorePhys = null 171 delete fIodineCorePhys; fIodineCorePhys = nullptr; 163 delete fCapsulePhys; fCapsulePhys = nullptr; 172 delete fCapsulePhys; fCapsulePhys = nullptr; 164 delete fDefaultTubPhys; fDefaultTubPhys = null 173 delete fDefaultTubPhys; fDefaultTubPhys = nullptr; 165 delete fDefaultTubLog; fDefaultTubLog = nullpt 174 delete fDefaultTubLog; fDefaultTubLog = nullptr; 166 delete fCapsuleLog; fCapsuleLog = nullptr; 175 delete fCapsuleLog; fCapsuleLog = nullptr; 167 delete fCapsuleTipLog; fCapsuleTipLog = nullpt 176 delete fCapsuleTipLog; fCapsuleTipLog = nullptr; 168 delete fIodineCoreLog; fIodineCoreLog = nullpt 177 delete fIodineCoreLog; fIodineCoreLog = nullptr; 169 delete fDefaultTub; fDefaultTub = nullptr; 178 delete fDefaultTub; fDefaultTub = nullptr; 170 delete fCapsule; fCapsule = nullptr; 179 delete fCapsule; fCapsule = nullptr; 171 delete fCapsuleTip; fCapsuleTip = nullptr; 180 delete fCapsuleTip; fCapsuleTip = nullptr; 172 delete fIodineCore; fIodineCore = nullptr; 181 delete fIodineCore; fIodineCore = nullptr; 173 182 174 G4RunManager::GetRunManager() -> GeometryHasBe 183 G4RunManager::GetRunManager() -> GeometryHasBeenModified(); 175 } 184 } 176 185