Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BrachyDetectorConstructionI.cc
Go to the documentation of this file.
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: S.Guatelli
32 //
34 // * *
35 // * BrachyDetectorConstructionI.cc *
36 // * *
37 // ****************************************
38 //
39 // $Id: BrachyDetectorConstructionI.cc 100821 2016-11-02 15:21:34Z gcosmo $
40 //
41 #include "globals.hh"
42 #include "G4SystemOfUnits.hh"
44 #include "G4CSGSolid.hh"
45 #include "G4Sphere.hh"
47 #include "G4RunManager.hh"
48 #include "G4Box.hh"
49 #include "G4Tubs.hh"
50 #include "G4LogicalVolume.hh"
51 #include "G4ThreeVector.hh"
52 #include "G4PVPlacement.hh"
53 #include "G4Transform3D.hh"
54 #include "G4RotationMatrix.hh"
56 #include "BrachyMaterial.hh"
57 #include "G4VisAttributes.hh"
58 #include "G4Colour.hh"
59 
61 defaultTub(0), capsule(0), capsuleTip(0),iodiumCore(0), defaultTubLog(0),
62 capsuleLog(0), capsuleTipLog(0), iodiumCoreLog(0),defaultTubPhys(0),
63 capsulePhys(0),capsuleTipPhys1(0),capsuleTipPhys2(0), iodiumCorePhys(0),
64 simpleiodiumVisAtt(0), simpleCapsuleVisAtt(0), simpleCapsuleTipVisAtt(0)
65 {
66  pMaterial = new BrachyMaterial();
67 }
68 
70 {
71  delete pMaterial;
72 }
73 
75 {
76  // source Bebig Isoseed I-125 ...
77 
78  //Get materials for source construction ...
79  G4Material* titanium = pMaterial -> GetMat("titanium");
80  G4Material* air = pMaterial -> GetMat("Air");
81  G4Material* iodium = pMaterial -> GetMat("Iodine");
82 
83  G4Colour red (1.0, 0.0, 0.0) ;
84  G4Colour magenta (1.0, 0.0, 1.0) ;
85  G4Colour lblue (0.0, 0.0, .75);
86 
87  // Air tub
88  defaultTub = new G4Tubs("DefaultTub",0.*mm, 0.40*mm, 1.84*mm, 0.*deg, 360.*deg);
89  defaultTubLog = new G4LogicalVolume(defaultTub,air,"DefaultTub_Log");
90  defaultTubPhys = new G4PVPlacement(0,
91  G4ThreeVector(),
92  "defaultTub_Phys",
93  defaultTubLog,
94  mother,
95  false,
96  0, true);
97  // Capsule main body ...
98  G4double capsuleR = 0.35*mm;
99  capsule = new G4Tubs("Capsule", capsuleR,0.40*mm,1.84*mm,0.*deg,360.*deg);
100  capsuleLog = new G4LogicalVolume(capsule,titanium,"CapsuleLog");
101  capsulePhys = new G4PVPlacement(0,
102  G4ThreeVector(),
103  "CapsulePhys",
104  capsuleLog,
105  defaultTubPhys,
106  false,
107  0, true);
108  // Capsule tips
109  capsuleTip = new G4Sphere("CapsuleTip",
110  0.*mm,
111  0.40*mm,
112  0.*deg,
113  360.*deg,
114  0.*deg,
115  90.*deg);
116  capsuleTipLog = new G4LogicalVolume(capsuleTip,titanium,"CapsuleTipLog");
117  capsuleTipPhys1 = new G4PVPlacement(0,
118  G4ThreeVector(0.,0.,1.84*mm),
119  "IodineCapsuleTipPhys1",
120  capsuleTipLog,
121  mother,
122  false,
123  0, true);
124 
125  G4RotationMatrix* rotateMatrix = new G4RotationMatrix();
126  rotateMatrix -> rotateX(180.0*deg);
127  capsuleTipPhys2 = new G4PVPlacement(rotateMatrix,
128  G4ThreeVector(0,0,-1.84*mm),
129  "IodineCapsuleTipPhys2",
130  capsuleTipLog,
131  mother,
132  false,
133  0, true);
134 
135  // Radiactive core ...
136  iodiumCore = new G4Tubs("ICore",0.085*mm,0.35*mm,1.75*mm,0.*deg,360.*deg);
137  iodiumCoreLog = new G4LogicalVolume(iodiumCore,iodium,"iodiumCoreLog");
138  iodiumCorePhys = new G4PVPlacement(0,
139  G4ThreeVector(0.,0.,0.),
140  "iodiumCorePhys",
141  iodiumCoreLog,
142  defaultTubPhys,
143  false,
144  0, true);
145 
146  // Visual attributes ...
147 
148  simpleiodiumVisAtt= new G4VisAttributes(magenta);
149  simpleiodiumVisAtt -> SetVisibility(true);
150  simpleiodiumVisAtt -> SetForceSolid(true);
151  iodiumCoreLog -> SetVisAttributes(simpleiodiumVisAtt);
152 
153  simpleCapsuleVisAtt= new G4VisAttributes(red);
154  simpleCapsuleVisAtt -> SetVisibility(true);
155  simpleCapsuleVisAtt -> SetForceWireframe(true);
156  capsuleLog -> SetVisAttributes( simpleCapsuleVisAtt);
157 
158  simpleCapsuleTipVisAtt= new G4VisAttributes(red);
159  simpleCapsuleTipVisAtt -> SetVisibility(true);
160  simpleCapsuleTipVisAtt -> SetForceSolid(true);
161  capsuleTipLog -> SetVisAttributes( simpleCapsuleTipVisAtt);
162 }
163 
165 {
166 delete simpleiodiumVisAtt; simpleiodiumVisAtt = 0;
167 delete simpleCapsuleVisAtt; simpleCapsuleVisAtt = 0;
168 delete simpleCapsuleTipVisAtt; simpleCapsuleTipVisAtt = 0;
169 delete capsuleTipPhys1; capsuleTipPhys1 = 0;
170 delete capsuleTipPhys2; capsuleTipPhys2 = 0;
171 delete iodiumCorePhys; iodiumCorePhys = 0;
172 delete capsulePhys; capsulePhys = 0;
173 delete defaultTubPhys; defaultTubPhys = 0;
174 delete defaultTubLog; defaultTubLog = 0;
175 delete capsuleLog; capsuleLog = 0;
176 delete capsuleTipLog; capsuleTipLog = 0;
177 delete iodiumCoreLog; iodiumCoreLog = 0;
178 delete defaultTub; defaultTub = 0;
179 delete capsule; capsule = 0;
180 delete capsuleTip; capsuleTip = 0;
181 delete iodiumCore; iodiumCore = 0;
182 
184 }
static constexpr double mm
Definition: G4SIunits.hh:115
Definition: test07.cc:36
CLHEP::Hep3Vector G4ThreeVector
CLHEP::HepRotation G4RotationMatrix
Definition: G4Tubs.hh:85
void ConstructIodium(G4VPhysicalVolume *)
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:79
double G4double
Definition: G4Types.hh:76
static constexpr double deg
Definition: G4SIunits.hh:152