ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DetectorConstruction.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file 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 //
31 //
32 // --------------------------------------------------------------
33 // GEANT 4 - DetectorConstruction class
34 // --------------------------------------------------------------
35 //
36 // Author: Witold POKORSKI (Witold.Pokorski@cern.ch)
37 //
38 // --------------------------------------------------------------
39 //
40 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
41 
42 #include "DetectorConstruction.hh"
43 #include "G4Material.hh"
44 #include "G4NistManager.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 
57  fAbsorberMaterial(0) {}
58 
59 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
60 
62 
63 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
64 
66 {
67  //------------------- materials ------------------------
68 
69  //--- simple materials
70 
71  G4NistManager* nistManager = G4NistManager::Instance();
72 
73  // Iron has a X0 = 1.7585 cm and lambda_I = 16.760 cm.
74  G4Material* iron = nistManager->FindOrBuildMaterial("G4_Fe");
75 
76  // Copper has a X0 = 1.4353 cm and lambda_I = 15.056 cm.
77  G4Material* copper = nistManager->FindOrBuildMaterial("G4_Cu");
78 
79  // Tungsten has a X0 = 0.35 cm and lambda_I = 9.5855 cm.
80  G4Material* tungsten = nistManager->FindOrBuildMaterial("G4_W");
81 
82  // Lead has a X0 = 0.56120 cm and lambda_I = 17.092 cm.
83  G4Material* lead = nistManager->FindOrBuildMaterial("G4_Pb");
84 
85  // Uranium has a X0 = 0.31662 cm and lambda_I = 10.501 cm.
86  G4Material* uranium = nistManager->FindOrBuildMaterial("G4_U");
87 
88  // Liquid Argon has a X0 = 10.971 cm and lambda_I = 65.769 cm.
89  G4double a, z, density;
90  density = 1.4*g/cm3;
91  a = 39.95*g/mole;
92  G4Material* liquidArgon = new G4Material("LiquidArgon", z=18., a, density);
93 
94  //--- mixtures
95 
96  G4Material* air = nistManager->FindOrBuildMaterial("G4_AIR");
97 
98  // 4-May-2006 : We rename "Vacuum" as "G4vacuum" to avoid
99  // problems with Flugg.
100  G4double pressure, temperature, fractionMass;
101  G4int nel;
102  density = 1.e-5*g/cm3;
103  pressure = 2.e-2*bar;
104  temperature = STP_Temperature; // From PhysicalConstants.h .
105  G4Material* vacuum = new G4Material("G4vacuum", density, nel=1,
106  kStateGas, temperature, pressure);
107  vacuum->AddMaterial(air, fractionMass=1.);
108 
109  // Plastic scintillator tiles (used both in CMS hadron calorimeter
110  // and ATLAS hadron barrel calorimeter):
111  // X0 = 42.4 cm and lambda_I = 79.360 cm.
112  G4int natoms;
113  G4Element* elH = nistManager->FindOrBuildElement("H");
114  G4Element* elC = nistManager->FindOrBuildElement("C");
115  density = 1.032*g/cm3;
116  G4Material* polystyrene = new G4Material("Polystyrene", density, nel=2);
117  polystyrene->AddElement(elC, natoms=19);
118  polystyrene->AddElement(elH, natoms=21);
119 
120  // PbWO4 CMS crystals. It has a X0 = 0.89 cm and lambda_I = 22.4 cm.
121  G4Element* elPb = nistManager->FindOrBuildElement("Pb");
122  G4Element* elW = nistManager->FindOrBuildElement("W");
123  G4Element* elO = nistManager->FindOrBuildElement("O");
124  density = 8.28*g/cm3;
125  G4Material* pbWO4 = new G4Material("PbWO4", density, nel=3);
126  pbWO4->AddElement(elPb, natoms=1);
127  pbWO4->AddElement(elW, natoms=1);
128  pbWO4->AddElement(elO, natoms=4);
129 
130  //------------------- volumes --------------------------
131 
132  // --- experimental hall (world volume)
133  // beam line along z axis
134 
135  //***LOOKHERE***
136  const G4double sizeExpHall = 4.0*m; // For normal calorimeter
137  //const G4double sizeExpHall = 10.0*m; // For Scintillator calorimeter
138 
139  G4double expHall_x = sizeExpHall / 2.0; // half dimension along x
140  G4double expHall_y = sizeExpHall / 2.0; // half dimension along y
141  G4double expHall_z = sizeExpHall / 2.0; // half dimension along z
142 
143  G4Box* experimentalHall_box
144  = new G4Box("expHall_box",expHall_x,expHall_y,expHall_z);
145 
146  G4LogicalVolume* experimentalHallLog
147  = new G4LogicalVolume(experimentalHall_box, // solid
148  vacuum, // material
149  "expHall_log", // name
150  0, // field manager
151  0, // sensitive detector
152  0); // user limits
153 
154  G4VPhysicalVolume* experimentalHallPhys
155  = new G4PVPlacement(0, // rotation
156  G4ThreeVector(), // translation
157  "expHall", // name
158  experimentalHallLog, // logical volume
159  0, // mother physical volume
160  false, // boolean operation
161  0); // copy number
162 
163  // --- Detector
164 
165  //***LOOKHERE***
166  const G4double sizeCalo = 2.0*m; // For normal calorimeter
167  //const G4double sizeCalo = 8.0*m; // For Scintillator calorimeter
168 
169  G4double xAbsorber = sizeCalo / 2.0; // half dimension along x
170  G4double yAbsorber = sizeCalo / 2.0; // half dimension along y
171  G4double zAbsorber = sizeCalo / 2.0; // half dimension along z
172 
173  G4Box* solidAbsorber = new G4Box("solidAbsorber", xAbsorber, yAbsorber, zAbsorber);
174 
175  G4LogicalVolume* logicAbsorber
176  = new G4LogicalVolume(solidAbsorber, // solid
177  fAbsorberMaterial, // material
178  "logicAbsorber", // name
179  0, // field manager
180  0, // sensitive detector
181  0); // user limits
182 
183  new G4PVPlacement(0, // rotation
184  G4ThreeVector(), // translation
185  "physiAbsorber", // its name
186  logicAbsorber, // logical volume
187  experimentalHallPhys, // mother physical volume
188  false, // boolean operation
189  100); // copy number
190 
191  // --- Check if all materials were built
192  if ( (! iron) || (! copper) || (! tungsten) || (! lead) || (! uranium) ||
193  (! pbWO4) || (! polystyrene) || (! liquidArgon) ) {
194  G4cerr << "Failure in building materials." << G4endl;
195  }
196 
197  // --- Set default values ***LOOKHERE***
198  fAbsorberMaterial = iron;
199  //fAbsorberMaterial = copper;
200  //fAbsorberMaterial = tungsten;
201  //fAbsorberMaterial = lead;
202  //fAbsorberMaterial = uranium;
203  //fAbsorberMaterial = pbWO4;
204  //fAbsorberMaterial = polystyrene;
205  //fAbsorberMaterial = liquidArgon;
206 
207  logicAbsorber->SetMaterial( fAbsorberMaterial );
208 
209  PrintParameters();
210 
211  return experimentalHallPhys;
212 }
213 
214 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
215 
217 {
218  G4cout << G4endl << G4endl
219  << " ------ DetectorConstruction::PrintParameters() ------ " << G4endl
220  << " Absorber Material = ";
221  if ( fAbsorberMaterial ) {
223  } else {
224  G4cout << " UNDEFINED ";
225  }
226  G4cout << G4endl << " -------------------------------------------------------- "
227  << G4endl << G4endl;
228 }
229 
230 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....