EIC Software
Reference for
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
G4_BeamLine_JLeic.C
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4_BeamLine_JLeic.C
1
#ifndef MACRO_G4BEAMLINEJLEIC
2
#define MACRO_G4BEAMLINEJLEIC
3
4
#include <GlobalVariables.C>
5
6
#include <
g4jleic/G4JLeicBeamLineMagnetSubsystem.h
>
7
#include <
g4main/PHG4Reco.h
>
8
9
R__LOAD_LIBRARY
(libg4jleic.so)
10
11
namespace Enable
12
{
13
bool
BEAMLINE
=
false
;
14
bool
BEAMLINE_ABSORBER
=
false
;
15
bool
BEAMLINE_OVERLAPCHECK
=
false
;
16
}
// namespace Enable
17
18
void
BeamLineInit
() {}
19
20
void
BeamLine
(
PHG4Reco
*g4Reco)
21
{
22
bool
OverlapCheck =
Enable::OVERLAPCHECK
||
Enable::BEAMLINE_OVERLAPCHECK
;
23
bool
AbsorberActive =
Enable::ABSORBER
||
Enable::BEAMLINE_ABSORBER
;
24
const
char
*fname[2] = {
"ion_ir_200.txt"
,
"e_ir_10.txt"
};
25
gSystem->Load(
"libg4jleic.so"
);
26
gSystem->Load(
"libg4testbench.so"
);
27
G4JLeicBeamLineMagnetSubsystem
*bl =
nullptr
;
28
int
imagnet = 0;
29
for
(
int
fi = 0; fi < 2; fi++)
30
{
31
std::ifstream infile(fname[fi]);
32
if
(infile.is_open())
33
{
34
double
biggest_z = 0.;
35
std::string line;
36
while
(
std::getline
(infile, line))
37
{
38
if
(line.find(
"QUADRUPOLE"
) != string::npos ||
39
line.find(
"KICKER"
) != string::npos ||
40
(line.find(
"RBEND"
) != string::npos && fi == 0) ||
41
(line.find(
"SOLENOID"
) != string::npos && fi == 0))
42
{
43
std::istringstream iss(line);
44
string
magname;
45
string
magtype;
46
double
length
;
47
double
half_aper;
48
double
inner_radius
;
49
double
outer_radius
;
50
double
dipole_field_x;
51
double
dipole_field_y;
52
double
quad_field_n;
53
double
quad_field_s;
54
double
sext_field;
55
double
solenoid_field;
56
double
x
;
57
double
y
;
58
double
z
;
59
double
theta
;
60
double
phi
;
61
62
if
(!(iss >> magname >> magtype >> length >> half_aper >> inner_radius >> outer_radius >> dipole_field_x >> dipole_field_y >> quad_field_n >> quad_field_s >> sext_field >> solenoid_field >> x >> y >> z >> theta >> phi))
63
{
64
break
;
65
}
// error
66
else
67
{
68
// convert to our units (cm, deg)
69
x *= 100.;
70
y *= 100.;
71
z *= 100. + 40.;
// compensate for jleic 40 cm shift
72
length *= 100.;
73
theta = theta /
M_PI
* 360.;
74
bl =
new
G4JLeicBeamLineMagnetSubsystem
(
"BEAMLINE"
, imagnet);
75
if
(magtype ==
"RBEND"
|| magtype ==
"KICKER"
)
76
{
77
magtype =
"DIPOLE"
;
78
}
79
bl->
set_double_param
(
"field_x"
, dipole_field_x);
80
bl->
set_double_param
(
"field_y"
, dipole_field_y);
81
bl->
set_double_param
(
"fieldgradient"
, quad_field_n);
82
bl->
set_string_param
(
"magtype"
, magtype);
83
bl->
set_double_param
(
"length"
, length);
84
bl->
set_double_param
(
"place_x"
, x);
85
bl->
set_double_param
(
"place_y"
, y);
86
bl->
set_double_param
(
"place_z"
, z);
87
bl->
set_double_param
(
"rot_y"
, theta);
88
bl->
set_double_param
(
"inner_radius"
, inner_radius);
89
bl->
set_double_param
(
"outer_radius"
, outer_radius);
90
bl->
SetActive
();
91
if
(AbsorberActive)
92
{
93
bl->
SetAbsorberActive
();
94
}
95
bl->
OverlapCheck
(OverlapCheck);
96
bl->
SuperDetector
(
"BEAMLINE"
);
97
g4Reco->
registerSubsystem
(bl);
98
BlackHoleGeometry::max_radius
=
std::max
(
BlackHoleGeometry::max_radius
, outer_radius + 150.);
99
if
(z > 0)
100
{
101
BlackHoleGeometry::max_z
=
std::max
(
BlackHoleGeometry::max_z
, z + length);
102
}
103
else
104
{
105
BlackHoleGeometry::min_z
=
std::min
(
BlackHoleGeometry::min_z
, z - length);
106
}
107
imagnet++;
108
}
109
}
110
}
111
infile.close();
112
}
113
}
114
return
;
115
}
116
117
#endif // MACRO_G4BEAMLINEJLEIC
fun4all_eicmacros
blob
master
common
G4_BeamLine_JLeic.C
Built by
Jin Huang
. updated:
Mon Jan 22 2024 12:43:53
using
1.8.2 with
EIC GitHub integration