ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
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
"
40
#include "
G4LogicalBorderSurface.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
51
DetectorConstruction::DetectorConstruction
()
52
:
G4VUserDetectorConstruction
(),
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
60
fTankMPT
=
new
G4MaterialPropertiesTable
();
61
fWorldMPT
=
new
G4MaterialPropertiesTable
();
62
fSurfaceMPT
=
new
G4MaterialPropertiesTable
();
63
64
fSurface
=
new
G4OpticalSurface
(
"Surface"
);
65
fSurface
->
SetType
(
dielectric_dielectric
);
66
fSurface
->
SetFinish
(
ground
);
67
fSurface
->
SetModel
(
unified
);
68
fSurface
->
SetMaterialPropertiesTable
(
fSurfaceMPT
);
69
70
fTank_LV
=
nullptr
;
71
fWorld_LV
=
nullptr
;
72
73
fTankMaterial
=
G4NistManager::Instance
()->
FindOrBuildMaterial
(
"G4_WATER"
);
74
fWorldMaterial
=
G4NistManager::Instance
()->
FindOrBuildMaterial
(
"G4_AIR"
);
75
76
fDetectorMessenger
=
new
DetectorMessenger
(
this
);
77
}
78
79
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
80
81
DetectorConstruction::~DetectorConstruction
()
82
{
83
delete
fDetectorMessenger
;
84
}
85
86
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
87
88
G4VPhysicalVolume
*
DetectorConstruction::Construct
()
89
{
90
fTankMaterial
->
SetMaterialPropertiesTable
(
fTankMPT
);
91
fTankMaterial
->
GetIonisation
()->
SetBirksConstant
(0.126*
mm
/
MeV
);
92
93
fWorldMaterial
->
SetMaterialPropertiesTable
(
fWorldMPT
);
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
117
G4LogicalBorderSurface
*
surface
=
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......
131
void
DetectorConstruction::SetSurfaceSigmaAlpha
(
G4double
v
) {
132
fSurface
->
SetSigmaAlpha
(v);
133
G4RunManager::GetRunManager
()->
GeometryHasBeenModified
();
134
135
G4cout
<<
"Surface sigma alpha set to: "
<<
fSurface
->
GetSigmaAlpha
()
136
<<
G4endl
;
137
}
138
139
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
140
void
DetectorConstruction::SetSurfacePolish
(
G4double
v
) {
141
fSurface
->
SetPolish
(v);
142
G4RunManager::GetRunManager
()->
GeometryHasBeenModified
();
143
144
G4cout
<<
"Surface polish set to: "
<<
fSurface
->
GetPolish
()
145
<<
G4endl
;
146
}
147
148
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
149
void
DetectorConstruction::AddTankMPV
(
const
char
*
c
,
150
G4MaterialPropertyVector
* mpv) {
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......
158
void
DetectorConstruction::AddWorldMPV
(
const
char
*
c
,
159
G4MaterialPropertyVector
* mpv) {
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......
167
void
DetectorConstruction::AddSurfaceMPV
(
const
char
*
c
,
168
G4MaterialPropertyVector
* mpv) {
169
fSurfaceMPT
->
AddProperty
(c, mpv);
170
G4cout
<<
"The MPT for the surface is now: "
<<
G4endl
;
171
fSurfaceMPT
->
DumpTable
();
172
G4cout
<<
"............."
<<
G4endl
;
173
}
174
175
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
176
void
DetectorConstruction::AddTankMPC
(
const
char
*
c
,
G4double
v
) {
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......
184
void
DetectorConstruction::AddWorldMPC
(
const
char
*
c
,
G4double
v
) {
185
fWorldMPT
->
AddConstProperty
(c, v);
186
G4cout
<<
"The MPT for the world is now: "
<<
G4endl
;
187
fWorldMPT
->
DumpTable
();
188
G4cout
<<
"............."
<<
G4endl
;
189
}
190
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
191
void
DetectorConstruction::AddSurfaceMPC
(
const
char
*
c
,
G4double
v
) {
192
fSurfaceMPT
->
AddConstProperty
(c, v);
193
G4cout
<<
"The MPT for the surface is now: "
<<
G4endl
;
194
fSurfaceMPT
->
DumpTable
();
195
G4cout
<<
"............."
<<
G4endl
;
196
}
197
198
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
199
void
DetectorConstruction::SetWorldMaterial
(
const
G4String
&
mat
) {
200
G4Material
* pmat =
G4NistManager::Instance
()->
FindOrBuildMaterial
(mat);
201
if
(pmat &&
fWorldMaterial
!= pmat) {
202
fWorldMaterial
= pmat;
203
if
(
fWorld_LV
) {
204
fWorld_LV
->
SetMaterial
(
fWorldMaterial
);
205
fWorldMaterial
->
SetMaterialPropertiesTable
(
fWorldMPT
);
206
}
207
G4RunManager::GetRunManager
()->
PhysicsHasBeenModified
();
208
G4cout
<<
"World material set to "
<<
fWorldMaterial
->
GetName
()
209
<<
G4endl
;
210
}
211
}
212
213
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
214
void
DetectorConstruction::SetTankMaterial
(
const
G4String
& mat) {
215
G4Material
* pmat =
G4NistManager::Instance
()->
FindOrBuildMaterial
(mat);
216
if
(pmat &&
fTankMaterial
!= pmat) {
217
fTankMaterial
= pmat;
218
if
(
fTank_LV
) {
219
fTank_LV
->
SetMaterial
(
fTankMaterial
);
220
fTankMaterial
->
SetMaterialPropertiesTable
(
fTankMPT
);
221
fTankMaterial
->
GetIonisation
()->
SetBirksConstant
(0.126*
mm
/
MeV
);
222
}
223
G4RunManager::GetRunManager
()->
PhysicsHasBeenModified
();
224
G4cout
<<
"Tank material set to "
<<
fTankMaterial
->
GetName
()
225
<<
G4endl
;
226
}
227
}
geant4
tree
geant4-10.6-release
examples
extended
optical
OpNovice2
src
DetectorConstruction.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:49
using
1.8.2 with
ECCE GitHub integration