Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
examples/extended/medical/electronScattering/src/DetectorConstruction.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 //
28 //
29 // $Id: DetectorConstruction.cc 86064 2014-11-07 08:49:32Z gcosmo $
30 //
31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33 
34 #include "DetectorConstruction.hh"
35 #include "DetectorMessenger.hh"
36 
37 #include "G4Material.hh"
38 #include "G4Tubs.hh"
39 #include "G4LogicalVolume.hh"
40 #include "G4PVPlacement.hh"
41 
42 #include "G4GeometryManager.hh"
43 #include "G4PhysicalVolumeStore.hh"
44 #include "G4LogicalVolumeStore.hh"
45 #include "G4SolidStore.hh"
46 
47 #include "G4UnitsTable.hh"
48 #include "G4PhysicalConstants.hh"
49 #include "G4SystemOfUnits.hh"
50 
51 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
52 
54 :fMaterial_World(0), fMaterial_Frame(0),
55  fMaterial_ExitWindow(0), fMaterial_ScatterFoil(0), fMaterial_MonitorChbr(0),
56  fMaterial_Bag(0), fMaterial_Gas(0), fMaterial_Ring(0),
57  fPvol_World(0), fPvol_Frame(0), fDetectorMessenger(0)
58 {
59  // materials
61 
62  // geometry
64 
65  // create commands for interactive definition of the calorimeter
67 }
68 
69 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
70 
72 {
73  delete fDetectorMessenger;
74 }
75 
76 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
77 
79 {
80  return ConstructVolumes();
81 }
82 
83 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
84 
86 {
87 G4double a, z, density;
88 G4int ncomponents, natoms;
89 G4double fractionmass;
90 G4double temperature, pressure;
91 
92 // define Elements
93 //
94 G4Element* H = new G4Element("Hydrogen", "H", z= 1, a= 1.0079*g/mole);
95 G4Element* He = new G4Element("Helium", "He", z= 2, a= 4.0026*g/mole);
96 G4Element* Be = new G4Element("Beryllium","Be", z= 4, a= 9.1218*g/mole);
97 G4Element* C = new G4Element("Carbon", "C", z= 6, a= 12.0107*g/mole);
98 G4Element* N = new G4Element("Nitrogen", "N", z= 7, a= 14.0067*g/mole);
99 G4Element* O = new G4Element("Oxygen", "O", z= 8, a= 15.9994*g/mole);
100 G4Element* Al = new G4Element("Aluminium","Al", z=13, a= 26.9815*g/mole);
101 G4Element* Ar = new G4Element("Argon", "Ar", z=18, a= 39.9480*g/mole);
102 G4Element* Ti = new G4Element("Titanium", "Ti", z=22, a= 47.8670*g/mole);
103 G4Element* Va = new G4Element("Vanadium", "Va", z=23, a= 50.9415*g/mole);
104 G4Element* Cu = new G4Element("Copper", "Cu", z=29, a= 63.5460*g/mole);
105 G4Element* Ta = new G4Element("Tantalum", "Ta", z=73, a= 180.9479*g/mole);
106 G4Element* Au = new G4Element("Gold", "Au", z=79, a= 196.9666*g/mole);
107 
108 // Air
109 //
110 G4Material* Air =
111 new G4Material("Air", density= 1.205*mg/cm3, ncomponents=4,
112  kStateGas, 293.*kelvin, 1.*atmosphere);
113 Air->AddElement(C, fractionmass=0.000124);
114 Air->AddElement(N, fractionmass=0.755267);
115 Air->AddElement(O, fractionmass=0.231782);
116 Air->AddElement(Ar,fractionmass=0.012827);
117 
118 // Titanium
119 //
120 G4Material* Titanium =
121 new G4Material("Titanium", density= 4.42*g/cm3, ncomponents=3);
122 Titanium->AddElement(Ti, fractionmass=0.90);
123 Titanium->AddElement(Al, fractionmass=0.06);
124 Titanium->AddElement(Va, fractionmass=0.04);
125 
126 // Mylar
127 //
128 G4Material* Mylar =
129 new G4Material("Mylar", density= 1.40*g/cm3, ncomponents=3);
130 Mylar->AddElement(H, natoms=4);
131 Mylar->AddElement(C, natoms=5);
132 Mylar->AddElement(O, natoms=2);
133 
134 // Helium
135 //
136 G4Material* Helium =
137 new G4Material("Helium", density= 0.166*mg/cm3, ncomponents=1,
138  kStateGas, 293.*kelvin, 1.*atmosphere);
139 Helium->AddElement(He, fractionmass=1.0);
140 
141 // Aluminium
142 //
143 G4Material* Aluminium =
144 new G4Material("Aluminium", density= 2.7*g/cm3, ncomponents=1);
145 Aluminium->AddElement(Al, fractionmass=1.0);
146 
147 // Beryllium
148 //
149 G4Material* Beryllium =
150 new G4Material("Beryllium", density= 1.85*g/cm3, ncomponents=1);
151 Beryllium->AddElement(Be, fractionmass=1.0);
152 
153 //Graphite
154 //
155 G4Material* Graphite =
156 new G4Material("Graphite", density= 2.18*g/cm3, ncomponents=1);
157 Graphite->AddElement(C, fractionmass=1.0);
158 
159 // Copper
160 //
161 G4Material* Copper =
162 new G4Material("Copper", density= 8.92*g/cm3, ncomponents=1);
163 Copper->AddElement(Cu, fractionmass=1.0);
164 
165 // Tantalum
166 //
167 G4Material* Tantalum =
168 new G4Material("Tantalum", density= 16.65*g/cm3, ncomponents=1);
169 Tantalum->AddElement(Ta, fractionmass=1.0);
170 
171 // Gold
172 //
173 G4Material* Gold =
174 new G4Material("Gold", density= 19.30*g/cm3, ncomponents=1);
175 Gold->AddElement(Au, fractionmass=1.0);
176 
177 // example of vacuum
178 //
179 density = universe_mean_density; //from PhysicalConstants.h
180 pressure = 3.e-18*pascal;
181 temperature = 2.73*kelvin;
182 G4Material* Vacuum =
183 new G4Material("Galactic", z=1, a=1.01*g/mole,density,
184  kStateGas,temperature,pressure);
185 
186 //print
187 //
189 
190 
191 // assign materials
192 //
193 fMaterial_World = Vacuum;
194 fMaterial_Frame = Air;
195 fMaterial_ExitWindow = Titanium;
197 fMaterial_MonitorChbr = Mylar;
198 fMaterial_Bag = Mylar;
199 fMaterial_Gas = Helium;
200 fMaterial_Ring = Aluminium;
201 }
202 
203 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
204 
206 {
207  fZfront_ExitWindow = 0.0*um;
208  fThickness_ExitWindow = 41.2*um;
209 
210  fZfront_ScatterFoil = 2.65*cm;
212 
213  fZfront_MonitorChbr = 50.*mm;
214  fThickness_MonitorChbr = 112.7*um;
215 
216  fZfront_Bag = 64.975*mm;
217  fThickness_Bag = 110.0050*cm;
218 
219  fThickness_Gas = 110.*cm;
220 
221  fThickness_Ring = 14.*mm;
222  fInnerRadius_Ring = 20.*cm;
223 
224  fZfront_Frame = 2.0*um;
225  fThickness_Frame = 118.2*cm;
226 
228  fRadius_World = 23.3*cm;
229 }
230 
231 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
232 
234 {
235  // Cleanup old geometry
236  //
241 
242  // World
243  //
244  G4Tubs*
245  svol_World = new G4Tubs("World", //name
246  0*cm, fRadius_World, //r1, r2
247  0.5*fThickness_World, //half-length
248  0., twopi); //theta1, theta2
249 
251  lvol_World = new G4LogicalVolume(svol_World, //its solid
252  fMaterial_World, //its material
253  "World"); //its name
254 
255  fPvol_World = new G4PVPlacement(0, //no rotation
256  G4ThreeVector(), //no translation
257  lvol_World, //its logical volume
258  "World", //its name
259  0, //its mother volume
260  false, //no boolean operation
261  0); //copy number
262 
263  // Frame
264  //
265  G4Tubs*
266  svol_Frame = new G4Tubs("Frame", //name
267  0*cm, fRadius_World, //r1, r2
268  0.5*fThickness_Frame, //half-length
269  0., twopi); //theta1, theta2
270 
272  lvol_Frame = new G4LogicalVolume(svol_Frame, //its solid
273  fMaterial_Frame, //its material
274  "Frame"); //its name
275 
276  G4double
277  zpos = fZfront_Frame;
278 
279  fPvol_Frame = new G4PVPlacement(0, //no rotation
280  G4ThreeVector(0,0,zpos), //translation
281  lvol_Frame, //its logical volume
282  "Frame", //its name
283  lvol_World, //its mother volume
284  false, //no boolean operation
285  0); //copy number
286 
287 
288  // ExitWindow
289  //
290  G4Tubs*
291  svol_ExitWindow = new G4Tubs("ExitWindow", //name
292  0*cm, fRadius_World, //r1, r2
293  0.5*fThickness_ExitWindow, //half-length
294  0., twopi); //theta1, theta2
295 
297  lvol_ExitWindow = new G4LogicalVolume(svol_ExitWindow, //solid
298  fMaterial_ExitWindow, //material
299  "ExitWindow"); //name
300 
302 
303  new G4PVPlacement(0, //no rotation
304  G4ThreeVector(0,0,zpos), //translation
305  lvol_ExitWindow, //logical volume
306  "ExitWindow", //name
307  lvol_Frame, //mother volume
308  false, //no boolean operation
309  0); //copy number
310 
311  // Monitor Chamber
312  //
313  G4Tubs*
314  svol_MonitorChbr = new G4Tubs("MonitorChbr", //name
315  0*cm, fRadius_World, //r1, r2
316  0.5*fThickness_MonitorChbr, //half-length
317  0., twopi); //theta1, theta2
318 
320  lvol_MonitorChbr = new G4LogicalVolume(svol_MonitorChbr,//solid
321  fMaterial_MonitorChbr, //material
322  "MonitorChbr"); //name
323 
325 
326  new G4PVPlacement(0, //no rotation
327  G4ThreeVector(0,0,zpos), //translation
328  lvol_MonitorChbr, //logical volume
329  "MonitorChbr", //name
330  lvol_Frame, //mother volume
331  false, //no boolean operation
332  0); //copy number
333 
334 
335  // Bag
336  //
337  G4Tubs*
338  svol_Bag = new G4Tubs("Bag", //name
339  0*cm, fRadius_World, //r1, r2
340  0.5*fThickness_Bag, //half-length
341  0., twopi); //theta1, theta2
342 
344  lvol_Bag = new G4LogicalVolume(svol_Bag, //solid
345  fMaterial_Bag, //material
346  "Bag"); //name
347 
348  zpos = fZfront_Bag + 0.5*fThickness_Bag - 0.5*fThickness_Frame;
349 
350  new G4PVPlacement(0, //no rotation
351  G4ThreeVector(0,0,zpos), //translation
352  lvol_Bag, //logical volume
353  "Bag", //name
354  lvol_Frame, //mother volume
355  false, //no boolean operation
356  0); //copy number
357 
358 
359  // Gas
360  //
361  G4Tubs*
362  svol_Gas = new G4Tubs("Gas", //name
363  0*cm, fRadius_World, //r1, r2
364  0.5*fThickness_Gas, //half-length
365  0., twopi); //theta1, theta2
366 
368  lvol_Gas = new G4LogicalVolume(svol_Gas, //solid
369  fMaterial_Gas, //material
370  "Gas"); //name
371 
372 
373  new G4PVPlacement(0, //no rotation
374  G4ThreeVector(), //no translation
375  lvol_Gas, //logical volume
376  "Gas", //name
377  lvol_Bag, //mother volume
378  false, //no boolean operation
379  0); //copy number
380 
381 
382  // Rings
383  //
384  G4Tubs*
385  svol_Ring = new G4Tubs("Ring", //name
387  0.5*fThickness_Ring, //half-length
388  0., twopi); //theta1, theta2
389 
391  lvol_Ring = new G4LogicalVolume(svol_Ring, //solid
392  fMaterial_Ring, //material
393  "Ring"); //name
394 
395  zpos = 0.5*(fThickness_Gas - fThickness_Ring);
396 
397  new G4PVPlacement(0, //no rotation
398  G4ThreeVector(0,0,zpos), //translation
399  lvol_Ring, //logical volume
400  "Ring", //name
401  lvol_Gas, //mother volume
402  false, //no boolean operation
403  1); //copy number
404 
405  new G4PVPlacement(0, //no rotation
406  G4ThreeVector(0,0,-zpos), //translation
407  lvol_Ring, //logical volume
408  "Ring", //name
409  lvol_Gas, //mother volume
410  false, //no boolean operation
411  2); //copy number
412 
413 
414  // ScatterFoil (only if it is not Air)
415  //
417  {
418  G4Tubs*
419  svol_ScatterFoil = new G4Tubs("ScatterFoil", //name
420  0*cm, fRadius_World, //r1, r2
421  0.5*fThickness_ScatterFoil, //half-length
422  0., twopi); //theta1, theta2
423 
425  lvol_ScatterFoil = new G4LogicalVolume(svol_ScatterFoil,//solid
426  fMaterial_ScatterFoil, //material
427  "ScatterFoil"); //name
428 
430 
431  new G4PVPlacement(0, //no rotation
432  G4ThreeVector(0,0,zpos), //translation
433  lvol_ScatterFoil, //logical volume
434  "ScatterFoil", //name
435  lvol_Frame, //mother volume
436  false, //no boolean operation
437  0); //copy number
438  }
439 
440  PrintGeometry();
441 
442  //always return the physical World
443  //
444  return fPvol_World;
445 }
446 
447 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
448 
450 {
451 
452  // choose printing format
453  std::ios::fmtflags mode = G4cout.flags();
454  G4cout.setf(std::ios::fixed,std::ios::floatfield);
455  G4int prec = G4cout.precision(6);
456 
457  G4cout << "\n \t \t" << "Material \t" << "Z_front \t" << "Thickness \n";
458 
459  G4cout << "\n ExitWindow \t" << fMaterial_ExitWindow->GetName()
460  << "\t" << G4BestUnit(fZfront_ExitWindow,"Length")
461  << "\t" << G4BestUnit(fThickness_ExitWindow,"Length");
462 
464  G4cout << "\n ScatterFoil \t" << fMaterial_ScatterFoil->GetName() << "\t"
465  << "\t" << G4BestUnit(fZfront_ScatterFoil,"Length")
466  << "\t" << G4BestUnit(fThickness_ScatterFoil,"Length");
467  }
468 
469  G4cout << "\n MonitorChbr \t" << fMaterial_MonitorChbr->GetName() << "\t"
470  << "\t" << G4BestUnit(fZfront_MonitorChbr,"Length")
471  << "\t" << G4BestUnit(fThickness_MonitorChbr,"Length");
472 
473  G4double thickBagWindow = 0.5*(fThickness_Bag - fThickness_Gas);
474  G4double zfrontGas = fZfront_Bag + thickBagWindow;
475  G4double zfrontBagWindow2 = zfrontGas + fThickness_Gas;
476 
477  G4cout << "\n BagWindow1 \t" << fMaterial_Bag->GetName() << "\t"
478  << "\t" << G4BestUnit(fZfront_Bag,"Length")
479  << "\t" << G4BestUnit(thickBagWindow,"Length");
480 
481  G4cout << "\n Gas \t" << fMaterial_Gas->GetName() << "\t"
482  << "\t" << G4BestUnit(zfrontGas,"Length")
483  << "\t" << G4BestUnit(fThickness_Gas,"Length");
484 
485  G4cout << "\n BagWindow2 \t" << fMaterial_Bag->GetName() << "\t"
486  << "\t" << G4BestUnit(zfrontBagWindow2,"Length")
487  << "\t" << G4BestUnit(thickBagWindow,"Length");
488 
489  G4cout << "\n ScoringPlane \t" << fMaterial_Frame->GetName() << "\t"
490  << "\t" << G4BestUnit(fThickness_Frame,"Length") << "\n" << G4endl;
491 
492  // restaure default formats
493  G4cout.setf(mode,std::ios::floatfield);
494  G4cout.precision(prec);
495 }
496 
497 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
498 
500 {
501  // search the material by its name
502  G4Material* pMaterial = G4Material::GetMaterial(material);
503 
504  if (pMaterial) fMaterial_ScatterFoil = pMaterial;
505 }
506 
507 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
508 
510 {
512 }
513 
514 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
515 
516 #include "G4RunManager.hh"
517 
519 {
521 }
522 
523 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
524 
static constexpr double kelvin
Definition: G4SIunits.hh:281
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:80
static const double prec
Definition: RanecuEngine.cc:58
static constexpr double atmosphere
Definition: G4SIunits.hh:237
static void Clean()
Definition: G4SolidStore.cc:73
CLHEP::Hep3Vector G4ThreeVector
std::vector< ExP01TrackerHit * > a
Definition: ExP01Classes.hh:33
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:593
static constexpr double mm
Definition: G4SIunits.hh:115
Definition: G4Tubs.hh:85
#define G4endl
Definition: G4ios.hh:61
Double_t z
virtual void DefineWorldVolume(G4VPhysicalVolume *worldVol, G4bool topologyIsChanged=true)
static constexpr double universe_mean_density
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
Definition: G4Material.cc:608
static constexpr double um
Definition: G4SIunits.hh:113
const G4String & GetName() const
Definition: G4Material.hh:179
static constexpr double g
Definition: G4SIunits.hh:183
double G4double
Definition: G4Types.hh:76
**D E S C R I P T I O N
static constexpr double mg
Definition: G4SIunits.hh:184
static G4GeometryManager * GetInstance()
static constexpr double twopi
Definition: G4SIunits.hh:76
void OpenGeometry(G4VPhysicalVolume *vol=0)
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
static G4SolidStore * GetInstance()
static G4PhysicalVolumeStore * GetInstance()
int G4int
Definition: G4Types.hh:78
double C(double temp)
void AddElement(G4Element *element, G4int nAtoms)
Definition: G4Material.cc:368
static constexpr double cm
Definition: G4SIunits.hh:119
G4GLOB_DLL std::ostream G4cout
static constexpr double mole
Definition: G4SIunits.hh:286
#define pascal
static constexpr double cm3
Definition: G4SIunits.hh:121
static G4LogicalVolumeStore * GetInstance()