Geant4 Cross Reference |
1 // 2 // ******************************************************************** 3 // * License and Disclaimer * 4 // * * 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. * 10 // * * 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitation of liability. * 17 // * * 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************************************** 25 // 26 // 27 // -------------------------------------------------------------- 28 // GEANT 4 - Brachytherapy example 29 // -------------------------------------------------------------- 30 // 31 // Code developed by: 32 // S.Guatelli 33 // 34 // ******************************************* 35 // * * 36 // * BrachyDetectorConstructionLeipzig.cc * 37 // * * 38 // ******************************************* 39 // 40 #include "BrachyDetectorConstructionLeipzig.hh" 41 #include "globals.hh" 42 #include "G4SystemOfUnits.hh" 43 #include "G4CSGSolid.hh" 44 #include "G4Sphere.hh" 45 #include "G4RunManager.hh" 46 #include "G4Box.hh" 47 #include "G4Tubs.hh" 48 #include "G4LogicalVolume.hh" 49 #include "G4ThreeVector.hh" 50 #include "G4PVPlacement.hh" 51 #include "G4Transform3D.hh" 52 #include "G4RotationMatrix.hh" 53 #include "G4TransportationManager.hh" 54 #include "G4VisAttributes.hh" 55 #include "G4Colour.hh" 56 #include "G4NistManager.hh" 57 58 BrachyDetectorConstructionLeipzig::BrachyDetectorConstructionLeipzig(): 59 fCapsule(nullptr), fCapsuleTip(nullptr), fIridiumCore(nullptr), fApplicator1(nullptr), fApplicator2(nullptr), 60 fCapsuleLog(nullptr), fCapsuleTipLog(nullptr), fIridiumCoreLog(nullptr), fApplicator1Log(nullptr), 61 fApplicator2Log(nullptr), fCapsulePhys(nullptr), fCapsuleTipPhys(nullptr), fIridiumCorePhys(nullptr), 62 fApplicator1Phys(nullptr), fApplicator2Phys(nullptr) 63 {} 64 65 void BrachyDetectorConstructionLeipzig::ConstructLeipzig(G4VPhysicalVolume* mother) 66 { 67 G4Colour red (1.0, 0.0, 0.0) ; 68 G4Colour lblue (0.0, 0.0, .75); 69 70 G4NistManager* nist = G4NistManager::Instance(); 71 G4Material* iridium = nist -> FindOrBuildMaterial("G4_Ir"); 72 G4Material* tungsten = nist -> FindOrBuildMaterial("G4_W"); 73 74 // Stainless steel (Medical Physics, Vol 25, No 10, Oct 1998) 75 constexpr G4double d = 8.02*g/cm3; 76 G4int Z; //atomic number of the element 77 G4Element* elMn = nist -> FindOrBuildElement(Z=12); 78 G4Element* elSi = nist -> FindOrBuildElement(Z=14); 79 G4Element* elCr = nist -> FindOrBuildElement(Z=24); 80 G4Element* elFe = nist -> FindOrBuildElement(Z=26); 81 G4Element* elNi = nist -> FindOrBuildElement(Z=28); 82 auto steel = new G4Material("Stainless steel",d,5); 83 steel -> AddElement(elMn, 0.02); 84 steel -> AddElement(elSi, 0.01); 85 steel -> AddElement(elCr, 0.19); 86 steel -> AddElement(elNi, 0.10); 87 steel -> AddElement(elFe, 0.68); 88 89 //Iridium source ... 90 91 fCapsule = new G4Tubs("Capsule",0,0.55*mm,3.725*mm,0.*deg,360.*deg); 92 fCapsuleLog = new G4LogicalVolume(fCapsule,steel,"CapsuleLog"); 93 fCapsulePhys = new G4PVPlacement(nullptr, G4ThreeVector(0,0,-1.975*mm),"CapsulePhys", 94 fCapsuleLog,mother, //mother volume: phantom 95 false,0, true); 96 97 // Capsule tip 98 fCapsuleTip = new G4Sphere("CapsuleTip",0.*mm,0.55*mm,0.*deg,360.*deg,0.*deg,90.*deg); 99 fCapsuleTipLog = new G4LogicalVolume(fCapsuleTip,steel,"CapsuleTipLog"); 100 fCapsuleTipPhys = new G4PVPlacement(nullptr,G4ThreeVector(0.,0.,1.75*mm),"CapsuleTipPhys", 101 fCapsuleTipLog,mother,false,0, true); 102 // Iridium core 103 fIridiumCore = new G4Tubs("IrCore",0,0.30*mm,1.75*mm,0.*deg,360.*deg); 104 fIridiumCoreLog = new G4LogicalVolume(fIridiumCore, iridium, "IridiumCoreLog"); 105 fIridiumCorePhys = new G4PVPlacement(nullptr,G4ThreeVector(0.,0.,1.975*mm),"IridiumCorePhys", 106 fIridiumCoreLog, fCapsulePhys,false,0, true); 107 108 //Leipzig Applicator is modelled with two different volumes 109 fApplicator1 = new G4Tubs("Appl1",5*mm,10.5*mm,12*mm,0.*deg,360.*deg); 110 fApplicator1Log = new G4LogicalVolume(fApplicator1,tungsten,"Appl1Log"); 111 fApplicator1Phys = new G4PVPlacement(nullptr,G4ThreeVector(0,0,4.0*mm),"Appl1Phys",fApplicator1Log, 112 mother,false,0, true); 113 114 fApplicator2 = new G4Tubs("Appl2",0.55*mm,5.*mm,3.125*mm,0.*deg,360.*deg); 115 fApplicator2Log = new G4LogicalVolume(fApplicator2,tungsten,"Appl2"); 116 fApplicator2Phys = new G4PVPlacement(nullptr,G4ThreeVector(0,0,-4.875*mm), 117 "Appl2Phys", fApplicator2Log,mother,false,0, true); 118 119 fSimpleCapsuleVisAtt = new G4VisAttributes(red); 120 fSimpleCapsuleVisAtt -> SetVisibility(true); 121 fSimpleCapsuleVisAtt -> SetForceWireframe(true); 122 fCapsuleLog -> SetVisAttributes(fSimpleCapsuleVisAtt); 123 124 fSimpleCapsuleTipVisAtt = new G4VisAttributes(red); 125 fSimpleCapsuleTipVisAtt -> SetVisibility(true); 126 fSimpleCapsuleTipVisAtt -> SetForceSolid(true); 127 fCapsuleTipLog -> SetVisAttributes(fSimpleCapsuleTipVisAtt); 128 fIridiumCoreLog -> SetVisAttributes(fSimpleCapsuleTipVisAtt); 129 130 fApplicatorVisAtt = new G4VisAttributes(lblue); 131 fApplicatorVisAtt -> SetVisibility(true); 132 fApplicatorVisAtt -> SetForceWireframe(true); 133 fApplicator1Log -> SetVisAttributes(fApplicatorVisAtt); 134 fApplicator2Log -> SetVisAttributes(fApplicatorVisAtt); 135 } 136 void BrachyDetectorConstructionLeipzig::CleanLeipzigApplicator() 137 { 138 delete fApplicatorVisAtt; fApplicatorVisAtt = nullptr; 139 delete fSimpleCapsuleTipVisAtt; fSimpleCapsuleTipVisAtt = nullptr; 140 delete fSimpleCapsuleVisAtt; fSimpleCapsuleVisAtt = nullptr; 141 delete fApplicator2Phys; fApplicator2Phys = nullptr; 142 delete fApplicator1Phys; fApplicator1Phys = nullptr; 143 delete fIridiumCorePhys; fIridiumCorePhys = nullptr; 144 delete fCapsuleTipPhys; fCapsuleTipPhys = nullptr; 145 delete fCapsulePhys; fCapsulePhys = nullptr; 146 delete fApplicator2Log; fApplicator2Log = nullptr; 147 delete fApplicator1Log; fApplicator1Log = nullptr; 148 delete fIridiumCoreLog; fIridiumCoreLog = nullptr; 149 delete fCapsuleTipLog; fCapsuleTipLog = nullptr; 150 delete fCapsuleLog; fCapsuleLog = nullptr; 151 } 152