ECCE @ EIC Software
Reference for
ECCE @ 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_GEM_EIC.C
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4_GEM_EIC.C
1
#ifndef MACRO_G4GEMEIC_C
2
#define MACRO_G4GEMEIC_C
3
4
#include <
GlobalVariables.C
>
5
6
#include <
g4trackfastsim/PHG4TrackFastSim.h
>
7
8
#include <
g4detectors/PHG4SectorSubsystem.h
>
9
10
#include <
g4main/PHG4Reco.h
>
11
12
#include <string>
13
14
R__LOAD_LIBRARY
(libg4detectors.so)
15
16
int
make_GEM_station
(
string
name
,
PHG4Reco
*g4Reco,
double
zpos
,
double
etamin,
double
etamax, const
int
N_Sector = 16,
double
tilt = 0,
bool
doTilt =
false
);
17
void
AddLayers_MiniTPCDrift
(
PHG4SectorSubsystem
*gem);
18
void
AddLayers_GEMDrift
(
PHG4SectorSubsystem
*gem);
19
20
namespace Enable
21
{
22
bool
EGEM
=
false
;
23
bool
FGEM
=
false
;
24
bool
BGEM
=
false
;
25
}
// namespace Enable
26
27
void
EGEM_Init
()
28
{
29
BlackHoleGeometry::max_radius
=
std::max
(
BlackHoleGeometry::max_radius
, 80.);
30
// extends only to -z
31
BlackHoleGeometry::min_z
=
std::min
(
BlackHoleGeometry::min_z
, -160.);
32
}
33
34
void
FGEM_Init
()
35
{
36
BlackHoleGeometry::max_radius
=
std::max
(
BlackHoleGeometry::max_radius
, 150.);
37
BlackHoleGeometry::max_z
=
std::max
(
BlackHoleGeometry::max_z
, 282.);
38
}
39
40
void
BGEM_Init
()
41
{
42
cout << __PRETTY_FUNCTION__ <<
": BGEM not yet defined"
<< endl;
43
exit
(1);
44
45
BlackHoleGeometry::max_radius
=
std::max
(
BlackHoleGeometry::max_radius
, 150.);
46
BlackHoleGeometry::max_z
=
std::max
(
BlackHoleGeometry::max_z
, 150.);
47
}
48
49
void
EGEMSetup
(
PHG4Reco
*g4Reco)
50
{
51
make_GEM_station
(
"EGEM_0"
, g4Reco, -121.0, -1.668, -3.7);
52
}
53
54
void
FGEMSetup
(
PHG4Reco
*g4Reco,
const
int
N_Sector = 16)
55
{
56
make_GEM_station
(
"FGEM_0"
, g4Reco, 287.0, 1.3, 3.6, N_Sector);
57
}
58
60
void
AddLayers_MiniTPCDrift
(
PHG4SectorSubsystem
*gem)
61
{
62
assert(gem);
63
64
const
double
cm
=
PHG4Sector::Sector_Geometry::Unit_cm
();
65
const
double
mm
= 0.1 *
cm
;
66
const
double
um
= 1
e
-3 *
mm
;
67
68
// const int N_Layers = 70; // used for mini-drift TPC timing digitalization
69
const
int
N_Layers = 1;
// simplified setup
70
const
double
thickness
= 2 *
cm
;
71
72
gem->
get_geometry
().
AddLayer
(
"EntranceWindow"
,
"G4_MYLAR"
, 25 * um,
false
, 100);
73
gem->
get_geometry
().
AddLayer
(
"Cathode"
,
"G4_GRAPHITE"
, 10 * um,
false
, 100);
74
75
for
(
int
d
= 1;
d
<= N_Layers;
d
++)
76
{
77
ostringstream
s
;
78
s <<
"DriftLayer_"
;
79
s <<
d
;
80
81
gem->
get_geometry
().
AddLayer
(s.str(),
"G4_METHANE"
, thickness / N_Layers,
true
);
82
}
83
}
84
86
void
AddLayers_GEMDrift
(
PHG4SectorSubsystem
*gem)
87
{
88
assert(gem);
89
90
const
double
cm
=
PHG4Sector::Sector_Geometry::Unit_cm
();
91
const
double
mm
= 0.1 *
cm
;
92
const
double
um
= 1
e
-3 *
mm
;
93
94
const
int
N_Layers = 1;
// simplified setup
95
const
double
thickness
= 3 *
mm
;
96
97
gem->
get_geometry
().
AddLayer
(
"EntranceWindow"
,
"G4_MYLAR"
, 25 * um,
false
, 100);
98
gem->
get_geometry
().
AddLayer
(
"Cathode"
,
"G4_GRAPHITE"
, 10 * um,
false
, 100);
99
100
for
(
int
d
= 1;
d
<= N_Layers;
d
++)
101
{
102
ostringstream
s
;
103
s <<
"DriftLayer_"
;
104
s <<
d
;
105
106
gem->
get_geometry
().
AddLayer
(s.str(),
"G4_METHANE"
, thickness / N_Layers,
true
);
107
}
108
}
109
110
int
make_GEM_station
(
string
name
,
PHG4Reco
*g4Reco,
double
zpos
,
double
etamin,
111
double
etamax,
const
int
N_Sector = 16,
double
tilt = 0,
bool
doTilt =
false
)
112
{
113
// cout
114
// << "make_GEM_station - GEM construction with PHG4SectorSubsystem - make_GEM_station_EdgeReadout of "
115
// << name << endl;
116
117
double
zpos_lab(zpos);
118
double
polar_angle = 0;
119
120
if
(doTilt)
121
{
122
zpos = zpos - (zpos * sin(tilt) + zpos * cos(tilt) * tan(
PHG4Sector::Sector_Geometry::eta_to_polar_angle
(2) - tilt)) * sin(tilt);
123
}
124
else
125
{
126
if
(zpos < 0)
127
{
128
zpos = -
zpos
;
129
polar_angle =
M_PI
;
130
}
131
}
132
if
(etamax < etamin)
133
{
134
double
t
= etamax;
135
etamax = etamin;
136
etamin =
t
;
137
}
138
139
PHG4SectorSubsystem
*gem;
140
gem =
new
PHG4SectorSubsystem
(name);
141
142
gem->
SuperDetector
(name);
143
144
if
(doTilt)
145
{
146
gem->
get_geometry
().
set_normal_polar_angle
((
PHG4Sector::Sector_Geometry::eta_to_polar_angle
(etamin) +
PHG4Sector::Sector_Geometry::eta_to_polar_angle
(etamax)) / 2);
147
gem->
get_geometry
().
set_normal_start
(zpos *
PHG4Sector::Sector_Geometry::Unit_cm
(),
PHG4Sector::Sector_Geometry::eta_to_polar_angle
(etamax));
148
}
149
else
150
{
151
gem->
get_geometry
().
set_normal_polar_angle
(polar_angle);
152
gem->
get_geometry
().
set_normal_start
(zpos *
PHG4Sector::Sector_Geometry::Unit_cm
());
153
}
154
gem->
get_geometry
().
set_min_polar_angle
(
PHG4Sector::Sector_Geometry::eta_to_polar_angle
(etamax));
155
gem->
get_geometry
().
set_max_polar_angle
(
PHG4Sector::Sector_Geometry::eta_to_polar_angle
(etamin));
156
gem->
get_geometry
().
set_max_polar_edge
(
PHG4Sector::Sector_Geometry::FlatEdge
());
157
gem->
get_geometry
().
set_min_polar_edge
(
PHG4Sector::Sector_Geometry::FlatEdge
());
158
gem->
get_geometry
().
set_N_Sector
(N_Sector);
159
gem->
get_geometry
().
set_material
(
"G4_METHANE"
);
160
gem->
OverlapCheck
(
Enable::OVERLAPCHECK
);
161
162
AddLayers_GEMDrift
(gem);
163
gem->
get_geometry
().
AddLayers_HBD_GEM
();
164
gem->
OverlapCheck
(
Enable::OVERLAPCHECK
);
165
g4Reco->
registerSubsystem
(gem);
166
167
// Following Nov-5 tracking meeting, update to muRwell performance of 55um resolution 2D readout
168
if
(
TRACKING::FastKalmanFilter
)
169
{
170
TRACKING::FastKalmanFilter
->
add_phg4hits
(
string
(
"G4HIT_"
) + name,
// const std::string& phg4hitsNames,
171
PHG4TrackFastSim::Vertical_Plane
,
// const DETECTOR_TYPE phg4dettype,
172
55
e
-4,
// const float radres,
173
55
e
-4,
// const float phires,
174
100
e
-4,
// const float lonres,
175
1,
// const float eff,
176
0);
// const float noise
177
178
TRACKING::FastKalmanFilter
->
add_zplane_state
(name, zpos_lab);
179
TRACKING::ProjectionNames
.insert(name);
180
}
181
182
if
(
TRACKING::FastKalmanFilterInnerTrack
and zpos_lab<0)
183
TRACKING::FastKalmanFilterInnerTrack
->
add_phg4hits
(
string
(
"G4HIT_"
) + name,
// const std::string& phg4hitsNames,
184
PHG4TrackFastSim::Vertical_Plane
,
// const DETECTOR_TYPE phg4dettype,
185
55
e
-4,
// const float radres,
186
55
e
-4,
// const float phires,
187
100
e
-4,
// const float lonres,
188
1,
// const float eff,
189
0);
// const float noise
190
191
return
0;
192
}
193
#endif
194
macros
blob
master
common
G4_GEM_EIC.C
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:58
using
1.8.2 with
ECCE GitHub integration