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: 31 // Code developed by: 32 // S.Guatelli 32 // S.Guatelli 33 // 33 // 34 // **************************************** 34 // ******************************************* 35 // * 35 // * * 36 // * BrachyDetectorConstructionLeipzig.c 36 // * BrachyDetectorConstructionLeipzig.cc * 37 // * 37 // * * 38 // **************************************** 38 // ******************************************* 39 // 39 // 40 #include "BrachyDetectorConstructionLeipzig.hh << 40 // >> 41 // $Id: BrachyDetectorConstructionLeipzig.cc,v 1.10 2006/06/29 15:48:16 gunter Exp $ >> 42 // GEANT4 tag $Name: geant4-09-02-patch-04 $ >> 43 // >> 44 41 #include "globals.hh" 45 #include "globals.hh" 42 #include "G4SystemOfUnits.hh" << 46 #include "BrachyDetectorConstructionLeipzig.hh" 43 #include "G4CSGSolid.hh" 47 #include "G4CSGSolid.hh" 44 #include "G4Sphere.hh" 48 #include "G4Sphere.hh" 45 #include "G4RunManager.hh" 49 #include "G4RunManager.hh" 46 #include "G4Box.hh" 50 #include "G4Box.hh" 47 #include "G4Tubs.hh" 51 #include "G4Tubs.hh" 48 #include "G4LogicalVolume.hh" 52 #include "G4LogicalVolume.hh" 49 #include "G4ThreeVector.hh" 53 #include "G4ThreeVector.hh" 50 #include "G4PVPlacement.hh" 54 #include "G4PVPlacement.hh" 51 #include "G4Transform3D.hh" 55 #include "G4Transform3D.hh" 52 #include "G4RotationMatrix.hh" 56 #include "G4RotationMatrix.hh" 53 #include "G4TransportationManager.hh" 57 #include "G4TransportationManager.hh" >> 58 #include "BrachyMaterial.hh" 54 #include "G4VisAttributes.hh" 59 #include "G4VisAttributes.hh" 55 #include "G4Colour.hh" 60 #include "G4Colour.hh" 56 #include "G4NistManager.hh" << 57 61 58 BrachyDetectorConstructionLeipzig::BrachyDetec << 62 // Leipzig Applicator ... 59 fCapsule(nullptr), fCapsuleTip(nullptr), fIrid << 63 60 fCapsuleLog(nullptr), fCapsuleTipLog(nullptr), << 64 BrachyDetectorConstructionLeipzig::BrachyDetectorConstructionLeipzig() 61 fApplicator2Log(nullptr), fCapsulePhys(nullptr << 65 : 62 fApplicator1Phys(nullptr), fApplicator2Phys(nu << 66 capsulePhys(0), 63 {} << 67 capsuleTipPhys(0), >> 68 iridiumCorePhys(0), >> 69 applicator1Phys(0), >> 70 applicator2Phys(0) >> 71 { >> 72 pMaterial = new BrachyMaterial(); >> 73 } >> 74 >> 75 BrachyDetectorConstructionLeipzig::~BrachyDetectorConstructionLeipzig() >> 76 { >> 77 delete pMaterial; >> 78 } 64 79 65 void BrachyDetectorConstructionLeipzig::Const << 80 void BrachyDetectorConstructionLeipzig::ConstructLeipzig(G4VPhysicalVolume* mother) 66 { 81 { 67 G4Colour red (1.0, 0.0, 0.0) ; 82 G4Colour red (1.0, 0.0, 0.0) ; 68 G4Colour lblue (0.0, 0.0, .75); 83 G4Colour lblue (0.0, 0.0, .75); 69 << 84 70 G4NistManager* nist = G4NistManager::Instanc << 85 G4Material* capsuleMat = pMaterial -> GetMat("Stainless steel"); 71 G4Material* iridium = nist -> FindOrBuildMat << 86 G4Material* iridium = pMaterial -> GetMat("Iridium"); 72 G4Material* tungsten = nist -> FindOrBuildMa << 87 G4Material* tungsten =pMaterial -> GetMat("Tungsten"); 73 << 74 // Stainless steel (Medical Physics, Vol 25, << 75 constexpr G4double d = 8.02*g/cm3; << 76 G4int Z; //atomic number of the element << 77 G4Element* elMn = nist -> FindOrBuildElement << 78 G4Element* elSi = nist -> FindOrBuildElement << 79 G4Element* elCr = nist -> FindOrBuildElement << 80 G4Element* elFe = nist -> FindOrBuildElement << 81 G4Element* elNi = nist -> FindOrBuildElement << 82 auto steel = new G4Material("Stainless steel << 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 88 89 //Iridium source ... 89 //Iridium source ... 90 90 91 fCapsule = new G4Tubs("Capsule",0,0.55*mm,3. << 91 G4Tubs* capsule = new G4Tubs("Capsule",0,0.55*mm,3.725*mm,0.*deg,360.*deg); 92 fCapsuleLog = new G4LogicalVolume(fCapsule,s << 92 G4LogicalVolume* capsuleLog = new G4LogicalVolume(capsule,capsuleMat,"CapsuleLog"); 93 fCapsulePhys = new G4PVPlacement(nullptr, G4 << 93 capsulePhys = new G4PVPlacement(0, 94 fCapsuleLog, << 94 G4ThreeVector(0,0,-1.975*mm), 95 false,0, tru << 95 "CapsulePhys", >> 96 capsuleLog, >> 97 mother, //mother volume: phantom >> 98 false, >> 99 0); 96 100 97 // Capsule tip 101 // Capsule tip 98 fCapsuleTip = new G4Sphere("CapsuleTip",0.*m << 102 G4Sphere* capsuleTip = new G4Sphere("CapsuleTip",0.*mm,0.55*mm,0.*deg,360.*deg,0.*deg,90.*deg); 99 fCapsuleTipLog = new G4LogicalVolume(fCapsul << 103 G4LogicalVolume* capsuleTipLog = new G4LogicalVolume(capsuleTip,capsuleMat,"CapsuleTipLog"); 100 fCapsuleTipPhys = new G4PVPlacement(nullptr, << 104 capsuleTipPhys = new G4PVPlacement(0, 101 fCapsule << 105 G4ThreeVector(0.,0.,1.75*mm), >> 106 "CapsuleTipPhys", >> 107 capsuleTipLog, >> 108 mother, >> 109 false, >> 110 0); 102 // Iridium core 111 // Iridium core 103 fIridiumCore = new G4Tubs("IrCore",0,0.30*mm << 112 104 fIridiumCoreLog = new G4LogicalVolume(fIridi << 113 G4Tubs* iridiumCore = new G4Tubs("IrCore",0,0.30*mm,1.75*mm,0.*deg,360.*deg); 105 fIridiumCorePhys = new G4PVPlacement(nullptr << 114 G4LogicalVolume* iridiumCoreLog = new G4LogicalVolume(iridiumCore, 106 fIridium << 115 iridium, >> 116 "IridiumCoreLog"); >> 117 iridiumCorePhys = new G4PVPlacement(0, >> 118 G4ThreeVector(0.,0.,1.975*mm), >> 119 "IridiumCorePhys", >> 120 iridiumCoreLog, >> 121 capsulePhys, >> 122 false, >> 123 0); 107 124 108 //Leipzig Applicator is modelled with two di 125 //Leipzig Applicator is modelled with two different volumes 109 fApplicator1 = new G4Tubs("Appl1",5*mm,10.5* << 126 110 fApplicator1Log = new G4LogicalVolume(fAppli << 127 G4Tubs* applicator1 = new G4Tubs("Appl1",5*mm,10.5*mm,12*mm,0.*deg,360.*deg); 111 fApplicator1Phys = new G4PVPlacement(nullptr << 128 G4LogicalVolume* applicator1Log = new G4LogicalVolume(applicator1,tungsten,"Appl1Log"); 112 mother,f << 129 applicator1Phys = new G4PVPlacement(0, 113 << 130 G4ThreeVector(0,0,4.0*mm), 114 fApplicator2 = new G4Tubs("Appl2",0.55*mm,5. << 131 "Appl1Phys", 115 fApplicator2Log = new G4LogicalVolume(fAppli << 132 applicator1Log, 116 fApplicator2Phys = new G4PVPlacement(nullptr << 133 mother, 117 "Appl2Ph << 134 false, 118 << 135 0); 119 fSimpleCapsuleVisAtt = new G4VisAttributes(r << 136 120 fSimpleCapsuleVisAtt -> SetVisibility(true); << 137 G4Tubs* applicator2 = new G4Tubs("Appl2",0.55*mm,5.*mm,3.125*mm,0.*deg,360.*deg); 121 fSimpleCapsuleVisAtt -> SetForceWireframe(tr << 138 G4LogicalVolume* applicator2Log = new G4LogicalVolume(applicator2,tungsten,"Appl2"); 122 fCapsuleLog -> SetVisAttributes(fSimpleCapsu << 139 applicator2Phys = new G4PVPlacement(0, 123 << 140 G4ThreeVector(0,0,-4.875*mm), 124 fSimpleCapsuleTipVisAtt = new G4VisAttribute << 141 "Appl2Phys", 125 fSimpleCapsuleTipVisAtt -> SetVisibility(tru << 142 applicator2Log, 126 fSimpleCapsuleTipVisAtt -> SetForceSolid(tru << 143 mother, 127 fCapsuleTipLog -> SetVisAttributes(fSimpleCa << 144 false, 128 fIridiumCoreLog -> SetVisAttributes(fSimpleC << 145 0); 129 << 146 130 fApplicatorVisAtt = new G4VisAttributes(lblu << 147 G4VisAttributes* simpleCapsuleVisAtt = new G4VisAttributes(red); 131 fApplicatorVisAtt -> SetVisibility(true); << 148 simpleCapsuleVisAtt -> SetVisibility(true); 132 fApplicatorVisAtt -> SetForceWireframe(true) << 149 simpleCapsuleVisAtt -> SetForceSolid(true); 133 fApplicator1Log -> SetVisAttributes(fApplica << 150 capsuleLog -> SetVisAttributes(simpleCapsuleVisAtt); 134 fApplicator2Log -> SetVisAttributes(fApplica << 151 135 } << 152 G4VisAttributes* simpleCapsuleTipVisAtt = new G4VisAttributes(red); 136 void BrachyDetectorConstructionLeipzig::CleanL << 153 simpleCapsuleTipVisAtt -> SetVisibility(true); 137 { << 154 simpleCapsuleTipVisAtt -> SetForceSolid(true); 138 delete fApplicatorVisAtt; fApplicatorVisAtt = << 155 capsuleTipLog -> SetVisAttributes(simpleCapsuleTipVisAtt); 139 delete fSimpleCapsuleTipVisAtt; fSimpleCapsule << 156 140 delete fSimpleCapsuleVisAtt; fSimpleCapsuleVis << 157 G4VisAttributes* applicatorVisAtt = new G4VisAttributes(lblue); 141 delete fApplicator2Phys; fApplicator2Phys = nu << 158 applicatorVisAtt -> SetVisibility(true); 142 delete fApplicator1Phys; fApplicator1Phys = nu << 159 applicatorVisAtt -> SetForceWireframe(true); 143 delete fIridiumCorePhys; fIridiumCorePhys = nu << 160 applicator1Log -> SetVisAttributes(applicatorVisAtt); 144 delete fCapsuleTipPhys; fCapsuleTipPhys = null << 161 applicator2Log -> SetVisAttributes(applicatorVisAtt); 145 delete fCapsulePhys; fCapsulePhys = nullptr; << 146 delete fApplicator2Log; fApplicator2Log = null << 147 delete fApplicator1Log; fApplicator1Log = null << 148 delete fIridiumCoreLog; fIridiumCoreLog = null << 149 delete fCapsuleTipLog; fCapsuleTipLog = nullpt << 150 delete fCapsuleLog; fCapsuleLog = nullptr; << 151 } 162 } 152 163