ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BrachyDetectorConstructionI.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file BrachyDetectorConstructionI.cc
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 //
40 #include "globals.hh"
41 #include "G4SystemOfUnits.hh"
43 #include "G4CSGSolid.hh"
44 #include "G4Sphere.hh"
46 #include "G4RunManager.hh"
47 #include "G4Box.hh"
48 #include "G4Tubs.hh"
49 #include "G4LogicalVolume.hh"
50 #include "G4ThreeVector.hh"
51 #include "G4PVPlacement.hh"
52 #include "G4Transform3D.hh"
53 #include "G4RotationMatrix.hh"
55 #include "BrachyMaterial.hh"
56 #include "G4VisAttributes.hh"
57 #include "G4Colour.hh"
58 
60 defaultTub(0), capsule(0), capsuleTip(0),iodiumCore(0), defaultTubLog(0),
61 capsuleLog(0), capsuleTipLog(0), iodiumCoreLog(0),defaultTubPhys(0),
62 capsulePhys(0),capsuleTipPhys1(0),capsuleTipPhys2(0), iodiumCorePhys(0),
63 simpleiodiumVisAtt(0), simpleCapsuleVisAtt(0), simpleCapsuleTipVisAtt(0)
64 {
65  pMaterial = new BrachyMaterial();
66 }
67 
69 {
70  delete pMaterial;
71 }
72 
74 {
75  // source Bebig Isoseed I-125 ...
76 
77  //Get materials for source construction ...
78  G4Material* titanium = pMaterial -> GetMat("titanium");
79  G4Material* air = pMaterial -> GetMat("Air");
80  G4Material* iodium = pMaterial -> GetMat("Iodine");
81 
82  G4Colour red (1.0, 0.0, 0.0) ;
83  G4Colour magenta (1.0, 0.0, 1.0) ;
84  G4Colour lblue (0.0, 0.0, .75);
85 
86  // Air tub
87  defaultTub = new G4Tubs("DefaultTub",0.*mm, 0.40*mm, 1.84*mm, 0.*deg, 360.*deg);
88  defaultTubLog = new G4LogicalVolume(defaultTub,air,"DefaultTub_Log");
90  G4ThreeVector(),
91  "defaultTub_Phys",
93  mother,
94  false,
95  0, true);
96  // Capsule main body ...
97  G4double capsuleR = 0.35*mm;
98  capsule = new G4Tubs("Capsule", capsuleR,0.40*mm,1.84*mm,0.*deg,360.*deg);
99  capsuleLog = new G4LogicalVolume(capsule,titanium,"CapsuleLog");
100  capsulePhys = new G4PVPlacement(0,
101  G4ThreeVector(),
102  "CapsulePhys",
103  capsuleLog,
105  false,
106  0, true);
107  // Capsule tips
108  capsuleTip = new G4Sphere("CapsuleTip",
109  0.*mm,
110  0.40*mm,
111  0.*deg,
112  360.*deg,
113  0.*deg,
114  90.*deg);
115  capsuleTipLog = new G4LogicalVolume(capsuleTip,titanium,"CapsuleTipLog");
117  G4ThreeVector(0.,0.,1.84*mm),
118  "IodineCapsuleTipPhys1",
120  mother,
121  false,
122  0, true);
123 
124  G4RotationMatrix* rotateMatrix = new G4RotationMatrix();
125  rotateMatrix -> rotateX(180.0*deg);
126  capsuleTipPhys2 = new G4PVPlacement(rotateMatrix,
127  G4ThreeVector(0,0,-1.84*mm),
128  "IodineCapsuleTipPhys2",
130  mother,
131  false,
132  0, true);
133 
134  // Radiactive core ...
135  iodiumCore = new G4Tubs("ICore",0.085*mm,0.35*mm,1.75*mm,0.*deg,360.*deg);
136  iodiumCoreLog = new G4LogicalVolume(iodiumCore,iodium,"iodiumCoreLog");
138  G4ThreeVector(0.,0.,0.),
139  "iodiumCorePhys",
142  false,
143  0, true);
144 
145  // Visual attributes ...
146 
147  simpleiodiumVisAtt= new G4VisAttributes(magenta);
148  simpleiodiumVisAtt -> SetVisibility(true);
149  simpleiodiumVisAtt -> SetForceSolid(true);
150  iodiumCoreLog -> SetVisAttributes(simpleiodiumVisAtt);
151 
153  simpleCapsuleVisAtt -> SetVisibility(true);
154  simpleCapsuleVisAtt -> SetForceWireframe(true);
155  capsuleLog -> SetVisAttributes( simpleCapsuleVisAtt);
156 
158  simpleCapsuleTipVisAtt -> SetVisibility(true);
159  simpleCapsuleTipVisAtt -> SetForceSolid(true);
160  capsuleTipLog -> SetVisAttributes( simpleCapsuleTipVisAtt);
161 }
162 
164 {
168 delete capsuleTipPhys1; capsuleTipPhys1 = 0;
169 delete capsuleTipPhys2; capsuleTipPhys2 = 0;
170 delete iodiumCorePhys; iodiumCorePhys = 0;
171 delete capsulePhys; capsulePhys = 0;
172 delete defaultTubPhys; defaultTubPhys = 0;
173 delete defaultTubLog; defaultTubLog = 0;
174 delete capsuleLog; capsuleLog = 0;
175 delete capsuleTipLog; capsuleTipLog = 0;
176 delete iodiumCoreLog; iodiumCoreLog = 0;
177 delete defaultTub; defaultTub = 0;
178 delete capsule; capsule = 0;
179 delete capsuleTip; capsuleTip = 0;
180 delete iodiumCore; iodiumCore = 0;
181 
183 }