Geant4  9.6.p02
 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$
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  capsulePhys(0),capsuleTipPhys1(0),capsuleTipPhys2(0), iodiumCorePhys(0),markerPhys(0)
62 {
63  pMaterial = new BrachyMaterial();
64 }
65 
67 {
68  delete pMaterial;
69 }
70 
72 {
73  // source Bebig Isoseed I-125 ...
74 
75  //Get materials for source construction ...
76  G4Material* titanium = pMaterial -> GetMat("titanium");
77  G4Material* air = pMaterial -> GetMat("Air");
78  G4Material* iodium = pMaterial -> GetMat("Iodium");
79  G4Material* gold = pMaterial -> GetMat("gold");
80 
81  G4Colour red (1.0, 0.0, 0.0) ;
82  G4Colour magenta (1.0, 0.0, 1.0) ;
83  G4Colour lblue (0.0, 0.0, .75);
84 
85  // Air tub
86  G4Tubs* defaultTub = new G4Tubs("DefaultTub",0.*mm, 0.40*mm, 1.84*mm, 0.*deg, 360.*deg);
87  G4LogicalVolume* defaultTubLog = new G4LogicalVolume(defaultTub,air,"DefaultTub_Log");
88  G4VPhysicalVolume* defaultTubPhys = new G4PVPlacement(0,
89  G4ThreeVector(),
90  "defaultTub_Phys",
91  defaultTubLog,
92  mother,
93  false,
94  0);
95  // Capsule main body ...
96  G4double capsuleR = 0.35*mm;
97  G4Tubs* capsule = new G4Tubs("Capsule", capsuleR,0.40*mm,1.84*mm,0.*deg,360.*deg);
98  G4LogicalVolume* capsuleLog = new G4LogicalVolume(capsule,titanium,"CapsuleLog");
99  capsulePhys = new G4PVPlacement(0,
100  G4ThreeVector(),
101  "CapsulePhys",
102  capsuleLog,
103  defaultTubPhys,
104  false,
105  0);
106  // Capsule tips
107  G4Sphere* capsuleTip = new G4Sphere("CapsuleTip",
108  0.*mm,
109  0.40*mm,
110  0.*deg,
111  360.*deg,
112  0.*deg,
113  90.*deg);
114  G4LogicalVolume* capsuleTipLog = new G4LogicalVolume(capsuleTip,titanium,"CapsuleTipLog");
115  capsuleTipPhys1 = new G4PVPlacement(0,
116  G4ThreeVector(0.,0.,1.84*mm),
117  "CapsuleTipPhys1",
118  capsuleTipLog,
119  mother,
120  false,
121  0);
122 
123  G4RotationMatrix* rotateMatrix = new G4RotationMatrix();
124  rotateMatrix -> rotateX(180.0*deg);
125  capsuleTipPhys2 = new G4PVPlacement(rotateMatrix,
126  G4ThreeVector(0,0,-1.84*mm),
127  "CapsuleTipPhys2",
128  capsuleTipLog,
129  mother,
130  false,
131  0);
132 
133  // Radiactive core ...
134  G4Tubs* iodiumCore = new G4Tubs("ICore",0.085*mm,0.35*mm,1.75*mm,0.*deg,360.*deg);
135  G4LogicalVolume* iodiumCoreLog = new G4LogicalVolume(iodiumCore,iodium,"iodiumCoreLog");
136  iodiumCorePhys = new G4PVPlacement(0,
137  G4ThreeVector(0.,0.,0.),
138  "iodiumCorePhys",
139  iodiumCoreLog,
140  defaultTubPhys,
141  false,
142  0);
143  // Golden marker
144  G4Tubs* marker = new G4Tubs("GoldenMarker",0.*mm,0.085*mm,1.75*mm,0.*deg,360.*deg);
145  G4LogicalVolume* markerLog = new G4LogicalVolume(marker,gold,"MarkerLog");
146  markerPhys = new G4PVPlacement(0,
147  G4ThreeVector(0.,0.,0.),
148  "MarkerPhys",
149  markerLog,
150  defaultTubPhys,
151  false,
152  0);
153  // Visual attributes ...
154  G4VisAttributes* simpleMarkerVisAtt= new G4VisAttributes(lblue);
155  simpleMarkerVisAtt -> SetVisibility(true);
156  simpleMarkerVisAtt -> SetForceSolid(true);
157  markerLog -> SetVisAttributes( simpleMarkerVisAtt);
158 
159  G4VisAttributes* simpleiodiumVisAtt= new G4VisAttributes(magenta);
160  simpleiodiumVisAtt -> SetVisibility(true);
161  simpleiodiumVisAtt -> SetForceWireframe(true);
162  iodiumCoreLog -> SetVisAttributes(simpleiodiumVisAtt);
163 
164  G4VisAttributes* simpleCapsuleVisAtt= new G4VisAttributes(red);
165  simpleCapsuleVisAtt -> SetVisibility(true);
166  simpleCapsuleVisAtt -> SetForceWireframe(true);
167  capsuleLog -> SetVisAttributes( simpleCapsuleVisAtt);
168 
169  G4VisAttributes* simpleCapsuleTipVisAtt= new G4VisAttributes(red);
170  simpleCapsuleTipVisAtt -> SetVisibility(true);
171  simpleCapsuleTipVisAtt -> SetForceSolid(true);
172  capsuleTipLog -> SetVisAttributes( simpleCapsuleTipVisAtt);
173 }