Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
examples/extended/eventgenerator/HepMC/MCTruth/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 //
30 // $Id: DetectorConstruction.cc 99841 2016-10-07 10:09:34Z gcosmo $
31 //
32 //
33 // --------------------------------------------------------------
34 // GEANT 4 - DetectorConstruction class
35 // --------------------------------------------------------------
36 //
37 // Author: Witold POKORSKI (Witold.Pokorski@cern.ch)
38 //
39 // --------------------------------------------------------------
40 //
41 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
42 
43 #include "DetectorConstruction.hh"
44 #include "G4Material.hh"
45 #include "G4Box.hh"
46 #include "G4LogicalVolume.hh"
47 #include "G4ThreeVector.hh"
48 #include "G4PVPlacement.hh"
49 #include "globals.hh"
50 #include "G4PhysicalConstants.hh"
51 #include "G4SystemOfUnits.hh"
52 
53 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
54 
56  Iron(0), Copper(0), Tungsten(0), Lead(0), Uranium(0), PbWO4(0),
57  Polystyrene(0), LiquidArgon(0),
58  theAbsorberMaterial(0),
59  logicAbsorber(0), physiAbsorber(0) {}
60 
61 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
62 
64 
65 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
66 
68 {
69  //------------------- materials ------------------------
70 
71  G4double a; // atomic mass
72  G4double z; // atomic number
73  G4double density, pressure, temperature, fractionmass;
74  G4String name, symbol;
75  G4int nel, natoms;
76 
77  //--- elements
78 
79  a = 1.01*g/mole;
80  G4Element* elH = new G4Element(name="Hydrogen", symbol="H2", z=1., a);
81 
82  a = 12.01*g/mole;
83  G4Element* elC = new G4Element(name="Carbon", symbol="C", z=6., a);
84 
85  a = 14.01*g/mole;
86  G4Element* elN = new G4Element(name="Nitrogen", symbol="N2", z=7., a);
87 
88  a = 16.00*g/mole;
89  G4Element* elO = new G4Element(name="Oxygen", symbol="O2", z=8., a);
90 
91  a = 183.85*g/mole;
92  G4Element* elW = new G4Element(name="Tungsten", symbol="W", z=74., a);
93 
94  a = 207.19*g/mole;
95  G4Element* elPb = new G4Element(name="Lead", symbol="Pb", z=82., a);
96 
97  //--- simple materials
98 
99  // Iron has a X0 = 1.7585 cm and lambda_I = 16.760 cm.
100  density = 7.87*g/cm3;
101  a = 55.85*g/mole;
102  Iron = new G4Material(name="Iron", z=26., a, density);
103 
104  // Copper has a X0 = 1.4353 cm and lambda_I = 15.056 cm.
105  density = 8.96*g/cm3;
106  a = 63.55*g/mole;
107  Copper = new G4Material(name="Copper", z=29., a, density);
108 
109  // Tungsten has a X0 = 0.35 cm and lambda_I = 9.5855 cm.
110  density = 19.30*g/cm3;
111  a = 183.85*g/mole;
112  Tungsten = new G4Material(name="Tungsten", z=74., a, density);
113 
114  // Lead has a X0 = 0.56120 cm and lambda_I = 17.092 cm.
115  density = 11.35*g/cm3;
116  a = 207.19*g/mole;
117  Lead = new G4Material(name="Lead", z=82., a, density);
118 
119  // Uranium has a X0 = 0.31662 cm and lambda_I = 10.501 cm.
120  density = 18.95*g/cm3;
121  a = 238.03*g/mole;
122  Uranium = new G4Material(name="Uranium", z=92., a, density);
123 
124  // Liquid Argon has a X0 = 10.971 cm and lambda_I = 65.769 cm.
125  density = 1.4*g/cm3;
126  a = 39.95*g/mole;
127  LiquidArgon = new G4Material(name="LiquidArgon", z=18., a, density);
128 
129  //--- mixtures
130 
131  density = 1.290*mg/cm3;
132  G4Material* Air = new G4Material(name="Air", density, nel=2);
133  Air->AddElement(elN, 0.7);
134  Air->AddElement(elO, 0.3);
135 
136  // 4-May-2006 : We rename "Vacuum" as "G4vacuum" to avoid
137  // problems with Flugg.
138  density = 1.e-5*g/cm3;
139  pressure = 2.e-2*bar;
140  temperature = STP_Temperature; // From PhysicalConstants.h .
141  G4Material* G4vacuum = new G4Material(name="G4vacuum", density, nel=1,
142  kStateGas, temperature, pressure);
143  G4vacuum->AddMaterial(Air, fractionmass=1.);
144 
145  // Plastic scintillator tiles (used both in CMS hadron calorimeter
146  // and ATLAS hadron barrel calorimeter):
147  // X0 = 42.4 cm and lambda_I = 79.360 cm.
148  density = 1.032*g/cm3;
149  Polystyrene = new G4Material(name="Polystyrene", density, nel=2);
150  Polystyrene->AddElement(elC, natoms=19);
151  Polystyrene->AddElement(elH, natoms=21);
152 
153  // PbWO4 CMS crystals. It has a X0 = 0.89 cm and lambda_I = 22.4 cm.
154  density = 8.28*g/cm3;
155  PbWO4 = new G4Material(name="PbWO4", density, nel=3);
156  PbWO4->AddElement(elPb, natoms=1);
157  PbWO4->AddElement(elW, natoms=1);
158  PbWO4->AddElement(elO, natoms=4);
159 
160  //------------------- volumes --------------------------
161 
162  // --- experimental hall (world volume)
163  // beam line along z axis
164 
165  //***LOOKHERE***
166  const G4double sizeExpHall = 4.0*m; // For normal calorimeter
167  //const G4double sizeExpHall = 10.0*m; // For Scintillator calorimeter
168 
169  G4double expHall_x = sizeExpHall / 2.0; // half dimension along x
170  G4double expHall_y = sizeExpHall / 2.0; // half dimension along y
171  G4double expHall_z = sizeExpHall / 2.0; // half dimension along z
172 
173  G4Box* experimentalHall_box
174  = new G4Box("expHall_box",expHall_x,expHall_y,expHall_z);
175 
176  experimentalHall_log = new G4LogicalVolume(experimentalHall_box, // solid
177  G4vacuum, // material
178  "expHall_log", // name
179  0, // field manager
180  0, // sensitive detector
181  0); // user limits
182 
183  experimentalHall_phys = new G4PVPlacement(0, // rotation
184  G4ThreeVector(), // translation
185  "expHall", // name
186  experimentalHall_log, // logical volume
187  0, // mother physical volume
188  false, // boolean operation
189  0); // copy number
190 
191  // --- Detector
192 
193  //***LOOKHERE***
194  const G4double sizeCalo = 2.0*m; // For normal calorimeter
195  //const G4double sizeCalo = 8.0*m; // For Scintillator calorimeter
196 
197  G4double xAbsorber = sizeCalo / 2.0; // half dimension along x
198  G4double yAbsorber = sizeCalo / 2.0; // half dimension along y
199  G4double zAbsorber = sizeCalo / 2.0; // half dimension along z
200 
201  G4Box* solidAbsorber = new G4Box("solidAbsorber", xAbsorber, yAbsorber, zAbsorber);
202 
203  logicAbsorber = new G4LogicalVolume(solidAbsorber, // solid
204  theAbsorberMaterial, // material
205  "logicAbsorber", // name
206  0, // field manager
207  0, // sensitive detector
208  0); // user limits
209 
210  physiAbsorber = new G4PVPlacement(0, // rotation
211  G4ThreeVector(), // translation
212  "physiAbsorber", // its name
213  logicAbsorber, // logical volume
214  experimentalHall_phys, // mother physical volume
215  false, // boolean operation
216  100); // copy number
217 
218  // --- Set default values ***LOOKHERE***
220  //theAbsorberMaterial = Copper;
221  //theAbsorberMaterial = Tungsten;
222  //theAbsorberMaterial = Lead;
223  //theAbsorberMaterial = Uranium;
224  //theAbsorberMaterial = PbWO4;
225  //theAbsorberMaterial = Polystyrene;
226  //theAbsorberMaterial = LiquidArgon;
227 
229 
230  PrintParameters();
231 
232  return experimentalHall_phys;
233 }
234 
235 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
236 
238 {
239  G4cout << G4endl << G4endl
240  << " ------ DetectorConstruction::PrintParameters() ------ " << G4endl
241  << " Absorber Material = ";
242  if ( theAbsorberMaterial ) {
244  } else {
245  G4cout << " UNDEFINED ";
246  }
247  G4cout << G4endl << " -------------------------------------------------------- "
248  << G4endl << G4endl;
249 }
250 
251 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
const XML_Char * name
Definition: expat.h:151
CLHEP::Hep3Vector G4ThreeVector
std::vector< ExP01TrackerHit * > a
Definition: ExP01Classes.hh:33
static constexpr double STP_Temperature
#define G4endl
Definition: G4ios.hh:61
Double_t z
const G4String & GetName() const
Definition: G4Material.hh:179
static constexpr double g
Definition: G4SIunits.hh:183
static constexpr double m
Definition: G4SIunits.hh:129
double G4double
Definition: G4Types.hh:76
static constexpr double mg
Definition: G4SIunits.hh:184
Definition: G4Box.hh:64
int G4int
Definition: G4Types.hh:78
void AddElement(G4Element *element, G4int nAtoms)
Definition: G4Material.cc:368
G4GLOB_DLL std::ostream G4cout
void SetMaterial(G4Material *pMaterial)
static constexpr double mole
Definition: G4SIunits.hh:286
void AddMaterial(G4Material *material, G4double fraction)
Definition: G4Material.cc:473
static constexpr double bar
Definition: G4SIunits.hh:236
static constexpr double cm3
Definition: G4SIunits.hh:121