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

Last change on this file since 1331 was 1230, checked in by garnier, 16 years ago

update to geant4.9.3

File size: 10.2 KB
Line 
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// $Id: ExN06DetectorConstruction.cc,v 1.17 2008/07/17 00:32:34 gum Exp $
28// GEANT4 tag $Name: geant4-09-03-cand-01 $
29//
30//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
31//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32
33#include "ExN06DetectorConstruction.hh"
34
35#include "G4Material.hh"
36#include "G4MaterialTable.hh"
37#include "G4Element.hh"
38#include "G4ElementTable.hh"
39#include "G4LogicalBorderSurface.hh"
40#include "G4LogicalSkinSurface.hh"
41#include "G4Box.hh"
42#include "G4LogicalVolume.hh"
43#include "G4RotationMatrix.hh"
44#include "G4ThreeVector.hh"
45#include "G4Transform3D.hh"
46#include "G4PVPlacement.hh"
47#include "G4OpBoundaryProcess.hh"
48
49//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
50
51ExN06DetectorConstruction::ExN06DetectorConstruction()
52{
53 expHall_x = expHall_y = expHall_z = 10*m;
54 tank_x = tank_y = tank_z = 5*m;
55 bubble_x = bubble_y = bubble_z = 0.5*m;
56}
57
58//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
59
60ExN06DetectorConstruction::~ExN06DetectorConstruction(){;}
61
62//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
63
64G4VPhysicalVolume* ExN06DetectorConstruction::Construct()
65{
66
67// ------------- Materials -------------
68
69 G4double a, z, density;
70 G4int nelements;
71
72// Air
73//
74 G4Element* N = new G4Element("Nitrogen", "N", z=7 , a=14.01*g/mole);
75 G4Element* O = new G4Element("Oxygen" , "O", z=8 , a=16.00*g/mole);
76
77 G4Material* Air = new G4Material("Air", density=1.29*mg/cm3, nelements=2);
78 Air->AddElement(N, 70.*perCent);
79 Air->AddElement(O, 30.*perCent);
80
81// Water
82//
83 G4Element* H = new G4Element("Hydrogen", "H", z=1 , a=1.01*g/mole);
84
85 G4Material* Water = new G4Material("Water", density= 1.0*g/cm3, nelements=2);
86 Water->AddElement(H, 2);
87 Water->AddElement(O, 1);
88
89//
90// ------------ Generate & Add Material Properties Table ------------
91//
92 const G4int nEntries = 32;
93
94 G4double PhotonEnergy[nEntries] =
95 { 2.034*eV, 2.068*eV, 2.103*eV, 2.139*eV,
96 2.177*eV, 2.216*eV, 2.256*eV, 2.298*eV,
97 2.341*eV, 2.386*eV, 2.433*eV, 2.481*eV,
98 2.532*eV, 2.585*eV, 2.640*eV, 2.697*eV,
99 2.757*eV, 2.820*eV, 2.885*eV, 2.954*eV,
100 3.026*eV, 3.102*eV, 3.181*eV, 3.265*eV,
101 3.353*eV, 3.446*eV, 3.545*eV, 3.649*eV,
102 3.760*eV, 3.877*eV, 4.002*eV, 4.136*eV };
103//
104// Water
105//
106 G4double RefractiveIndex1[nEntries] =
107 { 1.3435, 1.344, 1.3445, 1.345, 1.3455,
108 1.346, 1.3465, 1.347, 1.3475, 1.348,
109 1.3485, 1.3492, 1.35, 1.3505, 1.351,
110 1.3518, 1.3522, 1.3530, 1.3535, 1.354,
111 1.3545, 1.355, 1.3555, 1.356, 1.3568,
112 1.3572, 1.358, 1.3585, 1.359, 1.3595,
113 1.36, 1.3608};
114
115 G4double Absorption1[nEntries] =
116 {3.448*m, 4.082*m, 6.329*m, 9.174*m, 12.346*m, 13.889*m,
117 15.152*m, 17.241*m, 18.868*m, 20.000*m, 26.316*m, 35.714*m,
118 45.455*m, 47.619*m, 52.632*m, 52.632*m, 55.556*m, 52.632*m,
119 52.632*m, 47.619*m, 45.455*m, 41.667*m, 37.037*m, 33.333*m,
120 30.000*m, 28.500*m, 27.000*m, 24.500*m, 22.000*m, 19.500*m,
121 17.500*m, 14.500*m };
122
123 G4double ScintilFast[nEntries] =
124 { 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
125 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
126 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
127 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
128 1.00, 1.00, 1.00, 1.00 };
129 G4double ScintilSlow[nEntries] =
130 { 0.01, 1.00, 2.00, 3.00, 4.00, 5.00, 6.00,
131 7.00, 8.00, 9.00, 8.00, 7.00, 6.00, 4.00,
132 3.00, 2.00, 1.00, 0.01, 1.00, 2.00, 3.00,
133 4.00, 5.00, 6.00, 7.00, 8.00, 9.00, 8.00,
134 7.00, 6.00, 5.00, 4.00 };
135
136 G4MaterialPropertiesTable* myMPT1 = new G4MaterialPropertiesTable();
137 myMPT1->AddProperty("RINDEX", PhotonEnergy, RefractiveIndex1,nEntries);
138 myMPT1->AddProperty("ABSLENGTH", PhotonEnergy, Absorption1, nEntries);
139 myMPT1->AddProperty("FASTCOMPONENT",PhotonEnergy, ScintilFast, nEntries);
140 myMPT1->AddProperty("SLOWCOMPONENT",PhotonEnergy, ScintilSlow, nEntries);
141
142 myMPT1->AddConstProperty("SCINTILLATIONYIELD",50./MeV);
143 myMPT1->AddConstProperty("RESOLUTIONSCALE",1.0);
144 myMPT1->AddConstProperty("FASTTIMECONSTANT", 1.*ns);
145 myMPT1->AddConstProperty("SLOWTIMECONSTANT",10.*ns);
146 myMPT1->AddConstProperty("YIELDRATIO",0.8);
147
148 Water->SetMaterialPropertiesTable(myMPT1);
149
150 // Set the Birks Constant for the Water scintillator
151
152 Water->GetIonisation()->SetBirksConstant(0.126*mm/MeV);
153
154//
155// Air
156//
157 G4double RefractiveIndex2[nEntries] =
158 { 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
159 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
160 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
161 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
162 1.00, 1.00, 1.00, 1.00 };
163
164 G4MaterialPropertiesTable* myMPT2 = new G4MaterialPropertiesTable();
165 myMPT2->AddProperty("RINDEX", PhotonEnergy, RefractiveIndex2, nEntries);
166
167 Air->SetMaterialPropertiesTable(myMPT2);
168
169//
170// ------------- Volumes --------------
171
172// The experimental Hall
173//
174 G4Box* expHall_box = new G4Box("World",expHall_x,expHall_y,expHall_z);
175
176 G4LogicalVolume* expHall_log
177 = new G4LogicalVolume(expHall_box,Air,"World",0,0,0);
178
179 G4VPhysicalVolume* expHall_phys
180 = new G4PVPlacement(0,G4ThreeVector(),expHall_log,"World",0,false,0);
181
182// The Water Tank
183//
184 G4Box* waterTank_box = new G4Box("Tank",tank_x,tank_y,tank_z);
185
186 G4LogicalVolume* waterTank_log
187 = new G4LogicalVolume(waterTank_box,Water,"Tank",0,0,0);
188
189 G4VPhysicalVolume* waterTank_phys
190 = new G4PVPlacement(0,G4ThreeVector(),waterTank_log,"Tank",
191 expHall_log,false,0);
192
193// The Air Bubble
194//
195 G4Box* bubbleAir_box = new G4Box("Bubble",bubble_x,bubble_y,bubble_z);
196
197 G4LogicalVolume* bubbleAir_log
198 = new G4LogicalVolume(bubbleAir_box,Air,"Bubble",0,0,0);
199
200//G4VPhysicalVolume* bubbleAir_phys =
201 new G4PVPlacement(0,G4ThreeVector(0,2.5*m,0),bubbleAir_log,"Bubble",
202 waterTank_log,false,0);
203
204// ------------- Surfaces --------------
205//
206// Water Tank
207//
208 G4OpticalSurface* OpWaterSurface = new G4OpticalSurface("WaterSurface");
209 OpWaterSurface->SetType(dielectric_dielectric);
210 OpWaterSurface->SetFinish(ground);
211 OpWaterSurface->SetModel(unified);
212
213 G4LogicalBorderSurface* WaterSurface =
214 new G4LogicalBorderSurface("WaterSurface",
215 waterTank_phys,expHall_phys,OpWaterSurface);
216
217 if(WaterSurface->GetVolume1() == waterTank_phys) G4cout << "Equal" << G4endl;
218 if(WaterSurface->GetVolume2() == expHall_phys ) G4cout << "Equal" << G4endl;
219
220// Air Bubble
221//
222 G4OpticalSurface* OpAirSurface = new G4OpticalSurface("AirSurface");
223 OpAirSurface->SetType(dielectric_dielectric);
224 OpAirSurface->SetFinish(polished);
225 OpAirSurface->SetModel(glisur);
226
227 G4LogicalSkinSurface* AirSurface =
228 new G4LogicalSkinSurface("AirSurface", bubbleAir_log, OpAirSurface);
229
230 if(AirSurface->GetLogicalVolume() == bubbleAir_log) G4cout << "Equal" << G4endl;
231 G4OpticalSurface* opticalSurface = dynamic_cast <G4OpticalSurface*>
232 (AirSurface->GetSurface(bubbleAir_log)->GetSurfaceProperty());
233
234 if (opticalSurface) opticalSurface->DumpInfo();
235
236//
237// Generate & Add Material Properties Table attached to the optical surfaces
238//
239 const G4int num = 2;
240 G4double Ephoton[num] = {2.038*eV, 4.144*eV};
241
242 //OpticalWaterSurface
243 G4double RefractiveIndex[num] = {1.35, 1.40};
244 G4double SpecularLobe[num] = {0.3, 0.3};
245 G4double SpecularSpike[num] = {0.2, 0.2};
246 G4double Backscatter[num] = {0.2, 0.2};
247
248 G4MaterialPropertiesTable* myST1 = new G4MaterialPropertiesTable();
249
250 myST1->AddProperty("RINDEX", Ephoton, RefractiveIndex, num);
251 myST1->AddProperty("SPECULARLOBECONSTANT", Ephoton, SpecularLobe, num);
252 myST1->AddProperty("SPECULARSPIKECONSTANT", Ephoton, SpecularSpike, num);
253 myST1->AddProperty("BACKSCATTERCONSTANT", Ephoton, Backscatter, num);
254
255 OpWaterSurface->SetMaterialPropertiesTable(myST1);
256
257 //OpticalAirSurface
258 G4double Reflectivity[num] = {0.3, 0.5};
259 G4double Efficiency[num] = {0.8, 1.0};
260
261 G4MaterialPropertiesTable *myST2 = new G4MaterialPropertiesTable();
262
263 myST2->AddProperty("REFLECTIVITY", Ephoton, Reflectivity, num);
264 myST2->AddProperty("EFFICIENCY", Ephoton, Efficiency, num);
265
266 OpAirSurface->SetMaterialPropertiesTable(myST2);
267
268//always return the physical World
269 return expHall_phys;
270}
271
272//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Note: See TracBrowser for help on using the repository browser.