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_Magnet_Cleo.C
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4_Magnet_Cleo.C
1
#ifndef MACRO_G4MAGNETJLEIC_C
2
#define MACRO_G4MAGNETJLEIC_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
namespace Enable
13
{
14
bool
MAGNET
=
false
;
15
bool
MAGNET_ABSORBER
=
false
;
16
bool
MAGNET_OVERLAPCHECK
=
false
;
17
int
MAGNET_VERBOSITY
= 0;
18
}
// namespace Enable
19
20
namespace
G4MAGNET
21
{
22
double
magnet_inner_radius
= 130.;
23
double
magnet_outer_radius
= 143.;
24
double
magnet_length
= 400.;
25
}
// namespace G4MAGNET
26
27
void
MagnetFieldInit
()
28
{
29
if
(!isfinite(
G4MAGNET::magfield_rescale
))
30
{
31
G4MAGNET::magfield_rescale
= 1.;
32
}
33
if
(
G4MAGNET::magfield
.empty())
34
{
35
G4MAGNET::magfield
= string(getenv(
"CALIBRATIONROOT"
)) + string(
"/Field/Map/SolenoidMag3D.TABLE"
);
36
}
37
}
38
39
void
MagnetInit
()
40
{
41
MagnetFieldInit
();
42
BlackHoleGeometry::max_radius
=
std::max
(
BlackHoleGeometry::max_radius
,
G4MAGNET::magnet_outer_radius
);
43
BlackHoleGeometry::max_z
=
std::max
(
BlackHoleGeometry::max_z
,
G4MAGNET::magnet_length
/ 2.);
44
BlackHoleGeometry::min_z
=
std::min
(
BlackHoleGeometry::min_z
, -
G4MAGNET::magnet_length
/ 2.);
45
}
46
47
double
Magnet
(
PHG4Reco
* g4Reco,
48
double
radius
)
49
{
50
bool
AbsorberActive =
Enable::ABSORBER
||
Enable::MAGNET_ABSORBER
;
51
bool
OverlapCheck =
Enable::OVERLAPCHECK
||
Enable::MAGNET_OVERLAPCHECK
;
52
int
verbosity =
std::max
(
Enable::VERBOSITY
,
Enable::MAGNET_VERBOSITY
);
53
54
if
(radius >
G4MAGNET::magnet_inner_radius
)
55
{
56
cout <<
"inconsistency: radius: "
<< radius
57
<<
" larger than Magnet inner radius: "
<<
G4MAGNET::magnet_inner_radius
<< endl;
58
gSystem->Exit(-1);
59
}
60
61
// right now Cleo is a massive Al cylinder which is likely not correct
62
// need to know the radiation length and adjust the material for that
63
// or get an idea about the actual cleo magnet design
64
radius =
G4MAGNET::magnet_inner_radius
;
65
PHG4CylinderSubsystem
* cyl =
new
PHG4CylinderSubsystem
(
"MAGNET"
, 0);
66
cyl->
set_double_param
(
"radius"
,
G4MAGNET::magnet_inner_radius
);
67
cyl->
set_double_param
(
"length"
,
G4MAGNET::magnet_length
);
68
cyl->
set_double_param
(
"thickness"
,
G4MAGNET::magnet_outer_radius
-
G4MAGNET::magnet_inner_radius
);
69
cyl->
set_string_param
(
"material"
,
"Al5083"
);
70
cyl->
SuperDetector
(
"MAGNET"
);
71
if
(AbsorberActive) cyl->
SetActive
();
72
g4Reco->
registerSubsystem
(cyl);
73
74
radius =
G4MAGNET::magnet_outer_radius
;
// outside of magnet
75
76
if
(verbosity > 0)
77
{
78
cout <<
"========================= G4_Magnet.C::Magnet() ==========================="
<< endl;
79
cout <<
" MAGNET Material Description:"
<< endl;
80
cout <<
" inner radius = "
<<
G4MAGNET::magnet_inner_radius
<<
" cm"
<< endl;
81
cout <<
" outer radius = "
<<
G4MAGNET::magnet_outer_radius
<<
" cm"
<< endl;
82
cout <<
" length = "
<<
G4MAGNET::magnet_length
<<
" cm"
<< endl;
83
cout <<
"==========================================================================="
<< endl;
84
}
85
86
radius +=
no_overlapp
;
87
88
return
radius
;
89
}
90
91
#endif // MACRO_G4MAGNETJLEIC_C
fun4all_eicmacros
blob
master
common
G4_Magnet_Cleo.C
Built by
Jin Huang
. updated:
Mon Jan 22 2024 12:43:53
using
1.8.2 with
EIC GitHub integration