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 // D. Cutajar, A. Le 32 // D. Cutajar, A. Le 33 // 33 // 34 // **************************************** 34 // ******************************************** 35 // * 35 // * * 36 // * BrachyDetectorConstructionOncura6711. 36 // * BrachyDetectorConstructionOncura6711.cc * 37 // * 37 // * * 38 // **************************************** 38 // ******************************************** 39 // 39 // 40 // 40 // 41 // 41 // 42 #include "BrachyDetectorConstructionOncura6711 42 #include "BrachyDetectorConstructionOncura6711.hh" 43 #include "globals.hh" 43 #include "globals.hh" 44 #include "G4SystemOfUnits.hh" 44 #include "G4SystemOfUnits.hh" 45 #include "G4Sphere.hh" 45 #include "G4Sphere.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 "G4NistManager.hh" 55 #include "G4NistManager.hh" 56 #include "G4VisAttributes.hh" 56 #include "G4VisAttributes.hh" 57 #include "G4Colour.hh" 57 #include "G4Colour.hh" 58 58 59 BrachyDetectorConstructionOncura6711::BrachyDe 59 BrachyDetectorConstructionOncura6711::BrachyDetectorConstructionOncura6711() 60 : 60 : 61 fOncuraCapsule(nullptr), fOncuraCapsuleLog( 61 fOncuraCapsule(nullptr), fOncuraCapsuleLog(nullptr), 62 fOncuraCapsulePhys(nullptr), 62 fOncuraCapsulePhys(nullptr), 63 fOncuraCapsuleTip1(nullptr), fOncuraCapsule 63 fOncuraCapsuleTip1(nullptr), fOncuraCapsuleTip1Log(nullptr), 64 fOncuraCapsuleTip1Phys(nullptr), 64 fOncuraCapsuleTip1Phys(nullptr), 65 fOncuraCapsuleTip2(nullptr), fOncuraCapsule 65 fOncuraCapsuleTip2(nullptr), fOncuraCapsuleTip2Log(nullptr), 66 fOncuraCapsuleTip2Phys(nullptr), 66 fOncuraCapsuleTip2Phys(nullptr), 67 fOncuraAirGap(nullptr), fOncuraAirGapLog(nu 67 fOncuraAirGap(nullptr), fOncuraAirGapLog(nullptr), 68 fOncuraAirGapPhys(nullptr), 68 fOncuraAirGapPhys(nullptr), 69 fOncuraSilverCore(nullptr), fOncuraSilverCo 69 fOncuraSilverCore(nullptr), fOncuraSilverCoreLog(nullptr), 70 fOncuraSilverCorePhys(nullptr), 70 fOncuraSilverCorePhys(nullptr), 71 fOncuraCapsuleShellVisAtt(nullptr), fOncura 71 fOncuraCapsuleShellVisAtt(nullptr), fOncuraCapsuleTipVisAtt(nullptr), 72 fOncuraSilverCoreVisAtt(nullptr) 72 fOncuraSilverCoreVisAtt(nullptr) 73 {} 73 {} 74 74 >> 75 BrachyDetectorConstructionOncura6711::~BrachyDetectorConstructionOncura6711() >> 76 {} >> 77 75 void BrachyDetectorConstructionOncura6711::Con 78 void BrachyDetectorConstructionOncura6711::ConstructOncura6711(G4VPhysicalVolume* mother) 76 { 79 { 77 G4Colour red (1.0, 0.0, 0.0) ; 80 G4Colour red (1.0, 0.0, 0.0) ; 78 G4Colour magenta (1.0, 0.0, 1.0) ; 81 G4Colour magenta (1.0, 0.0, 1.0) ; 79 82 80 G4NistManager* nist = G4NistManager::Instance( 83 G4NistManager* nist = G4NistManager::Instance(); 81 G4Material* titanium = nist -> FindOrBuildMate 84 G4Material* titanium = nist -> FindOrBuildMaterial("G4_Ti"); 82 G4Material* air = nist -> FindOrBuildMaterial( 85 G4Material* air = nist -> FindOrBuildMaterial("G4_AIR"); 83 G4Material* silver = nist -> FindOrBuildMateri 86 G4Material* silver = nist -> FindOrBuildMaterial("G4_Ag"); 84 87 85 //Capsule shell 88 //Capsule shell 86 fOncuraCapsule = new G4Tubs("OncuraCapsule",0, 89 fOncuraCapsule = new G4Tubs("OncuraCapsule",0,0.4*mm,1.875*mm,0.*deg,360.*deg); 87 fOncuraCapsuleLog = new G4LogicalVolume(fOncur << 90 fOncuraCapsuleLog = new G4LogicalVolume(fOncuraCapsule,titanium,"OncuraCapsuleLog", 0,0,0); 88 fOncuraCapsulePhys = new G4PVPlacement(nullptr 91 fOncuraCapsulePhys = new G4PVPlacement(nullptr, G4ThreeVector(0,0,0), 89 "OncuraCapsulePhys", fOncura 92 "OncuraCapsulePhys", fOncuraCapsuleLog, 90 mother, false, 0, true); 93 mother, false, 0, true); 91 94 92 //Capsule tips 95 //Capsule tips 93 fOncuraCapsuleTip1 = new G4Sphere("OncuraCapsu 96 fOncuraCapsuleTip1 = new G4Sphere("OncuraCapsuleTip1", 0, 0.4*mm, 0., 360*deg, 0., 90*deg); 94 fOncuraCapsuleTip1Log = new G4LogicalVolume(fO << 97 fOncuraCapsuleTip1Log = new G4LogicalVolume(fOncuraCapsuleTip1, titanium, "OncuraCapsuleTip1Log",0,0,0); 95 fOncuraCapsuleTip1Phys = new G4PVPlacement(nul 98 fOncuraCapsuleTip1Phys = new G4PVPlacement(nullptr, G4ThreeVector(0,0,1.875*mm), 96 "OncuraCapsuleTip1Phys", fOncu 99 "OncuraCapsuleTip1Phys", fOncuraCapsuleTip1Log, 97 mother, false, 100 mother, false, 98 0, true); 101 0, true); 99 102 100 fOncuraCapsuleTip2 = new G4Sphere("OncuraCapsu 103 fOncuraCapsuleTip2 = new G4Sphere("OncuraCapsuleTip2", 0, 0.4*mm, 0., 360*deg, 90*deg, 90*deg); 101 fOncuraCapsuleTip2Log = new G4LogicalVolume(fO << 104 fOncuraCapsuleTip2Log = new G4LogicalVolume(fOncuraCapsuleTip2, titanium, "OncuraCapsuleTip2Log",0,0,0); 102 fOncuraCapsuleTip2Phys = new G4PVPlacement(nul 105 fOncuraCapsuleTip2Phys = new G4PVPlacement(nullptr, G4ThreeVector(0,0,-1.875*mm), 103 "OncuraCapsuleTip2Phys", fOncu 106 "OncuraCapsuleTip2Phys", fOncuraCapsuleTip2Log, 104 mother, false, 107 mother, false, 105 0, true); 108 0, true); 106 109 107 //Air gap 110 //Air gap 108 fOncuraAirGap = new G4Tubs("OncuraAirGap",0,0. 111 fOncuraAirGap = new G4Tubs("OncuraAirGap",0,0.33*mm,1.825*mm,0.*deg,360.*deg); 109 fOncuraAirGapLog = new G4LogicalVolume(fOncura 112 fOncuraAirGapLog = new G4LogicalVolume(fOncuraAirGap, air, "OncuraAirGapLog"); 110 fOncuraAirGapPhys = new G4PVPlacement(nullptr, 113 fOncuraAirGapPhys = new G4PVPlacement(nullptr, G4ThreeVector(0,0,0), 111 "OncuraAirGapP 114 "OncuraAirGapPhys", fOncuraAirGapLog, 112 fOncuraCapsule 115 fOncuraCapsulePhys, false, 113 0, true); 116 0, true); 114 117 115 //Silver core 118 //Silver core 116 fOncuraSilverCore = new G4Tubs("OncuraSilverCo 119 fOncuraSilverCore = new G4Tubs("OncuraSilverCore",0,0.25*mm,1.4*mm,0.*deg,360.*deg); 117 fOncuraSilverCoreLog = new G4LogicalVolume(fOn 120 fOncuraSilverCoreLog = new G4LogicalVolume(fOncuraSilverCore, silver, "silverCoreLog"); 118 fOncuraSilverCorePhys = new G4PVPlacement(null 121 fOncuraSilverCorePhys = new G4PVPlacement(nullptr, G4ThreeVector(0,0,0), 119 "OncuraSilverCorePhys", fOncur 122 "OncuraSilverCorePhys", fOncuraSilverCoreLog, 120 fOncuraAirGapP 123 fOncuraAirGapPhys, false, 121 0, true); 124 0, true); 122 125 123 fOncuraCapsuleShellVisAtt = new G4VisAttribute 126 fOncuraCapsuleShellVisAtt = new G4VisAttributes(red); 124 fOncuraCapsuleShellVisAtt -> SetVisibility(tru 127 fOncuraCapsuleShellVisAtt -> SetVisibility(true); 125 fOncuraCapsuleShellVisAtt -> SetForceWireframe 128 fOncuraCapsuleShellVisAtt -> SetForceWireframe(true); 126 fOncuraCapsuleLog -> SetVisAttributes(fOncuraC 129 fOncuraCapsuleLog -> SetVisAttributes(fOncuraCapsuleShellVisAtt); 127 130 128 fOncuraCapsuleTipVisAtt = new G4VisAttributes( 131 fOncuraCapsuleTipVisAtt = new G4VisAttributes(red); 129 fOncuraCapsuleTipVisAtt -> SetVisibility(true) 132 fOncuraCapsuleTipVisAtt -> SetVisibility(true); 130 fOncuraCapsuleTipVisAtt -> SetForceSolid(true) 133 fOncuraCapsuleTipVisAtt -> SetForceSolid(true); 131 fOncuraCapsuleTip1Log -> SetVisAttributes(fOnc 134 fOncuraCapsuleTip1Log -> SetVisAttributes(fOncuraCapsuleTipVisAtt); 132 fOncuraCapsuleTip2Log -> SetVisAttributes(fOnc 135 fOncuraCapsuleTip2Log -> SetVisAttributes(fOncuraCapsuleTipVisAtt); 133 136 134 fOncuraSilverCoreVisAtt = new G4VisAttributes( 137 fOncuraSilverCoreVisAtt = new G4VisAttributes(magenta); 135 fOncuraSilverCoreVisAtt -> SetVisibility(true) 138 fOncuraSilverCoreVisAtt -> SetVisibility(true); 136 fOncuraSilverCoreVisAtt -> SetForceSolid(true) 139 fOncuraSilverCoreVisAtt -> SetForceSolid(true); 137 fOncuraSilverCoreLog -> SetVisAttributes(fOncu 140 fOncuraSilverCoreLog -> SetVisAttributes(fOncuraSilverCoreVisAtt); 138 } 141 } 139 142 140 void BrachyDetectorConstructionOncura6711::Cle 143 void BrachyDetectorConstructionOncura6711::CleanOncura6711() 141 { 144 { 142 delete fOncuraSilverCoreVisAtt; 145 delete fOncuraSilverCoreVisAtt; 143 fOncuraSilverCoreVisAtt = nullptr; 146 fOncuraSilverCoreVisAtt = nullptr; 144 147 145 delete fOncuraCapsuleTipVisAtt; 148 delete fOncuraCapsuleTipVisAtt; 146 fOncuraCapsuleTipVisAtt = nullptr; 149 fOncuraCapsuleTipVisAtt = nullptr; 147 150 148 delete fOncuraCapsuleShellVisAtt; 151 delete fOncuraCapsuleShellVisAtt; 149 fOncuraCapsuleShellVisAtt = nullptr; 152 fOncuraCapsuleShellVisAtt = nullptr; 150 153 151 delete fOncuraSilverCorePhys; 154 delete fOncuraSilverCorePhys; 152 fOncuraSilverCorePhys = nullptr; 155 fOncuraSilverCorePhys = nullptr; 153 156 154 delete fOncuraSilverCoreLog; 157 delete fOncuraSilverCoreLog; 155 fOncuraSilverCoreLog = nullptr; 158 fOncuraSilverCoreLog = nullptr; 156 159 157 delete fOncuraSilverCore; 160 delete fOncuraSilverCore; 158 fOncuraSilverCore = nullptr; 161 fOncuraSilverCore = nullptr; 159 162 160 delete fOncuraAirGapPhys; 163 delete fOncuraAirGapPhys; 161 fOncuraAirGapPhys = nullptr; 164 fOncuraAirGapPhys = nullptr; 162 165 163 delete fOncuraAirGapLog; 166 delete fOncuraAirGapLog; 164 fOncuraAirGapLog = nullptr; 167 fOncuraAirGapLog = nullptr; 165 168 166 delete fOncuraAirGap; 169 delete fOncuraAirGap; 167 fOncuraAirGap = nullptr; 170 fOncuraAirGap = nullptr; 168 171 169 delete fOncuraCapsuleTip2Phys; 172 delete fOncuraCapsuleTip2Phys; 170 fOncuraCapsuleTip2Phys = nullptr; 173 fOncuraCapsuleTip2Phys = nullptr; 171 174 172 delete fOncuraCapsuleTip2Log; 175 delete fOncuraCapsuleTip2Log; 173 fOncuraCapsuleTip2Log = nullptr; 176 fOncuraCapsuleTip2Log = nullptr; 174 177 175 delete fOncuraCapsuleTip2; 178 delete fOncuraCapsuleTip2; 176 fOncuraCapsuleTip2 = nullptr; 179 fOncuraCapsuleTip2 = nullptr; 177 180 178 delete fOncuraCapsuleTip1Phys; 181 delete fOncuraCapsuleTip1Phys; 179 fOncuraCapsuleTip1Phys = nullptr; 182 fOncuraCapsuleTip1Phys = nullptr; 180 183 181 delete fOncuraCapsuleTip1Log; 184 delete fOncuraCapsuleTip1Log; 182 fOncuraCapsuleTip1Log = nullptr; 185 fOncuraCapsuleTip1Log = nullptr; 183 186 184 delete fOncuraCapsuleTip1; 187 delete fOncuraCapsuleTip1; 185 fOncuraCapsuleTip1 = nullptr; 188 fOncuraCapsuleTip1 = nullptr; 186 189 187 delete fOncuraCapsulePhys; 190 delete fOncuraCapsulePhys; 188 fOncuraCapsulePhys = nullptr; 191 fOncuraCapsulePhys = nullptr; 189 192 190 delete fOncuraCapsuleLog; 193 delete fOncuraCapsuleLog; 191 fOncuraCapsuleLog = nullptr; 194 fOncuraCapsuleLog = nullptr; 192 195 193 delete fOncuraCapsule; 196 delete fOncuraCapsule; 194 fOncuraCapsule = nullptr; 197 fOncuraCapsule = nullptr; 195 198 196 G4RunManager::GetRunManager() -> GeometryHasB 199 G4RunManager::GetRunManager() -> GeometryHasBeenModified(); 197 } 200 } 198 201