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
G03DetectorConstruction.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G03DetectorConstruction.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
// Class G03DetectorConstruction implementation
32
//
33
// ----------------------------------------------------------------------------
34
35
#include "
G03DetectorConstruction.hh
"
36
37
// Geant4 includes
38
//
39
#include "
globals.hh
"
40
#include "
G4Material.hh
"
41
#include "
G4VPhysicalVolume.hh
"
42
43
// Messenger
44
//
45
#include "
G03DetectorMessenger.hh
"
46
47
// Color extension include for reading
48
//
49
#include "
G03ColorReader.hh
"
50
51
// Color extension include for writing
52
//
53
#include "
G03ColorWriter.hh
"
54
55
#include "
G4SystemOfUnits.hh
"
56
57
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
58
59
G03DetectorConstruction::G03DetectorConstruction
()
60
:
G4VUserDetectorConstruction
(),
61
fAir(0), fAluminum(0), fPb(0), fXenon(0),
62
fReader(0), fWriter(0), fParser(0),
63
fDetectorMessenger(0)
64
{
65
fReadFile
=
"color_extension.gdml"
;
66
fWriteFile
=
"color_extension_test.gdml"
;
67
fWritingChoice
= 1;
68
69
fDetectorMessenger
=
new
G03DetectorMessenger
(
this
);
70
71
fReader
=
new
G03ColorReader
;
72
fWriter
=
new
G03ColorWriter
;
73
fParser
=
new
G4GDMLParser
(
fReader
,
fWriter
);
74
}
75
76
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
77
78
G03DetectorConstruction::~G03DetectorConstruction
()
79
{
80
delete
fDetectorMessenger
;
81
delete
fReader
;
82
delete
fWriter
;
83
delete
fParser
;
84
}
85
86
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
87
88
G4VPhysicalVolume
*
G03DetectorConstruction::Construct
()
89
{
90
// Reading of Geometry from GDML
91
92
G4VPhysicalVolume
* fWorldPhysVol;
93
94
fParser
->
Read
(
fReadFile
,
false
);
95
//
96
// 2nd Boolean argument "Validate" set to false.
97
// Disabling Schema validation for reading extended GDML file.
98
99
// Prints the material information
100
//
101
G4cout
<< *(
G4Material::GetMaterialTable
() ) <<
G4endl
;
102
103
// Giving World Physical Volume from GDML Parser
104
//
105
fWorldPhysVol =
fParser
->
GetWorldVolume
();
106
107
if
(
fWritingChoice
!=0)
108
{
109
fParser
->
Write
(
fWriteFile
, fWorldPhysVol,
true
,
110
"./SimpleExtensionSchema/SimpleExtension.xsd"
);
111
}
112
113
return
fWorldPhysVol;
114
}
115
116
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
117
118
void
G03DetectorConstruction::ListOfMaterials
()
119
{
120
G4double
a
;
// atomic mass
121
G4double
z
;
// atomic number
122
G4double
density,temperature,pressure;
123
G4double
fractionmass;
124
G4String
name
, symbol;
125
G4int
ncomponents;
126
127
// Elements needed for the materials
128
129
a = 14.01*
g
/
mole
;
130
G4Element
* elN =
new
G4Element
(name=
"Nitrogen"
, symbol=
"N"
, z=7., a);
131
132
a = 16.00*
g
/
mole
;
133
G4Element
* elO =
new
G4Element
(name=
"Oxygen"
, symbol=
"O"
, z=8., a);
134
135
a = 26.98*
g
/
mole
;
136
G4Element
* elAl =
new
G4Element
(name=
"Aluminum"
, symbol=
"Al"
, z=13., a);
137
138
// Print the Element information
139
//
140
G4cout
<< *(
G4Element::GetElementTable
()) <<
G4endl
;
141
142
// Air
143
//
144
density = 1.29*
mg
/
cm3
;
145
fAir
=
new
G4Material
(name=
"Air"
, density, ncomponents=2);
146
fAir
->
AddElement
(elN, fractionmass=0.7);
147
fAir
->
AddElement
(elO, fractionmass=0.3);
148
149
// Aluminum
150
//
151
density = 2.70*
g
/
cm3
;
152
fAluminum
=
new
G4Material
(name=
"Aluminum"
, density, ncomponents=1);
153
fAluminum
->
AddElement
(elAl, fractionmass=1.0);
154
155
// Lead
156
//
157
fPb
=
new
G4Material
(
"Lead"
, z=82., a= 207.19*
g
/
mole
, density= 11.35*
g
/
cm3
);
158
159
// Xenon gas
160
//
161
fXenon
=
new
G4Material
(
"XenonGas"
, z=54., a=131.29*
g
/
mole
,
162
density= 5.458*
mg
/
cm3
,
kStateGas
,
163
temperature= 293.15*
kelvin
, pressure= 1*
atmosphere
);
164
165
// Prints the material information
166
//
167
G4cout
<< *(
G4Material::GetMaterialTable
() ) <<
G4endl
;
168
}
169
170
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
171
172
void
G03DetectorConstruction::SetReadFile
(
const
G4String
&
fname
)
173
{
174
fReadFile
=
fname
;
175
fWritingChoice
=0;
176
}
177
178
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
179
180
void
G03DetectorConstruction::SetWriteFile
(
const
G4String
&
fname
)
181
{
182
fWriteFile
=
fname
;
183
fWritingChoice
=1;
184
}
geant4
tree
geant4-10.6-release
examples
extended
persistency
gdml
G03
src
G03DetectorConstruction.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:10
using
1.8.2 with
ECCE GitHub integration