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
G4_PlugDoor.C
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4_PlugDoor.C
1
#ifndef MACRO_G4PLUGDOOR_C
2
#define MACRO_G4PLUGDOOR_C
3
4
#include <
GlobalVariables.C
>
5
6
#include <
g4detectors/PHG4CylinderSubsystem.h
>
7
8
#include <
g4main/PHG4Reco.h
>
9
10
R__LOAD_LIBRARY(libg4detectors.so)
11
12
void
common_color
(
PHG4CylinderSubsystem
*subsys);
13
14
namespace Enable
15
{
16
bool
PLUGDOOR
=
false
;
17
bool
PLUGDOOR_ABSORBER
=
false
;
18
bool
PLUGDOOR_OVERLAPCHECK
=
false
;
19
bool
PLUGDOOR_BLACKHOLE
=
false
;
20
}
// namespace Enable
21
22
namespace
G4PLUGDOOR
23
{
24
// sPHENIX forward flux return(s)
25
// define via four corners in the engineering drawing
26
double
z_1
= 330.81;
27
double
z_2
= 360.81;
28
double
r_1
= 30;
29
double
r_2
= 263.5;
30
31
double
length
=
z_2
-
z_1
;
32
double
place_z
= (
z_1
+
z_2
) / 2.;
33
double
thickness
= 2.;
// 2 cm thick
34
}
// namespace G4PLUGDOOR
35
36
void
PlugDoorInit
()
37
{
38
BlackHoleGeometry::max_radius
= std::max(
BlackHoleGeometry::max_radius
,
G4PLUGDOOR::r_2
);
39
BlackHoleGeometry::max_z
= std::max(
BlackHoleGeometry::max_z
,
G4PLUGDOOR::place_z
+
G4PLUGDOOR::length
/ 2.);
40
BlackHoleGeometry::min_z
=
std::min
(
BlackHoleGeometry::min_z
, -(
G4PLUGDOOR::place_z
+
G4PLUGDOOR::length
/ 2.));
41
if
(
Enable::PLUGDOOR_BLACKHOLE
)
42
{
43
if
(
G4PLUGDOOR::thickness
>=
G4PLUGDOOR::z_2
-
G4PLUGDOOR::z_1
)
44
{
45
cout <<
"G4_PlugDoor::PlugDoorInit(): thickness "
<<
G4PLUGDOOR::thickness
46
<<
" exceeds door thickness "
<<
G4PLUGDOOR::z_2
-
G4PLUGDOOR::z_1
47
<< endl;
48
gSystem->Exit(1);
49
}
50
}
51
}
52
void
PlugDoor
(
PHG4Reco
*g4Reco)
53
{
54
bool
OverlapCheck =
Enable::OVERLAPCHECK
||
Enable::PLUGDOOR_OVERLAPCHECK
;
55
bool
flux_door_active =
Enable::ABSORBER
||
Enable::PLUGDOOR_ABSORBER
;
56
57
const
string
material
(
"Steel_1006"
);
58
59
if
(
Enable::PLUGDOOR_BLACKHOLE
)
60
{
61
double
place_z_plate =
G4PLUGDOOR::z_1
+
G4PLUGDOOR::thickness
/ 2.;
62
double
place_z_cyl = (
G4PLUGDOOR::z_1
+
G4PLUGDOOR::z_2
+
G4PLUGDOOR::thickness
) / 2.;
63
PHG4CylinderSubsystem
*flux_return_plus =
new
PHG4CylinderSubsystem
(
"FLUXRET_ETA_PLUS"
, 0);
64
flux_return_plus->
set_double_param
(
"length"
,
G4PLUGDOOR::thickness
);
65
flux_return_plus->
set_double_param
(
"radius"
,
G4PLUGDOOR::r_1
);
66
flux_return_plus->
set_double_param
(
"place_z"
, place_z_plate);
67
flux_return_plus->
set_double_param
(
"thickness"
,
G4PLUGDOOR::r_2
-
G4PLUGDOOR::r_1
);
68
flux_return_plus->
set_string_param
(
"material"
, material);
69
flux_return_plus->
SetActive
(flux_door_active);
70
flux_return_plus->
SuperDetector
(
"FLUXRET_ETA_PLUS"
);
71
flux_return_plus->
OverlapCheck
(OverlapCheck);
72
common_color
(flux_return_plus);
73
g4Reco->
registerSubsystem
(flux_return_plus);
74
75
flux_return_plus =
new
PHG4CylinderSubsystem
(
"FLUXRET_ETA_PLUS"
, 1);
76
flux_return_plus->
set_double_param
(
"length"
,
G4PLUGDOOR::length
-
G4PLUGDOOR::thickness
);
77
flux_return_plus->
set_double_param
(
"radius"
,
G4PLUGDOOR::r_1
);
78
flux_return_plus->
set_double_param
(
"place_z"
, place_z_cyl);
79
flux_return_plus->
set_double_param
(
"thickness"
,
G4PLUGDOOR::thickness
);
80
flux_return_plus->
set_string_param
(
"material"
, material);
81
flux_return_plus->
SetActive
(flux_door_active);
82
flux_return_plus->
SuperDetector
(
"FLUXRET_ETA_PLUS"
);
83
flux_return_plus->
OverlapCheck
(OverlapCheck);
84
common_color
(flux_return_plus);
85
g4Reco->
registerSubsystem
(flux_return_plus);
86
87
// Black hole behind door with thickness G4PLUGDOOR::thickness
88
// same color as door - you will not distinguish it in the display
89
flux_return_plus =
new
PHG4CylinderSubsystem
(
"FLUXRET_ETA_PLUS"
, 2);
90
flux_return_plus->
set_double_param
(
"length"
,
G4PLUGDOOR::length
-
G4PLUGDOOR::thickness
);
91
flux_return_plus->
set_double_param
(
"radius"
,
G4PLUGDOOR::r_1
+
G4PLUGDOOR::thickness
);
92
flux_return_plus->
set_double_param
(
"place_z"
, place_z_cyl);
93
flux_return_plus->
set_double_param
(
"thickness"
,
G4PLUGDOOR::r_2
-
G4PLUGDOOR::r_1
-
G4PLUGDOOR::thickness
);
94
flux_return_plus->
set_string_param
(
"material"
, material);
95
flux_return_plus->
SetActive
(flux_door_active);
96
flux_return_plus->
SuperDetector
(
"FLUXRET_ETA_PLUS"
);
97
flux_return_plus->
OverlapCheck
(OverlapCheck);
98
flux_return_plus->
BlackHole
();
99
common_color
(flux_return_plus);
100
g4Reco->
registerSubsystem
(flux_return_plus);
101
102
PHG4CylinderSubsystem
*flux_return_minus =
new
PHG4CylinderSubsystem
(
"FLUXRET_ETA_MINUS"
, 0);
103
flux_return_minus->
set_double_param
(
"length"
,
G4PLUGDOOR::thickness
);
104
flux_return_minus->
set_double_param
(
"radius"
,
G4PLUGDOOR::r_1
);
105
flux_return_minus->
set_double_param
(
"place_z"
, -place_z_plate);
106
flux_return_minus->
set_double_param
(
"thickness"
,
G4PLUGDOOR::r_2
-
G4PLUGDOOR::r_1
);
107
flux_return_minus->
set_string_param
(
"material"
, material);
108
flux_return_minus->
SetActive
(flux_door_active);
109
flux_return_minus->
SuperDetector
(
"FLUXRET_ETA_MINUS"
);
110
flux_return_minus->
OverlapCheck
(OverlapCheck);
111
common_color
(flux_return_minus);
112
g4Reco->
registerSubsystem
(flux_return_minus);
113
114
flux_return_minus =
new
PHG4CylinderSubsystem
(
"FLUXRET_ETA_MINUS"
, 1);
115
flux_return_minus->
set_double_param
(
"length"
,
G4PLUGDOOR::length
-
G4PLUGDOOR::thickness
);
116
flux_return_minus->
set_double_param
(
"radius"
,
G4PLUGDOOR::r_1
);
117
flux_return_minus->
set_double_param
(
"place_z"
, -place_z_cyl);
118
flux_return_minus->
set_double_param
(
"thickness"
,
G4PLUGDOOR::thickness
);
119
flux_return_minus->
set_string_param
(
"material"
, material);
120
flux_return_minus->
SetActive
(flux_door_active);
121
flux_return_minus->
SuperDetector
(
"FLUXRET_ETA_MINUS"
);
122
flux_return_minus->
OverlapCheck
(OverlapCheck);
123
common_color
(flux_return_minus);
124
g4Reco->
registerSubsystem
(flux_return_minus);
125
126
// Black hole behind door with thickness G4PLUGDOOR::thickness
127
// same color as door - you will not distinguish it in the display
128
flux_return_minus =
new
PHG4CylinderSubsystem
(
"FLUXRET_ETA_MINUS"
, 2);
129
flux_return_minus->
set_double_param
(
"length"
,
G4PLUGDOOR::length
-
G4PLUGDOOR::thickness
);
130
flux_return_minus->
set_double_param
(
"radius"
,
G4PLUGDOOR::r_1
+
G4PLUGDOOR::thickness
);
131
flux_return_minus->
set_double_param
(
"place_z"
, -place_z_cyl);
132
flux_return_minus->
set_double_param
(
"thickness"
,
G4PLUGDOOR::r_2
-
G4PLUGDOOR::r_1
-
G4PLUGDOOR::thickness
);
133
flux_return_minus->
set_string_param
(
"material"
, material);
134
flux_return_minus->
SetActive
(flux_door_active);
135
flux_return_minus->
SuperDetector
(
"FLUXRET_ETA_MINUS"
);
136
flux_return_minus->
OverlapCheck
(OverlapCheck);
137
flux_return_minus->
BlackHole
();
138
common_color
(flux_return_minus);
139
g4Reco->
registerSubsystem
(flux_return_minus);
140
}
141
else
142
{
143
PHG4CylinderSubsystem
*flux_return_plus =
new
PHG4CylinderSubsystem
(
"FLUXRET_ETA_PLUS"
, 3);
144
flux_return_plus->
set_double_param
(
"length"
,
G4PLUGDOOR::length
);
145
flux_return_plus->
set_double_param
(
"radius"
,
G4PLUGDOOR::r_1
);
146
flux_return_plus->
set_double_param
(
"place_z"
,
G4PLUGDOOR::place_z
);
147
flux_return_plus->
set_double_param
(
"thickness"
,
G4PLUGDOOR::r_2
-
G4PLUGDOOR::r_1
);
148
flux_return_plus->
set_string_param
(
"material"
, material);
149
flux_return_plus->
SetActive
(flux_door_active);
150
flux_return_plus->
SuperDetector
(
"FLUXRET_ETA_PLUS"
);
151
flux_return_plus->
OverlapCheck
(OverlapCheck);
152
common_color
(flux_return_plus);
153
g4Reco->
registerSubsystem
(flux_return_plus);
154
155
PHG4CylinderSubsystem
*flux_return_minus =
new
PHG4CylinderSubsystem
(
"FLUXRET_ETA_MINUS"
, 3);
156
flux_return_minus->
set_double_param
(
"length"
,
G4PLUGDOOR::length
);
157
flux_return_minus->
set_double_param
(
"radius"
,
G4PLUGDOOR::r_1
);
158
flux_return_minus->
set_double_param
(
"place_z"
, -
G4PLUGDOOR::place_z
);
159
flux_return_minus->
set_double_param
(
"thickness"
,
G4PLUGDOOR::r_2
-
G4PLUGDOOR::r_1
);
160
flux_return_minus->
set_string_param
(
"material"
, material);
161
flux_return_minus->
SetActive
(flux_door_active);
162
flux_return_minus->
SuperDetector
(
"FLUXRET_ETA_MINUS"
);
163
flux_return_minus->
OverlapCheck
(OverlapCheck);
164
common_color
(flux_return_minus);
165
g4Reco->
registerSubsystem
(flux_return_minus);
166
}
167
168
return
;
169
}
170
171
void
common_color
(
PHG4CylinderSubsystem
*subsys)
172
{
173
subsys->
set_color
(0.29, 0.44, 0.54);
174
}
175
#endif
macros
blob
master
common
G4_PlugDoor.C
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:18:27
using
1.8.2 with
sPHENIX GitHub integration