Geant4_10
DetectorConstruction.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 // Authors: Susanna Guatelli, susanna@uow.edu.au,
27 // Authors: Jeremy Davis, jad028@uowmail.edu.au
28 //
29 
30 #include "DetectorConstruction.hh"
31 #include "globals.hh"
32 #include "G4Element.hh"
33 #include "G4Material.hh"
34 #include "G4PVPlacement.hh"
35 #include "G4LogicalVolume.hh"
36 #include "G4Box.hh"
37 #include "G4Tubs.hh"
38 //#include "G4SubtractionSolid.hh"
39 #include "G4FieldManager.hh"
41 #include "G4ChordFinder.hh"
42 #include "G4Colour.hh"
43 #include "G4VisAttributes.hh"
44 #include "SensitiveDetector.hh"
45 #include "G4SDManager.hh"
46 #include "G4UserLimits.hh"
47 #include "Randomize.hh"
48 #include "G4ThreeVector.hh"
49 #include "G4GeometryTolerance.hh"
50 #include "G4GeometryManager.hh"
51 #include "G4SystemOfUnits.hh"
52 
54 {
55 analysis = analysis_manager;
56 }
57 
59 
60 }
61 
63 {
64 
65 //Define each individual element
66 //Define Nitrogen
67  G4double A = 14.01 * g/mole;
68  G4double Z = 7;
69  G4Element* elN = new G4Element ("Nitrogen", "N", Z, A);
70 
71 //Define Oxygen
72  A = 16.0 * g/mole;
73  Z = 8;
74  G4Element* elO = new G4Element ("Oxygen", "O", Z, A);
75 
76 //Define Hydrogen
77  A = 1.01 * g/mole;
78  Z = 1;
79  G4Element* elH = new G4Element ("Hydrogen", "H", Z, A);
80 
81 //Define Boron
82  A = 10.8 * g/mole;
83  Z = 5;
84  G4Element* elB = new G4Element ("Boron", "B", Z, A);
85 
86 //Define Carbon
87  A = 12.01 * g/mole;
88  Z = 6;
89  G4Element* elC = new G4Element ("Carbon", "C", Z, A);
90 
91 //Define Air
92  G4Material* Air = new G4Material("Air", 1.29*mg/cm3, 2);
93  Air -> AddElement(elN, 70*perCent);
94  Air -> AddElement(elO, 30*perCent);
95 
96 //Define diamond
97  A = 12.01 * g/mole;
98  Z = 6;
99  G4Material* diamond = new G4Material("diamond", Z, A, 3.515*g/cm3);
100 
101 //Define dopant (boron doped diamond)
102  G4Material* dopant = new G4Material("dopant", 3.514*g/cm3, 2);
103  dopant -> AddElement(elC, 99.9994*perCent);
104  dopant -> AddElement(elB, 0.0006*perCent);
105 
106  //Define Aluminium contacts (AlContact)
107  A = 26.981 * g/mole;
108  Z = 13;
109  G4Material* AlContact = new G4Material("AlContact", Z, A, 2.7 *g/cm3);
110 
111  //Define Gold contact (AuContact)
112  A = 196.97 * g/mole;
113  Z = 79;
114  G4Material* AuContact = new G4Material("AuContact", Z, A, 19.3 *g/cm3);
115 
116  //Define PMMA (C502H8)
117  // NIST reference
118  G4Material* PMMA = new G4Material("PMMA", 1.19*g/cm3, 3);
119  PMMA -> AddElement(elC, 5);
120  PMMA -> AddElement(elO, 2);
121  PMMA -> AddElement(elH, 8);
122 
123  //define water
124  G4Material* water = new G4Material("water", 1*g/cm3, 2);
125  water -> AddElement(elH, 2);
126  water -> AddElement(elO, 1);
127 
128  //Define Vacuum
129  G4double vacuumDensity = 1.e-25 *g/cm3;
130  G4double pressure = 3.e-18*pascal;
131  G4double temperature = 2.73*kelvin;
132  G4Material* vacuum = new G4Material("Galactic", Z=1., A=1.01*g/mole,
133  vacuumDensity,kStateGas,temperature,pressure);
134 
135  //Define volumes
136  // World volume has size 1cm
137  G4double worldx = 0.5 * m; //half length!!!!
138  G4double worldy = 0.5 * m;
139  G4double worldz = 0.5 * m;
140 
141  // World volume, containing all geometry
142  G4Box* world = new G4Box("world_box", worldx, worldy, worldz);
143 
144  G4LogicalVolume* logical_world = new G4LogicalVolume(world, vacuum, "world_log", 0,0,0);
145 
146  //set the logical world volume invisible
147  logical_world -> SetVisAttributes(G4VisAttributes::Invisible);
148 
149  G4VPhysicalVolume* physical_world = new G4PVPlacement(0,
150  G4ThreeVector(),
151  logical_world,
152  "world_phys",
153  0,
154  false,
155  0);
156 
157 
158  // Define the geometry of the diamond microdosimeter
159  // mother volume of the detector components
160  G4double DiaVol_x = 300*micrometer;
161  G4double DiaVol_y = 240*micrometer;
162  G4double DiaVol_z = 150*micrometer;
163 
164  G4Box* DiaVol_box = new G4Box("DiaVol_box",DiaVol_x,DiaVol_y,DiaVol_z);
165 
166  G4LogicalVolume* logical_DiaVol = new G4LogicalVolume(DiaVol_box, diamond, "DiaVol_log", 0,0,0);
167 
168  new G4PVPlacement(0, G4ThreeVector(0,0,0), logical_DiaVol,"DiaVol_phys",
169  logical_world,
170  false, 0, true);
171 
172  //VacBlock for contact placement
173  G4double vacblock_x = 300*um;
174  G4double vacblock_y = 240*um;
175  G4double vacblock_z = 0.25*um;
176 
177  G4Box* vacblock_box = new G4Box("vacblock_box",vacblock_x,vacblock_y,vacblock_z);
178 
179  G4LogicalVolume* logical_vacblock = new G4LogicalVolume(vacblock_box, vacuum, "vacblock_log", 0,0,0);
180 
181  new G4PVPlacement(0,
182  G4ThreeVector(0,0,DiaVol_z - vacblock_z),
183  logical_vacblock,
184  "vacblock_phys",
185  logical_DiaVol,
186  false,
187  0, true);
188 //Bdl in DiaVol
189  G4double Bdl_x = 300*micrometer;
190  G4double Bdl_y = 240*micrometer;
191  G4double Bdl_z = 0.69*micrometer;
192 
193  G4Box* Bdl_box = new G4Box("Bdl_box",Bdl_x,Bdl_y,Bdl_z);
194 
195  G4LogicalVolume* logical_Bdl = new G4LogicalVolume(Bdl_box, dopant, "Bdl_log", 0,0,0);
196 
197  new G4PVPlacement(0,
198  G4ThreeVector(0,0,DiaVol_z - Bdl_z - vacblock_z- vacblock_z),
199  logical_Bdl,
200  "Bdl_phys",
201  logical_DiaVol, //mother volume
202  false,
203  0, true);
204 
205  //Diamond SV
206  G4double SV_x = 75*um;
207  G4double SV_y = 75*um;
208  G4double SV_z = 0.69*um;
209 
210  G4Box* SV_box = new G4Box("SV_box",SV_x,SV_y,SV_z);
211 
212  G4LogicalVolume* logical_SV = new G4LogicalVolume(SV_box, diamond, "SV_log", 0,0,0);
213 
214  new G4PVPlacement(0, G4ThreeVector(-45*um,105*um,0*um), logical_SV,"SV_phys1",
215  logical_Bdl,false, 0, true);
216 
217  new G4PVPlacement(0, G4ThreeVector(165*um,105*um,0*um), logical_SV,"SV_phys2",
218  logical_Bdl, false, 0, true);
219 
220  new G4PVPlacement(0, G4ThreeVector(-45*um,-105*um,0*um),logical_SV,"SV_phys3",
221  logical_Bdl, false, 0, true);
222 
223  new G4PVPlacement(0, G4ThreeVector(165*um,-105*um,0*um),logical_SV,"SV_phys4",
224  logical_Bdl, false, 0, true);
225 
226 //Al strips
227 //10 nm thickness
228  G4double AlStrip_x = 240*um;
229  G4double AlStrip_y = 240*um;
230  G4double AlStrip_z = vacblock_z;
231 
232  G4Box* AlStrip = new G4Box("AlStrip",AlStrip_x,AlStrip_y,AlStrip_z);
233 
234  G4LogicalVolume* logical_AlStrip = new G4LogicalVolume(AlStrip, AlContact, "AlStrip_log", 0,0,0);
235 
236  new G4PVPlacement(0, G4ThreeVector(60*um,0,0), logical_AlStrip, "AlStrip_phys",
237  logical_vacblock, false, 0, true);
238 
239 //gold cylinder in vacblock
240  G4double innerRadiusOfTheTube1 = 0.*um;
241  G4double outerRadiusOfTheTube1 = 45.*um;
242  G4double heightOfTheTube1 = 10*nm;
243  G4double startAngleOfTheTube1 = 0.*deg;
244  G4double spanningAngleOfTheTube1 = 360.*deg;
245 
246  G4Tubs* GoldCylinder1 = new G4Tubs("GoldCylinder1", innerRadiusOfTheTube1,
247  outerRadiusOfTheTube1,
248  heightOfTheTube1,
249  startAngleOfTheTube1,
250  spanningAngleOfTheTube1);
251 
252  G4LogicalVolume* logical_GoldCylinder1 = new G4LogicalVolume(GoldCylinder1, AuContact, "GoldCylinder1_log", 0,0,0);
253 
254  new G4PVPlacement(0,G4ThreeVector(-245*um,0,-vacblock_z + heightOfTheTube1),
255  logical_GoldCylinder1,
256  "GoldCylinder1_phys",
257  logical_vacblock, false, 0, true);
258 
259 //gold contacts
260  G4double innerRadiusOfTheTube2 = 0.*um;
261  G4double outerRadiusOfTheTube2 = 45.*um;
262  G4double heightOfTheTube2 = Bdl_z;
263  G4double startAngleOfTheTube2 = 0.*deg;
264  G4double spanningAngleOfTheTube2 = 360.*deg;
265 
266  G4Tubs* GoldCylinder2 = new G4Tubs("GoldCylinder2",
267  innerRadiusOfTheTube2,
268  outerRadiusOfTheTube2,
269  heightOfTheTube2,
270  startAngleOfTheTube2,
271  spanningAngleOfTheTube2);
272 
273  G4LogicalVolume* logical_GoldCylinder2 = new G4LogicalVolume(GoldCylinder2, AuContact, "GoldCylinder2_log", 0,0,0);
274 
275  new G4PVPlacement(0, G4ThreeVector(-245*um,0,0), logical_GoldCylinder2, "GoldCylinder2_phys",
276  logical_Bdl, false, 0, true);
277 
278 //gold cylinder in DiaVol
279  G4double innerRadiusOfTheTube3 = 0.*um;
280  G4double outerRadiusOfTheTube3 = 45.*um;
281  G4double heightOfTheTube3 = 75.*um -heightOfTheTube2 - heightOfTheTube1 ;
282  G4double startAngleOfTheTube3 = 0.*deg;
283  G4double spanningAngleOfTheTube3 = 360.*deg;
284 
285  G4Tubs* GoldCylinder3 = new G4Tubs("GoldCylinder3",
286  innerRadiusOfTheTube3,
287  outerRadiusOfTheTube3,
288  heightOfTheTube3,
289  startAngleOfTheTube3,
290  spanningAngleOfTheTube3);
291 
292 G4LogicalVolume* logical_GoldCylinder3 = new G4LogicalVolume(GoldCylinder3, AuContact, "GoldCylinder3_log", 0,0,0);
293 
294 new G4PVPlacement(0, G4ThreeVector(-245*um,0,DiaVol_z - heightOfTheTube3 - Bdl_z - Bdl_z - vacblock_z- vacblock_z),
295  logical_GoldCylinder3,
296  "GoldCylinder3_phys",
297  logical_DiaVol,
298  false,
299  0, true);
300 
301 // Visualisation attributes
302 
303  logical_DiaVol -> SetVisAttributes(G4VisAttributes(G4Colour(255,255,255))); //white
304  logical_Bdl -> SetVisAttributes(G4VisAttributes(G4Colour(0,255,0))); //green
305 
306  G4VisAttributes vis_SV(G4Colour(198, 226, 255));
307  vis_SV.SetForceSolid(true);
308  logical_SV -> SetVisAttributes(vis_SV);
309  logical_vacblock -> SetVisAttributes(G4VisAttributes::Invisible);
310  logical_AlStrip -> SetVisAttributes(G4VisAttributes(G4Colour(0, 255, 255)));//cyan
311 
312  G4VisAttributes vis_GoldCylinder1(G4Colour(255, 255, 0));
313  vis_GoldCylinder1.SetForceAuxEdgeVisible(true);
314  logical_GoldCylinder1 -> SetVisAttributes(vis_GoldCylinder1);
315 
316  G4VisAttributes vis_GoldCylinder2(G4Colour(255, 255, 0));
317  vis_GoldCylinder2.SetForceAuxEdgeVisible(true);
318  logical_GoldCylinder2 -> SetVisAttributes(vis_GoldCylinder2);
319 
320  G4VisAttributes vis_GoldCylinder3(G4Colour(255, 255, 0));
321  vis_GoldCylinder3.SetForceAuxEdgeVisible(true);
322  logical_GoldCylinder3 -> SetVisAttributes(vis_GoldCylinder3);
323 
324 return physical_world;
325 
326 }
327 
329 {
330  SensitiveDetector* SD = new SensitiveDetector("SD", "DetectorHitsCollection", analysis);
331  SetSensitiveDetector("SV_log", SD);
332 }
G4Material * Air
Definition: TRTMaterials.hh:57
CLHEP::Hep3Vector G4ThreeVector
Definition: G4Box.hh:63
G4VPhysicalVolume * Construct()
Definition: G4Tubs.hh:84
G4Element * elC
Definition: TRTMaterials.hh:48
G4Element * elN
Definition: TRTMaterials.hh:44
G4Element * elH
Definition: TRTMaterials.hh:50
function g(Y1, Y2, PT2)
Definition: hijing1.383.f:5205
G4Element * elO
Definition: TRTMaterials.hh:46
Float_t Z
Definition: plot.C:39
#define pascal
void SetSensitiveDetector(const G4String &logVolName, G4VSensitiveDetector *aSD, G4bool multi=false)
static const G4VisAttributes Invisible
float perCent
Definition: hepunit.py:239
double G4double
Definition: G4Types.hh:76
Air AddElement(elN,.7)
int micrometer
Definition: hepunit.py:34