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