source: trunk/examples/extended/eventgenerator/HepMC/MCTruth/src/DetectorConstruction.cc@ 1036

Last change on this file since 1036 was 807, checked in by garnier, 17 years ago

update

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