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
PHG4TpcSubsystem.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file PHG4TpcSubsystem.cc
1
#include "
PHG4TpcSubsystem.h
"
2
#include "
PHG4TpcDetector.h
"
3
#include "
PHG4TpcDisplayAction.h
"
4
#include "
PHG4TpcSteppingAction.h
"
5
6
#include <
g4detectors/PHG4DetectorSubsystem.h
>
// for PHG4DetectorSubsystem
7
8
#include <phparameter/PHParameters.h>
9
10
#include <
g4main/PHG4DisplayAction.h
>
// for PHG4DisplayAction
11
#include <
g4main/PHG4HitContainer.h
>
12
#include <
g4main/PHG4SteppingAction.h
>
// for PHG4SteppingAction
13
14
#include <
phool/PHCompositeNode.h
>
15
#include <
phool/PHIODataNode.h
>
// for PHIODataNode
16
#include <
phool/PHNode.h
>
// for PHNode
17
#include <
phool/PHNodeIterator.h
>
// for PHNodeIterator
18
#include <
phool/PHObject.h
>
// for PHObject
19
#include <
phool/getClass.h
>
20
21
#include <boost/foreach.hpp>
22
23
#include <cmath>
// for NAN
24
#include <iostream>
// for operator<<, basic_ost...
25
#include <set>
26
27
class
PHG4Detector
;
28
29
//_______________________________________________________________________
30
PHG4TpcSubsystem::PHG4TpcSubsystem
(
const
std::string &
name
,
const
int
lyr)
31
:
PHG4DetectorSubsystem
(name, lyr)
32
{
33
InitializeParameters
();
34
}
35
36
//_______________________________________________________________________
37
PHG4TpcSubsystem::~PHG4TpcSubsystem
()
38
{
39
delete
m_DisplayAction
;
40
}
41
42
//_______________________________________________________________________
43
int
PHG4TpcSubsystem::InitRunSubsystem
(
PHCompositeNode
*
topNode
)
44
{
45
PHNodeIterator
iter(topNode);
46
PHCompositeNode
*dstNode =
dynamic_cast<
PHCompositeNode
*
>
(iter.
findFirst
(
"PHCompositeNode"
,
"DST"
));
47
48
// create display settings before detector (detector adds its volumes to it)
49
m_DisplayAction
=
new
PHG4TpcDisplayAction
(
Name
());
50
// create detector
51
m_Detector
=
new
PHG4TpcDetector
(
this
, topNode,
GetParams
(),
Name
());
52
m_Detector
->
SuperDetector
(
SuperDetector
());
53
m_Detector
->
OverlapCheck
(
CheckOverlap
());
54
std::set<std::string> nodes;
55
if
(
GetParams
()->
get_int_param
(
"active"
))
56
{
57
PHNodeIterator
dstIter(dstNode);
58
PHCompositeNode
* DetNode = dstNode;
59
if
(
SuperDetector
() !=
"NONE"
&& !
SuperDetector
().empty())
60
{
61
PHNodeIterator
iter_dst(dstNode);
62
DetNode =
dynamic_cast<
PHCompositeNode
*
>
(iter_dst.
findFirst
(
"PHCompositeNode"
,
SuperDetector
()));
63
if
(!DetNode)
64
{
65
DetNode =
new
PHCompositeNode
(
SuperDetector
());
66
dstNode->
addNode
(DetNode);
67
}
68
}
69
std::string detector_suffix =
SuperDetector
();
70
if
(detector_suffix ==
"NONE"
|| detector_suffix.empty())
71
{
72
detector_suffix =
Name
();
73
}
74
m_HitNodeName
=
"G4HIT_"
+ detector_suffix;
75
nodes.insert(
m_HitNodeName
);
76
m_AbsorberNodeName
=
"G4HIT_ABSORBER_"
+ detector_suffix;
77
if
(
GetParams
()->
get_int_param
(
"absorberactive"
))
78
{
79
nodes.insert(
m_AbsorberNodeName
);
80
}
81
for
(
auto
nodename: nodes)
82
{
83
PHG4HitContainer
*g4_hits = findNode::getClass<PHG4HitContainer>(
topNode
, nodename);
84
if
(!g4_hits)
85
{
86
g4_hits =
new
PHG4HitContainer
(nodename);
87
DetNode->
addNode
(
new
PHIODataNode<PHObject>
(g4_hits, nodename,
"PHObject"
));
88
}
89
}
90
91
// create stepping action
92
m_SteppingAction
=
new
PHG4TpcSteppingAction
(
m_Detector
,
GetParams
());
93
m_SteppingAction
->
SetHitNodeName
(
"G4HIT"
,
m_HitNodeName
);
94
m_SteppingAction
->
SetHitNodeName
(
"G4HIT_ABSORBER"
,
m_AbsorberNodeName
);
95
}
96
else
97
{
98
// if this is a black hole it does not have to be active
99
if
(
GetParams
()->
get_int_param
(
"blackhole"
))
100
{
101
m_SteppingAction
=
new
PHG4TpcSteppingAction
(
m_Detector
,
GetParams
());
102
}
103
}
104
return
0;
105
}
106
107
//_______________________________________________________________________
108
int
PHG4TpcSubsystem::process_event
(
PHCompositeNode
*
topNode
)
109
{
110
// pass top node to stepping action so that it gets
111
// relevant nodes needed internally
112
if
(
m_SteppingAction
)
113
{
114
m_SteppingAction
->
SetInterfacePointers
(topNode);
115
}
116
return
0;
117
}
118
119
void
PHG4TpcSubsystem::Print
(
const
std::string &what)
const
120
{
121
std::cout <<
Name
() <<
" Parameters: "
<< std::endl;
122
GetParams
()->
Print
();
123
if
(
m_Detector
)
124
{
125
m_Detector
->
Print
(what);
126
}
127
if
(
m_SteppingAction
)
128
{
129
m_SteppingAction
->
Print
(what);
130
}
131
132
return
;
133
}
134
135
//_______________________________________________________________________
136
PHG4Detector
*
PHG4TpcSubsystem::GetDetector
(
void
)
const
137
{
138
return
m_Detector
;
139
}
140
141
void
PHG4TpcSubsystem::SetDefaultParameters
()
142
{
143
set_default_double_param
(
"gas_inner_radius"
, 21.);
144
set_default_double_param
(
"gas_outer_radius"
, 77.);
145
set_default_double_param
(
"place_x"
, 0.);
146
set_default_double_param
(
"place_y"
, 0.);
147
set_default_double_param
(
"place_z"
, 0.);
148
set_default_double_param
(
"rot_x"
, 0.);
149
set_default_double_param
(
"rot_y"
, 0.);
150
set_default_double_param
(
"rot_z"
, 0.);
151
set_default_double_param
(
"tpc_length"
, 211.);
152
153
set_default_double_param
(
"steplimits"
, NAN);
154
155
set_default_string_param
(
"tpc_gas"
,
"sPHENIX_TPC_Gas"
);
156
157
// material budget:
158
// Cu (all layers): 0.5 oz cu per square foot, 1oz == 0.0347mm --> 0.5 oz == 0.00347cm/2.
159
// Kapton insulation 18 layers of * 5mil = 18*0.0127=0.2286
160
// 250 um FR4 (Substrate for Cu layers)
161
// HoneyComb (nomex) 1/2 inch=0.5*2.54 cm
162
set_default_string_param
(
"cage_layer_1_material"
,
"G4_Cu"
);
163
set_default_double_param
(
"cage_layer_1_thickness"
, 0.00347 / 2.);
164
165
set_default_string_param
(
"cage_layer_2_material"
,
"FR4"
);
166
set_default_double_param
(
"cage_layer_2_thickness"
, 0.025);
167
168
set_default_string_param
(
"cage_layer_3_material"
,
"NOMEX"
);
169
set_default_double_param
(
"cage_layer_3_thickness"
, 0.5 * 2.54);
170
171
set_default_string_param
(
"cage_layer_4_material"
,
"G4_Cu"
);
172
set_default_double_param
(
"cage_layer_4_thickness"
, 0.00347 / 2.);
173
174
set_default_string_param
(
"cage_layer_5_material"
,
"FR4"
);
175
set_default_double_param
(
"cage_layer_5_thickness"
, 0.025);
176
177
set_default_string_param
(
"cage_layer_6_material"
,
"G4_KAPTON"
);
178
set_default_double_param
(
"cage_layer_6_thickness"
, 0.2286);
179
180
set_default_string_param
(
"cage_layer_7_material"
,
"G4_Cu"
);
181
set_default_double_param
(
"cage_layer_7_thickness"
, 0.00347 / 2.);
182
183
set_default_string_param
(
"cage_layer_8_material"
,
"G4_KAPTON"
);
184
set_default_double_param
(
"cage_layer_8_thickness"
, 0.05);
// 50 um
185
186
set_default_string_param
(
"cage_layer_9_material"
,
"G4_Cu"
);
187
set_default_double_param
(
"cage_layer_9_thickness"
, 0.00347 / 2.);
188
189
// Thomas K Hemmick <Thomas.Hemmick@stonybrook.edu>
190
// The total thickness along Zed would be 5.6 millimeters (+/- 2.8 mm around Zed=0).
191
// The outer surfaces would have 0.005 inches (125 um) FR4 coated with a negligible thickness of Al. (revised to Au as below)
192
// The interior would be some stiffener of either honeycomb or rohacell. The range of radiation lengths for this material are:
193
// Large cell honeycomb: 1450 cm (0.028 g/cm^3 density)
194
// rohacell: 760 cm (0.052 g/cm^3 density)
195
// Close cell honeycomb: 635 cm (0.064 g/cm^3 density)
196
// I think a calculation just for the rohacell would be more than sufficient.
197
set_default_string_param
(
"window_core_material"
,
"ROHACELL_FOAM_51"
);
198
set_default_double_param
(
"window_thickness"
, 0.56);
// overall thickness
199
//I just checked with PC manufacturers and we can get 8.9 micron thick copper in reasonably large sheets.
200
// At normal incidence, 8.9 microns is 0.06% of a radiation length.
201
set_default_string_param
(
"window_surface1_material"
,
"G4_Cu"
);
202
set_default_double_param
(
"window_surface1_thickness"
, 8.9
e
-4);
// 8.9 um outter shell thickness be default
203
// The FR4 should be either 5 or 10 mils thick. 10 mils is 254 microns and 5 mils is 0.127 microns. I think either of these is mechanically fine...
204
set_default_string_param
(
"window_surface2_material"
,
"FR4"
);
205
set_default_double_param
(
"window_surface2_thickness"
, 0.0127);
// 127 um 2nd shell thickness be default
206
}
coresoftware
blob
master
simulation
g4simulation
g4tpc
PHG4TpcSubsystem.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:45
using
1.8.2 with
ECCE GitHub integration