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_Beast.C
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4_Magnet_Beast.C
1
#ifndef MACRO_G4MAGNETBEAST_C
2
#define MACRO_G4MAGNETBEAST_C
3
4
#include <GlobalVariables.C>
5
6
#include <eicdetectors/BeastMagnetSubsystem.h>
7
8
#include <
g4main/PHG4Reco.h
>
9
10
R__LOAD_LIBRARY
(libeicdetectors.so)
11
12
namespace Enable
13
{
14
bool
MAGNET
=
false
;
15
bool
MAGNET_ABSORBER
=
false
;
16
}
// namespace Enable
17
18
namespace
G4MAGNET
19
{
20
double
magnet_outer_radius
= 300.;
21
double
magnet_inner_radius
= 135.;
22
double
magnet_length
= 500.;
23
}
// namespace G4MAGNET
24
25
void
MagnetFieldInit
()
26
{
27
if
(!isfinite(
G4MAGNET::magfield_rescale
))
28
{
29
G4MAGNET::magfield_rescale
= 1.;
30
}
31
if
(
G4MAGNET::magfield
.empty())
32
{
33
G4MAGNET::magfield
= string(getenv(
"CALIBRATIONROOT"
)) + string(
"/Field/Map/mfield.4col.dat"
);
34
}
35
}
36
37
void
MagnetInit
()
38
{
39
MagnetFieldInit
();
40
BlackHoleGeometry::max_radius
=
std::max
(
BlackHoleGeometry::max_radius
,
G4MAGNET::magnet_outer_radius
);
41
BlackHoleGeometry::max_z
=
std::max
(
BlackHoleGeometry::max_z
,
G4MAGNET::magnet_length
/ 2.);
42
BlackHoleGeometry::min_z
=
std::min
(
BlackHoleGeometry::min_z
, -
G4MAGNET::magnet_length
/ 2.);
43
}
44
45
double
Magnet
(
PHG4Reco
* g4Reco,
double
radius
)
46
47
{
48
bool
AbsorberActive =
Enable::ABSORBER
||
Enable::MAGNET_ABSORBER
;
49
50
if
(radius >
G4MAGNET::magnet_inner_radius
)
51
{
52
cout <<
"previous outer radius "
<< radius <<
" larger then magnet inner radius "
<<
G4MAGNET::magnet_inner_radius
<< endl;
53
gSystem->Exit(1);
54
}
55
BeastMagnetSubsystem
* beast =
new
BeastMagnetSubsystem
();
56
beast->
set_string_param
(
"GDMPath"
, (
string
(getenv(
"CALIBRATIONROOT"
)) +
string
(
"/Magnet/BeastSolenoid.gdml"
)));
57
beast->
set_string_param
(
"TopVolName"
,
"SOLENOID"
);
58
beast->
SetActive
(AbsorberActive);
59
beast->
SuperDetector
(
"MAGNET"
);
60
g4Reco->
registerSubsystem
(beast);
61
return
G4MAGNET::magnet_outer_radius
;
62
}
63
64
#endif // MACRO_G4MAGNETBEAST_C
fun4all_eicmacros
blob
master
common
G4_Magnet_Beast.C
Built by
Jin Huang
. updated:
Mon Jan 22 2024 12:43:53
using
1.8.2 with
EIC GitHub integration