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