Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 26 // 23 // 27 // ------------------------------------------- 24 // -------------------------------------------------------------- 28 // GEANT 4 - Brachytherapy exa 25 // GEANT 4 - Brachytherapy example 29 // ------------------------------------------- 26 // -------------------------------------------------------------- 30 // 27 // 31 // Code developed by: S.Guatelli 28 // Code developed by: S.Guatelli 32 // 29 // 33 /// *************************************** 30 /// **************************************** 34 // * * 31 // * * 35 // * BrachyDetectorConstructionI.cc 32 // * BrachyDetectorConstructionI.cc * 36 // * * 33 // * * 37 // **************************************** 34 // **************************************** 38 // 35 // >> 36 // $Id: BrachyDetectorConstructionI.cc,v 1.6 2003/12/09 15:29:56 gunter Exp $ >> 37 // GEANT4 tag $Name: geant4-08-00-patch-01 $ 39 // 38 // 40 #include "BrachyDetectorConstructionI.hh" << 41 #include "globals.hh" 39 #include "globals.hh" 42 #include "G4SystemOfUnits.hh" << 40 #include "BrachyDetectorConstructionI.hh" 43 #include "G4CSGSolid.hh" 41 #include "G4CSGSolid.hh" 44 #include "G4Sphere.hh" 42 #include "G4Sphere.hh" 45 #include "G4MaterialPropertyVector.hh" 43 #include "G4MaterialPropertyVector.hh" >> 44 #include "G4SDManager.hh" >> 45 #include "G4SubtractionSolid.hh" 46 #include "G4RunManager.hh" 46 #include "G4RunManager.hh" >> 47 #include "G4MaterialPropertiesTable.hh" >> 48 #include "G4Material.hh" 47 #include "G4Box.hh" 49 #include "G4Box.hh" 48 #include "G4Tubs.hh" 50 #include "G4Tubs.hh" 49 #include "G4LogicalVolume.hh" 51 #include "G4LogicalVolume.hh" 50 #include "G4ThreeVector.hh" 52 #include "G4ThreeVector.hh" 51 #include "G4PVPlacement.hh" 53 #include "G4PVPlacement.hh" >> 54 #include "G4MaterialTable.hh" >> 55 #include "Randomize.hh" >> 56 #include "G4RunManager.hh" >> 57 #include "G4Element.hh" >> 58 #include "G4ElementTable.hh" >> 59 #include "G4PVParameterised.hh" 52 #include "G4Transform3D.hh" 60 #include "G4Transform3D.hh" 53 #include "G4RotationMatrix.hh" 61 #include "G4RotationMatrix.hh" >> 62 #include "G4FieldManager.hh" 54 #include "G4TransportationManager.hh" 63 #include "G4TransportationManager.hh" >> 64 #include "G4UnionSolid.hh" >> 65 #include "BrachyMaterial.hh" 55 #include "G4VisAttributes.hh" 66 #include "G4VisAttributes.hh" 56 #include "G4Colour.hh" 67 #include "G4Colour.hh" 57 #include "G4NistManager.hh" << 58 68 59 BrachyDetectorConstructionI::BrachyDetectorCon << 69 BrachyDetectorConstructionI::BrachyDetectorConstructionI() 60 fDefaultTub(nullptr), fCapsule(nullptr), fCaps << 70 : defaultTub(0), defaultTubLog(0),defaultTubPhys(0), 61 fCapsuleLog(nullptr), fCapsuleTipLog(nullptr), << 71 capsule(0),capsuleLog(0),capsulePhys(0), 62 fCapsulePhys(nullptr),fCapsuleTipPhys1(nullptr << 72 capsuleTip(0),capsuleTipLog(0),capsuleTipPhys1(0),capsuleTipPhys2(0), 63 fSimpleIodineVisAtt(nullptr), fSimpleCapsuleVi << 73 iodiumCore(0),iodiumCoreLog(0),iodiumCorePhys(0), 64 {} << 74 marker(0),markerLog(0),markerPhys(0) >> 75 { >> 76 pMaterial = new BrachyMaterial(); >> 77 } >> 78 >> 79 BrachyDetectorConstructionI::~BrachyDetectorConstructionI() >> 80 { >> 81 delete pMaterial; >> 82 } 65 83 66 void BrachyDetectorConstructionI::ConstructIod << 84 void BrachyDetectorConstructionI::ConstructIodium(G4VPhysicalVolume* mother) 67 { 85 { 68 // Model of the Bebig Isoseed I-125 brachy s << 86 // source Bebig Isoseed I-125 ... 69 G4NistManager* nist = G4NistManager::Instanc << 87 70 G4Material* titanium = nist -> FindOrBuildMa << 88 //Get materials for source construction ... 71 G4Material* iodine = nist -> FindOrBuildMate << 89 G4Material* titanium = pMaterial->GetMat("titanium"); 72 G4Material* air = nist -> FindOrBuildMateria << 90 G4Material* air = pMaterial->GetMat("Air"); 73 << 91 G4Material* iodium = pMaterial->GetMat("Iodium"); >> 92 G4Material* gold = pMaterial->GetMat("gold"); >> 93 74 G4Colour red (1.0, 0.0, 0.0) ; 94 G4Colour red (1.0, 0.0, 0.0) ; 75 G4Colour magenta (1.0, 0.0, 1.0) ; 95 G4Colour magenta (1.0, 0.0, 1.0) ; 76 G4Colour lblue (0.0, 0.0, .75); 96 G4Colour lblue (0.0, 0.0, .75); 77 97 78 // Air tub << 98 defaultTub = new G4Tubs("DefaultTub",0.*mm,0.40*mm,1.84*mm,0.*deg,360.*deg); 79 fDefaultTub = new G4Tubs("DefaultTub",0.*mm, << 99 defaultTubLog = new G4LogicalVolume(defaultTub,air,"DefaultTub_Log"); 80 fDefaultTubLog = new G4LogicalVolume(fDefaul << 100 defaultTubPhys = new G4PVPlacement(0, 81 fDefaultTubPhys = new G4PVPlacement(nullptr, << 82 G4ThreeV 101 G4ThreeVector(), 83 "default 102 "defaultTub_Phys", 84 fDefault << 103 defaultTubLog, 85 mother, 104 mother, 86 false, 105 false, 87 0, true) << 106 0); 88 // Capsule main body ... << 107 // Capsule main body ... 89 fCapsule = new G4Tubs("fCapsule", 0.35*mm,0. << 108 90 fCapsuleLog = new G4LogicalVolume(fCapsule,t << 109 G4double capsuleR = 0.35*mm; 91 fCapsulePhys = new G4PVPlacement(nullptr, << 110 capsule = new G4Tubs("Capsule", capsuleR,0.40*mm,1.84*mm,0.*deg,360.*deg); >> 111 capsuleLog = new G4LogicalVolume(capsule,titanium,"CapsuleLog"); >> 112 capsulePhys = new G4PVPlacement(0, 92 G4ThreeVecto 113 G4ThreeVector(), 93 "fCapsulePhy << 114 "CapsulePhys", 94 fCapsuleLog, << 115 capsuleLog, 95 fDefaultTubP << 116 defaultTubPhys, 96 false, 117 false, 97 0, true); << 118 0); 98 // fCapsule tips << 119 // Capsule tips 99 fCapsuleTip = new G4Sphere("fCapsuleTip", << 120 >> 121 capsuleTip = new G4Sphere("CapsuleTip", 100 0.*mm, 122 0.*mm, 101 0.40*mm, 123 0.40*mm, 102 0.*deg, 124 0.*deg, 103 360.*deg, 125 360.*deg, 104 0.*deg, 126 0.*deg, 105 90.*deg); 127 90.*deg); 106 << 128 capsuleTipLog = new G4LogicalVolume(capsuleTip,titanium,"CapsuleTipLog"); 107 fCapsuleTipLog = new G4LogicalVolume(fCapsul << 129 capsuleTipPhys1 = new G4PVPlacement(0, 108 fCapsuleTipPhys1 = new G4PVPlacement(nullptr << 109 G4ThreeV 130 G4ThreeVector(0.,0.,1.84*mm), 110 "Iodinef << 131 "CapsuleTipPhys1", 111 fCapsule << 132 capsuleTipLog, 112 mother, 133 mother, 113 false, 134 false, 114 0, true) << 135 0); 115 136 116 auto rotateMatrix = new G4RotationMatrix(); << 137 G4RotationMatrix* rotateMatrix = new G4RotationMatrix(); 117 rotateMatrix -> rotateX(180.0*deg); << 138 rotateMatrix->rotateX(180.0*deg); 118 fCapsuleTipPhys2 = new G4PVPlacement(rotateM << 139 capsuleTipPhys2 = new G4PVPlacement(rotateMatrix, 119 G4ThreeV 140 G4ThreeVector(0,0,-1.84*mm), 120 "Iodinef << 141 "CapsuleTipPhys2", 121 fCapsule << 142 capsuleTipLog, 122 mother, 143 mother, 123 false, 144 false, 124 0, true) << 145 0); 125 146 126 // Radiactive core ... << 147 // radiactive core ... 127 fIodineCore = new G4Tubs("ICore",0.085*mm,0. << 148 iodiumCore = new G4Tubs("ICore",0.085*mm,0.35*mm,1.75*mm,0.*deg,360.*deg); 128 fIodineCoreLog = new G4LogicalVolume(fIodine << 149 iodiumCoreLog = new G4LogicalVolume(iodiumCore,iodium,"iodiumCoreLog"); 129 fIodineCorePhys = new G4PVPlacement(nullptr, << 150 iodiumCorePhys = new G4PVPlacement(0, 130 G4ThreeVe 151 G4ThreeVector(0.,0.,0.), 131 "IodineCo << 152 "iodiumCorePhys", 132 fIodineCo << 153 iodiumCoreLog, 133 fDefaultT << 154 defaultTubPhys, 134 false, 155 false, 135 0, true); << 156 0); 136 << 157 // golden marker >> 158 marker = new G4Tubs("GoldenMarker",0.*mm,0.085*mm,1.75*mm,0.*deg,360.*deg); >> 159 markerLog = new G4LogicalVolume(marker,gold,"MarkerLog"); >> 160 markerPhys = new G4PVPlacement(0, >> 161 G4ThreeVector(0.,0.,0.), >> 162 "MarkerPhys", >> 163 markerLog, >> 164 defaultTubPhys, >> 165 false, >> 166 0); 137 // Visual attributes ... 167 // Visual attributes ... 138 << 168 G4VisAttributes* simpleMarkerVisAtt= new G4VisAttributes(lblue); 139 fSimpleIodineVisAtt = new G4VisAttributes(ma << 169 simpleMarkerVisAtt->SetVisibility(true); 140 fSimpleIodineVisAtt -> SetVisibility(true); << 170 simpleMarkerVisAtt->SetForceSolid(true); 141 fSimpleIodineVisAtt -> SetForceSolid(true); << 171 markerLog->SetVisAttributes( simpleMarkerVisAtt); 142 fIodineCoreLog -> SetVisAttributes(fSimpleIo << 172 143 << 173 G4VisAttributes* simpleiodiumVisAtt= new G4VisAttributes(magenta); 144 fSimpleCapsuleVisAtt = new G4VisAttributes(r << 174 simpleiodiumVisAtt->SetVisibility(true); 145 fSimpleCapsuleVisAtt -> SetVisibility(true); << 175 simpleiodiumVisAtt->SetForceWireframe(true); 146 fSimpleCapsuleVisAtt -> SetForceWireframe(tr << 176 iodiumCoreLog->SetVisAttributes(simpleiodiumVisAtt); 147 fCapsuleLog -> SetVisAttributes( fSimpleCaps << 177 148 << 178 G4VisAttributes* simpleCapsuleVisAtt= new G4VisAttributes(red); 149 fSimpleCapsuleTipVisAtt = new G4VisAttribute << 179 simpleCapsuleVisAtt->SetVisibility(true); 150 fSimpleCapsuleTipVisAtt -> SetVisibility(tru << 180 simpleCapsuleVisAtt->SetForceWireframe(true); 151 fSimpleCapsuleTipVisAtt -> SetForceSolid(tru << 181 capsuleLog->SetVisAttributes( simpleCapsuleVisAtt); 152 fCapsuleTipLog -> SetVisAttributes(fSimpleCa << 182 153 } << 183 G4VisAttributes* simpleCapsuleTipVisAtt= new G4VisAttributes(red); 154 << 184 simpleCapsuleTipVisAtt->SetVisibility(true); 155 void BrachyDetectorConstructionI::CleanIodine( << 185 simpleCapsuleTipVisAtt->SetForceSolid(true); 156 { << 186 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 } 187 } 176 188