source: trunk/examples/novice/N06/src/ExN06DetectorConstruction.cc@ 1357

Last change on this file since 1357 was 1342, checked in by garnier, 15 years ago

update ti head

File size: 11.9 KB
RevLine 
[807]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//
[1342]27// $Id: ExN06DetectorConstruction.cc,v 1.18 2010/10/23 19:27:38 gum Exp $
28// GEANT4 tag $Name: examples-V09-03-09 $
[807]29//
30//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
31//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32
33#include "ExN06DetectorConstruction.hh"
34
35#include "G4Material.hh"
36#include "G4Element.hh"
37#include "G4LogicalBorderSurface.hh"
38#include "G4LogicalSkinSurface.hh"
[1342]39#include "G4OpticalSurface.hh"
[807]40#include "G4Box.hh"
41#include "G4LogicalVolume.hh"
42#include "G4ThreeVector.hh"
43#include "G4PVPlacement.hh"
44
45//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
46
47ExN06DetectorConstruction::ExN06DetectorConstruction()
48{
[1342]49 expHall_x = expHall_y = expHall_z = 10.0*m;
50 tank_x = tank_y = tank_z = 5.0*m;
51 bubble_x = bubble_y = bubble_z = 0.5*m;
[807]52}
53
54//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
55
56ExN06DetectorConstruction::~ExN06DetectorConstruction(){;}
57
58//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
59
60G4VPhysicalVolume* ExN06DetectorConstruction::Construct()
61{
62
63// ------------- Materials -------------
64
65 G4double a, z, density;
66 G4int nelements;
67
68// Air
69//
70 G4Element* N = new G4Element("Nitrogen", "N", z=7 , a=14.01*g/mole);
71 G4Element* O = new G4Element("Oxygen" , "O", z=8 , a=16.00*g/mole);
72
73 G4Material* Air = new G4Material("Air", density=1.29*mg/cm3, nelements=2);
74 Air->AddElement(N, 70.*perCent);
75 Air->AddElement(O, 30.*perCent);
76
77// Water
78//
79 G4Element* H = new G4Element("Hydrogen", "H", z=1 , a=1.01*g/mole);
80
81 G4Material* Water = new G4Material("Water", density= 1.0*g/cm3, nelements=2);
82 Water->AddElement(H, 2);
83 Water->AddElement(O, 1);
84
85//
86// ------------ Generate & Add Material Properties Table ------------
87//
88 const G4int nEntries = 32;
89
90 G4double PhotonEnergy[nEntries] =
91 { 2.034*eV, 2.068*eV, 2.103*eV, 2.139*eV,
92 2.177*eV, 2.216*eV, 2.256*eV, 2.298*eV,
93 2.341*eV, 2.386*eV, 2.433*eV, 2.481*eV,
94 2.532*eV, 2.585*eV, 2.640*eV, 2.697*eV,
95 2.757*eV, 2.820*eV, 2.885*eV, 2.954*eV,
96 3.026*eV, 3.102*eV, 3.181*eV, 3.265*eV,
97 3.353*eV, 3.446*eV, 3.545*eV, 3.649*eV,
98 3.760*eV, 3.877*eV, 4.002*eV, 4.136*eV };
99//
100// Water
101//
102 G4double RefractiveIndex1[nEntries] =
103 { 1.3435, 1.344, 1.3445, 1.345, 1.3455,
104 1.346, 1.3465, 1.347, 1.3475, 1.348,
105 1.3485, 1.3492, 1.35, 1.3505, 1.351,
106 1.3518, 1.3522, 1.3530, 1.3535, 1.354,
107 1.3545, 1.355, 1.3555, 1.356, 1.3568,
108 1.3572, 1.358, 1.3585, 1.359, 1.3595,
109 1.36, 1.3608};
110
111 G4double Absorption1[nEntries] =
112 {3.448*m, 4.082*m, 6.329*m, 9.174*m, 12.346*m, 13.889*m,
113 15.152*m, 17.241*m, 18.868*m, 20.000*m, 26.316*m, 35.714*m,
114 45.455*m, 47.619*m, 52.632*m, 52.632*m, 55.556*m, 52.632*m,
115 52.632*m, 47.619*m, 45.455*m, 41.667*m, 37.037*m, 33.333*m,
116 30.000*m, 28.500*m, 27.000*m, 24.500*m, 22.000*m, 19.500*m,
117 17.500*m, 14.500*m };
118
119 G4double ScintilFast[nEntries] =
120 { 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
121 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
122 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
123 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
124 1.00, 1.00, 1.00, 1.00 };
125 G4double ScintilSlow[nEntries] =
126 { 0.01, 1.00, 2.00, 3.00, 4.00, 5.00, 6.00,
127 7.00, 8.00, 9.00, 8.00, 7.00, 6.00, 4.00,
128 3.00, 2.00, 1.00, 0.01, 1.00, 2.00, 3.00,
129 4.00, 5.00, 6.00, 7.00, 8.00, 9.00, 8.00,
130 7.00, 6.00, 5.00, 4.00 };
131
132 G4MaterialPropertiesTable* myMPT1 = new G4MaterialPropertiesTable();
133 myMPT1->AddProperty("RINDEX", PhotonEnergy, RefractiveIndex1,nEntries);
134 myMPT1->AddProperty("ABSLENGTH", PhotonEnergy, Absorption1, nEntries);
135 myMPT1->AddProperty("FASTCOMPONENT",PhotonEnergy, ScintilFast, nEntries);
136 myMPT1->AddProperty("SLOWCOMPONENT",PhotonEnergy, ScintilSlow, nEntries);
137
138 myMPT1->AddConstProperty("SCINTILLATIONYIELD",50./MeV);
139 myMPT1->AddConstProperty("RESOLUTIONSCALE",1.0);
140 myMPT1->AddConstProperty("FASTTIMECONSTANT", 1.*ns);
141 myMPT1->AddConstProperty("SLOWTIMECONSTANT",10.*ns);
142 myMPT1->AddConstProperty("YIELDRATIO",0.8);
[1342]143
144 const G4int NUMENTRIES_water = 90;
145
146 G4double ENERGY_water[NUMENTRIES_water] = {
147 1.56962*eV, 1.58974*eV, 1.61039*eV, 1.63157*eV,
148 1.65333*eV, 1.67567*eV, 1.69863*eV, 1.72222*eV,
149 1.74647*eV, 1.77142*eV, 1.7971 *eV, 1.82352*eV,
150 1.85074*eV, 1.87878*eV, 1.90769*eV, 1.93749*eV,
151 1.96825*eV, 1.99999*eV, 2.03278*eV, 2.06666*eV,
152 2.10169*eV, 2.13793*eV, 2.17543*eV, 2.21428*eV,
153 2.25454*eV, 2.29629*eV, 2.33962*eV, 2.38461*eV,
154 2.43137*eV, 2.47999*eV, 2.53061*eV, 2.58333*eV,
155 2.63829*eV, 2.69565*eV, 2.75555*eV, 2.81817*eV,
156 2.88371*eV, 2.95237*eV, 3.02438*eV, 3.09999*eV,
157 3.17948*eV, 3.26315*eV, 3.35134*eV, 3.44444*eV,
158 3.54285*eV, 3.64705*eV, 3.75757*eV, 3.87499*eV,
159 3.99999*eV, 4.13332*eV, 4.27585*eV, 4.42856*eV,
160 4.59258*eV, 4.76922*eV, 4.95999*eV, 5.16665*eV,
161 5.39129*eV, 5.63635*eV, 5.90475*eV, 6.19998*eV
162 };
163
164 //assume 100 times larger than the rayleigh scattering for now.
165 G4double MIE_water[NUMENTRIES_water] = {
166 167024.4*m, 158726.7*m, 150742 *m,
167 143062.5*m, 135680.2*m, 128587.4*m,
168 121776.3*m, 115239.5*m, 108969.5*m,
169 102958.8*m, 97200.35*m, 91686.86*m,
170 86411.33*m, 81366.79*m, 76546.42*m,
171 71943.46*m, 67551.29*m, 63363.36*m,
172 59373.25*m, 55574.61*m, 51961.24*m,
173 48527.00*m, 45265.87*m, 42171.94*m,
174 39239.39*m, 36462.50*m, 33835.68*m,
175 31353.41*m, 29010.30*m, 26801.03*m,
176 24720.42*m, 22763.36*m, 20924.88*m,
177 19200.07*m, 17584.16*m, 16072.45*m,
178 14660.38*m, 13343.46*m, 12117.33*m,
179 10977.70*m, 9920.416*m, 8941.407*m,
180 8036.711*m, 7202.470*m, 6434.927*m,
181 5730.429*m, 5085.425*m, 4496.467*m,
182 3960.210*m, 3473.413*m, 3032.937*m,
183 2635.746*m, 2278.907*m, 1959.588*m,
184 1675.064*m, 1422.710*m, 1200.004*m,
185 1004.528*m, 833.9666*m, 686.1063*m
186 };
187
188 // gforward, gbackward, forward backward ratio
189 G4double MIE_water_const[3]={0.99,0.99,0.8};
190
191 myMPT1->AddProperty("MIEHG",ENERGY_water,MIE_water,NUMENTRIES_water);
192 myMPT1->AddConstProperty("MIEHG_FORWARD",MIE_water_const[0]);
193 myMPT1->AddConstProperty("MIEHG_BACKWARD",MIE_water_const[1]);
194 myMPT1->AddConstProperty("MIEHG_FORWARD_RATIO",MIE_water_const[2]);
195
[807]196 Water->SetMaterialPropertiesTable(myMPT1);
197
[1230]198 // Set the Birks Constant for the Water scintillator
199
200 Water->GetIonisation()->SetBirksConstant(0.126*mm/MeV);
201
[807]202//
203// Air
204//
205 G4double RefractiveIndex2[nEntries] =
206 { 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
207 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
208 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
209 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
210 1.00, 1.00, 1.00, 1.00 };
211
212 G4MaterialPropertiesTable* myMPT2 = new G4MaterialPropertiesTable();
213 myMPT2->AddProperty("RINDEX", PhotonEnergy, RefractiveIndex2, nEntries);
214
215 Air->SetMaterialPropertiesTable(myMPT2);
216
217//
218// ------------- Volumes --------------
219
220// The experimental Hall
221//
222 G4Box* expHall_box = new G4Box("World",expHall_x,expHall_y,expHall_z);
223
224 G4LogicalVolume* expHall_log
225 = new G4LogicalVolume(expHall_box,Air,"World",0,0,0);
226
227 G4VPhysicalVolume* expHall_phys
228 = new G4PVPlacement(0,G4ThreeVector(),expHall_log,"World",0,false,0);
229
230// The Water Tank
231//
232 G4Box* waterTank_box = new G4Box("Tank",tank_x,tank_y,tank_z);
233
234 G4LogicalVolume* waterTank_log
235 = new G4LogicalVolume(waterTank_box,Water,"Tank",0,0,0);
236
237 G4VPhysicalVolume* waterTank_phys
238 = new G4PVPlacement(0,G4ThreeVector(),waterTank_log,"Tank",
239 expHall_log,false,0);
240
241// The Air Bubble
242//
243 G4Box* bubbleAir_box = new G4Box("Bubble",bubble_x,bubble_y,bubble_z);
244
245 G4LogicalVolume* bubbleAir_log
246 = new G4LogicalVolume(bubbleAir_box,Air,"Bubble",0,0,0);
247
248//G4VPhysicalVolume* bubbleAir_phys =
249 new G4PVPlacement(0,G4ThreeVector(0,2.5*m,0),bubbleAir_log,"Bubble",
250 waterTank_log,false,0);
251
252// ------------- Surfaces --------------
253//
254// Water Tank
255//
256 G4OpticalSurface* OpWaterSurface = new G4OpticalSurface("WaterSurface");
257 OpWaterSurface->SetType(dielectric_dielectric);
258 OpWaterSurface->SetFinish(ground);
259 OpWaterSurface->SetModel(unified);
260
[1342]261 new G4LogicalBorderSurface("WaterSurface",
[807]262 waterTank_phys,expHall_phys,OpWaterSurface);
263
264// Air Bubble
265//
266 G4OpticalSurface* OpAirSurface = new G4OpticalSurface("AirSurface");
267 OpAirSurface->SetType(dielectric_dielectric);
268 OpAirSurface->SetFinish(polished);
269 OpAirSurface->SetModel(glisur);
270
271 G4LogicalSkinSurface* AirSurface =
272 new G4LogicalSkinSurface("AirSurface", bubbleAir_log, OpAirSurface);
273
[1230]274 G4OpticalSurface* opticalSurface = dynamic_cast <G4OpticalSurface*>
275 (AirSurface->GetSurface(bubbleAir_log)->GetSurfaceProperty());
[807]276
[1230]277 if (opticalSurface) opticalSurface->DumpInfo();
278
[807]279//
280// Generate & Add Material Properties Table attached to the optical surfaces
281//
282 const G4int num = 2;
[1342]283 G4double Ephoton[num] = {2.034*eV, 4.136*eV};
[807]284
285 //OpticalWaterSurface
286 G4double RefractiveIndex[num] = {1.35, 1.40};
287 G4double SpecularLobe[num] = {0.3, 0.3};
288 G4double SpecularSpike[num] = {0.2, 0.2};
289 G4double Backscatter[num] = {0.2, 0.2};
290
291 G4MaterialPropertiesTable* myST1 = new G4MaterialPropertiesTable();
292
293 myST1->AddProperty("RINDEX", Ephoton, RefractiveIndex, num);
294 myST1->AddProperty("SPECULARLOBECONSTANT", Ephoton, SpecularLobe, num);
295 myST1->AddProperty("SPECULARSPIKECONSTANT", Ephoton, SpecularSpike, num);
296 myST1->AddProperty("BACKSCATTERCONSTANT", Ephoton, Backscatter, num);
297
298 OpWaterSurface->SetMaterialPropertiesTable(myST1);
299
300 //OpticalAirSurface
301 G4double Reflectivity[num] = {0.3, 0.5};
302 G4double Efficiency[num] = {0.8, 1.0};
303
304 G4MaterialPropertiesTable *myST2 = new G4MaterialPropertiesTable();
305
306 myST2->AddProperty("REFLECTIVITY", Ephoton, Reflectivity, num);
307 myST2->AddProperty("EFFICIENCY", Ephoton, Efficiency, num);
308
309 OpAirSurface->SetMaterialPropertiesTable(myST2);
310
311//always return the physical World
312 return expHall_phys;
313}
314
315//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Note: See TracBrowser for help on using the repository browser.