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 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33 
34 #include "DetectorConstruction.hh"
35 #include "DetectorMessenger.hh"
36 
37 #include "G4NistManager.hh"
38 #include "G4Material.hh"
39 #include "G4Element.hh"
41 #include "G4LogicalSkinSurface.hh"
42 #include "G4OpticalSurface.hh"
43 #include "G4Box.hh"
44 #include "G4LogicalVolume.hh"
45 #include "G4ThreeVector.hh"
46 #include "G4PVPlacement.hh"
47 #include "G4SystemOfUnits.hh"
48 
49 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
50 
53  fDetectorMessenger(nullptr)
54 {
55  fExpHall_x = fExpHall_y = fExpHall_z = 10.0*m;
56  fTank_x = fTank_y = fTank_z = 1.0*m;
57 
58  fTank = nullptr;
59 
63 
64  fSurface = new G4OpticalSurface("Surface");
69 
70  fTank_LV = nullptr;
71  fWorld_LV = nullptr;
72 
75 
77 }
78 
79 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
80 
82 {
83  delete fDetectorMessenger;
84 }
85 
86 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
87 
89 {
92 
94 
95  // ------------- Volumes --------------
96  // The experimental Hall
97  G4Box* world_box = new G4Box("World", fExpHall_x, fExpHall_y, fExpHall_z);
98 
99  fWorld_LV
100  = new G4LogicalVolume(world_box, fWorldMaterial, "World", 0, 0, 0);
101 
102  G4VPhysicalVolume* world_PV
103  = new G4PVPlacement(0, G4ThreeVector(), fWorld_LV, "World", 0, false, 0);
104 
105  // The tank
106  G4Box* tank_box = new G4Box("Tank", fTank_x, fTank_y, fTank_z);
107 
108  fTank_LV
109  = new G4LogicalVolume(tank_box, fTankMaterial, "Tank", 0, 0, 0);
110 
111  fTank
112  = new G4PVPlacement(0, G4ThreeVector(), fTank_LV, "Tank",
113  fWorld_LV, false, 0);
114 
115  // ------------- Surface --------------
116 
118  new G4LogicalBorderSurface("Surface",
119  fTank, world_PV, fSurface);
120 
121  G4OpticalSurface* opticalSurface = dynamic_cast <G4OpticalSurface*>
122  (surface->GetSurface(fTank,world_PV)->GetSurfaceProperty());
123  G4cout << "****** opticalSurface->DumpInfo:" << G4endl;
124  if (opticalSurface) { opticalSurface->DumpInfo(); }
125  G4cout << "****** end of opticalSurface->DumpInfo" << G4endl;
126 
127  return world_PV;
128 }
129 
130 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
134 
135  G4cout << "Surface sigma alpha set to: " << fSurface->GetSigmaAlpha()
136  << G4endl;
137 }
138 
139 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
141  fSurface->SetPolish(v);
143 
144  G4cout << "Surface polish set to: " << fSurface->GetPolish()
145  << G4endl;
146 }
147 
148 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
151  fTankMPT->AddProperty(c, mpv);
152  G4cout << "The MPT for the box is now: " << G4endl;
153  fTankMPT->DumpTable();
154  G4cout << "............." << G4endl;
155 }
156 
157 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
160  fWorldMPT->AddProperty(c, mpv);
161  G4cout << "The MPT for the world is now: " << G4endl;
162  fWorldMPT->DumpTable();
163  G4cout << "............." << G4endl;
164 }
165 
166 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
169  fSurfaceMPT->AddProperty(c, mpv);
170  G4cout << "The MPT for the surface is now: " << G4endl;
172  G4cout << "............." << G4endl;
173 }
174 
175 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
177  fTankMPT->AddConstProperty(c, v);
178  G4cout << "The MPT for the box is now: " << G4endl;
179  fTankMPT->DumpTable();
180  G4cout << "............." << G4endl;
181 }
182 
183 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
186  G4cout << "The MPT for the world is now: " << G4endl;
187  fWorldMPT->DumpTable();
188  G4cout << "............." << G4endl;
189 }
190 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
193  G4cout << "The MPT for the surface is now: " << G4endl;
195  G4cout << "............." << G4endl;
196 }
197 
198 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
201  if (pmat && fWorldMaterial != pmat) {
202  fWorldMaterial = pmat;
203  if (fWorld_LV) {
206  }
208  G4cout << "World material set to " << fWorldMaterial->GetName()
209  << G4endl;
210  }
211 }
212 
213 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
216  if (pmat && fTankMaterial != pmat) {
217  fTankMaterial = pmat;
218  if (fTank_LV) {
222  }
224  G4cout << "Tank material set to " << fTankMaterial->GetName()
225  << G4endl;
226  }
227 }