Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
PHG4CylinderGeom_Spacalv1.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file PHG4CylinderGeom_Spacalv1.cc
1
// $$Id: PHG4CylinderGeom_Spacalv1.cc,v 1.3 2014/08/12 03:49:11 jinhuang Exp $$
2
11
#include "
PHG4CylinderGeom_Spacalv1.h
"
12
13
#include <phparameter/PHParameters.h>
14
15
#include <Geant4/G4PhysicalConstants.hh>
16
17
#include <CLHEP/Units/SystemOfUnits.h>
// for twopi
18
19
#include <cmath>
20
#include <sstream>
21
#include <utility>
// for pair
22
23
PHG4CylinderGeom_Spacalv1::PHG4CylinderGeom_Spacalv1
()
24
{
25
SetDefault
();
26
}
27
28
void
PHG4CylinderGeom_Spacalv1::identify
(std::ostream&
os
)
const
29
{
30
os <<
"PHG4CylinderGeom_Spacalv1: layer: "
<<
layer
//
31
<<
", radius: "
<<
radius
//
32
<<
", thickness: "
<<
thickness
//
33
<<
", zmin: "
<<
zmin
//
34
<<
", zmax: "
<<
zmax
<<
//
35
", num scint: "
<<
nscint
36
37
<< std::endl;
38
return
;
39
}
40
41
void
PHG4CylinderGeom_Spacalv1::Print
(Option_t*)
const
42
{
43
identify
(std::cout);
44
45
std::cout <<
"Configuration is #"
<<
get_config
() <<
":"
<< std::endl;
46
switch
(
get_config
())
47
{
48
case
kNonProjective
:
49
std::cout <<
"fiber always placed radially"
<< std::endl;
50
break
;
51
case
kFullProjective_2DTaper
:
52
std::cout <<
"Fully projective spacal with 2D tapered modules"
<< std::endl;
53
break
;
54
case
kFullProjective_2DTaper_SameLengthFiberPerTower
:
55
std::cout
56
<<
"Fully projective spacal with 2D tapered modules. To speed up construction, same-length fiber is used cross one tower"
57
<< std::endl;
58
break
;
59
case
kFullProjective_2DTaper_Tilted
:
60
std::cout <<
"Fully projective spacal with 2D tapered modules and allow azimuthal tilts"
<< std::endl;
61
break
;
62
case
kFullProjective_2DTaper_Tilted_SameLengthFiberPerTower
:
63
std::cout
64
<<
"Fully projective spacal with 2D tapered modules and allow azimuthal tilts. To speed up construction, same-length fiber is used cross one tower"
65
<< std::endl;
66
break
;
67
default
:
68
std::cout <<
"PHG4CylinderGeom_Spacalv1::Print - ERROR - unknown configuration #"
69
<<
get_config
() << std::endl;
70
break
;
71
}
72
73
std::cout <<
"\t"
74
<<
"get_max_radius() = "
<<
get_max_radius
() << std::endl;
75
std::cout <<
"\t"
76
<<
"get_half_radius() = "
<<
get_half_radius
() << std::endl;
77
std::cout <<
"\t"
78
<<
"get_length() = "
<<
get_length
() << std::endl;
79
std::cout <<
"\t"
80
<<
"get_*pos() = "
<<
get_xpos
() <<
", "
<<
get_ypos
() <<
", "
81
<<
get_zpos
() << std::endl;
82
83
std::cout <<
"\t"
84
<<
"get_azimuthal_n_sec() = "
<<
get_azimuthal_n_sec
() <<
", "
85
<<
sector_map
.size() <<
"/"
<<
get_azimuthal_n_sec
()
86
<<
" azimuthal sectors would be filled with SPACAL."
<< std::endl;
87
std::cout <<
"\t"
88
<<
"get_azimuthal_distance() = "
<<
get_azimuthal_distance
()
89
<< std::endl;
90
std::cout <<
"\t"
91
<<
"get_z_distance() = "
<<
get_z_distance
() << std::endl;
92
std::cout <<
"\t"
93
<<
"get_fiber_outer_r() = "
<<
get_fiber_outer_r
() << std::endl;
94
std::cout <<
"\t"
95
<<
"get_fiber_clading_thickness() = "
96
<<
get_fiber_clading_thickness
() << std::endl;
97
std::cout <<
"\t"
98
<<
"get_fiber_core_diameter() = "
<<
get_fiber_core_diameter
()
99
<< std::endl;
100
std::cout <<
"\t"
101
<<
"get_fiber_distance() = "
<<
get_fiber_distance
() << std::endl;
102
103
std::cout <<
"\t"
104
<<
"get_absorber_mat() = "
<<
get_absorber_mat
() << std::endl;
105
std::cout <<
"\t"
106
<<
"get_fiber_clading_mat() = "
<<
get_fiber_clading_mat
()
107
<< std::endl;
108
std::cout <<
"\t"
109
<<
"get_fiber_core_mat() = "
<<
get_fiber_core_mat
() << std::endl;
110
// std::cout << "\t" << "get_calo_step_size() = " << get_calo_step_size() << std::endl;
111
// std::cout << "\t" << "get_fiber_clading_step_size() = "
112
// << get_fiber_clading_step_size() << std::endl;
113
std::cout <<
"\t"
114
<<
"get_fiber_core_step_size() = "
<<
get_fiber_core_step_size
()
115
<< std::endl;
116
117
std::cout <<
"\t"
118
<<
"is_virualize_fiber() = "
<<
is_virualize_fiber
() << std::endl;
119
std::cout <<
"\t"
120
<<
"get_construction_verbose() = "
<<
get_construction_verbose
()
121
<< std::endl;
122
123
if
(
get_construction_verbose
() >= 2)
124
{
125
std::cout <<
"\t"
126
<<
"Containing "
<<
sector_map
.size()
127
<<
" sector with rotation specified:"
<< std::endl;
128
for
(
auto
it
:
sector_map
)
129
{
130
std::cout <<
"\t"
131
<<
"\t"
132
<<
"sector_map["
<<
it
.first <<
"] = "
<<
it
.second
133
<< std::endl;
134
}
135
}
136
}
137
138
void
PHG4CylinderGeom_Spacalv1::SetDefault
()
139
{
140
config
=
kNonProjective
;
141
142
layer
= 0;
143
radius
= 95;
144
thickness
= 16.6;
145
zmin
= -143;
146
zmax
= -
zmin
;
147
nscint
= 0;
148
149
absorber_mat
=
"Spacal_W_Epoxy"
;
150
fiber_clading_mat
=
"PMMA"
;
151
fiber_core_mat
=
"G4_POLYSTYRENE"
;
152
153
xpos
= 0;
154
ypos
= 0;
155
zpos
= 0;
156
157
fiber_clading_thickness
= 0.003 / 2;
158
fiber_core_diameter
= 0.047 -
fiber_clading_thickness
* 2;
159
fiber_distance
= 0.1;
160
161
virualize_fiber
=
false
;
162
construction_verbose
= 0;
163
164
// init_default_sector_map();
165
}
166
167
void
PHG4CylinderGeom_Spacalv1::ImportParameters
(
const
PHParameters
& param)
168
{
169
PHG4CylinderGeomv2::ImportParameters
(param);
170
171
if
(param.
exist_string_param
(
"absorber_mat"
))
172
absorber_mat
= param.
get_string_param
(
"absorber_mat"
);
173
if
(param.
exist_string_param
(
"fiber_core_mat"
))
174
fiber_core_mat
= param.
get_string_param
(
"fiber_core_mat"
);
175
if
(param.
exist_string_param
(
"fiber_clading_mat"
))
176
fiber_clading_mat
= param.
get_string_param
(
"fiber_clading_mat"
);
177
if
(param.
exist_double_param
(
"xpos"
))
178
xpos
= param.
get_double_param
(
"xpos"
);
179
if
(param.
exist_double_param
(
"ypos"
))
180
ypos
= param.
get_double_param
(
"ypos"
);
181
if
(param.
exist_double_param
(
"zpos"
))
182
zpos
= param.
get_double_param
(
"zpos"
);
183
if
(param.
exist_double_param
(
"fiber_core_diameter"
))
184
fiber_core_diameter
= param.
get_double_param
(
"fiber_core_diameter"
);
185
if
(param.
exist_double_param
(
"fiber_clading_thickness"
))
186
fiber_clading_thickness
= param.
get_double_param
(
"fiber_clading_thickness"
);
187
if
(param.
exist_double_param
(
"fiber_distance"
))
188
fiber_distance
= param.
get_double_param
(
"fiber_distance"
);
189
if
(param.
exist_int_param
(
"config"
))
190
config
= static_cast<config_t>(param.
get_int_param
(
"config"
));
191
if
(param.
exist_int_param
(
"virualize_fiber"
))
192
virualize_fiber
= static_cast<bool>(param.
get_int_param
(
"virualize_fiber"
));
193
if
(param.
exist_int_param
(
"construction_verbose"
))
194
construction_verbose
= param.
get_int_param
(
"construction_verbose"
);
195
196
//init_default_sector_map if instructed to do so
197
if
(param.
exist_int_param
(
"init_default_sector_map"
))
198
{
199
if
(param.
get_int_param
(
"init_default_sector_map"
))
200
{
201
init_default_sector_map
();
202
}
203
}
204
205
// load sector_map if specified. Over write init_default_sector_map if both presents
206
if
(param.
exist_int_param
(
"sector_map_size"
))
207
{
208
sector_map
.clear();
209
210
const
int
n
= param.
get_int_param
(
"sector_map_size"
);
211
212
for
(
int
i
= 0;
i
<
n
;
i
++)
213
{
214
std::stringstream
prefix
;
215
prefix <<
"sector_map"
;
216
prefix <<
"["
<<
i
<<
"]"
217
<<
"."
;
218
219
const
int
id
= param.
get_int_param
(prefix.str() +
"id"
);
220
const
double
rotation = param.
get_double_param
(
221
prefix.str() +
"rotation"
);
222
223
sector_map
[
id
] = rotation;
224
}
225
}
226
227
return
;
228
}
229
230
int
PHG4CylinderGeom_Spacalv1::get_azimuthal_n_sec
()
const
231
{
232
return
std::floor(
233
get_half_radius
() *
twopi
/ (
get_fiber_distance
() * sqrt(3.)));
234
}
235
236
double
237
PHG4CylinderGeom_Spacalv1::get_azimuthal_distance
()
const
238
{
239
return
get_half_radius
() *
twopi
/ (
double
) (
get_azimuthal_n_sec
());
240
}
241
242
double
243
PHG4CylinderGeom_Spacalv1::get_z_distance
()
const
244
{
245
return
get_fiber_distance
() / 2.;
246
}
247
249
void
PHG4CylinderGeom_Spacalv1::init_default_sector_map
()
250
{
251
sector_map
.clear();
252
253
for
(
int
sec = 0; sec <
get_azimuthal_n_sec
(); ++sec)
254
{
255
const
double
rot =
twopi
/ (
double
) (
get_azimuthal_n_sec
()) * ((
double
) (sec));
256
257
sector_map
[sec] = rot;
258
}
259
}
coresoftware
blob
master
simulation
g4simulation
g4detectors
PHG4CylinderGeom_Spacalv1.cc
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:18:12
using
1.8.2 with
sPHENIX GitHub integration