Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
PHG4PSTOFSubsystem.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file PHG4PSTOFSubsystem.cc
1
// $Id$
2
11
#include "
PHG4PSTOFSubsystem.h
"
12
#include "
PHG4PSTOFDetector.h
"
13
#include "
PHG4PSTOFSteppingAction.h
"
14
15
#include <phparameter/PHParameters.h>
16
#include <phparameter/PHParametersContainer.h>
17
18
#include <
g4main/PHG4HitContainer.h
>
19
#include <
g4main/PHG4SteppingAction.h
>
// for PHG4SteppingAction
20
21
#include <
phool/PHCompositeNode.h
>
22
#include <
phool/PHIODataNode.h
>
// for PHIODataNode
23
#include <
phool/PHNode.h
>
// for PHNode
24
#include <
phool/PHNodeIterator.h
>
// for PHNodeIterator
25
#include <
phool/PHObject.h
>
// for PHObject
26
#include <
phool/getClass.h
>
27
28
#include <set>
// for set
29
#include <sstream>
30
31
//_______________________________________________________________________
32
PHG4PSTOFSubsystem::PHG4PSTOFSubsystem
(
const
std::string
&
name
)
33
:
PHG4DetectorGroupSubsystem
(name)
34
{
35
InitializeParameters
();
36
Name
(name);
37
SuperDetector
(name);
38
}
39
40
//_______________________________________________________________________
41
int
PHG4PSTOFSubsystem::InitRunSubsystem
(
PHCompositeNode
*topNode)
42
{
43
PHNodeIterator
iter(topNode);
44
PHCompositeNode
*dstNode =
dynamic_cast<
PHCompositeNode
*
>
(iter.
findFirst
(
"PHCompositeNode"
,
"DST"
));
45
46
// create detector
47
detector_
=
new
PHG4PSTOFDetector
(
this
, topNode,
GetParamsContainer
(),
Name
());
48
detector_
->
SuperDetector
(
SuperDetector
());
49
detector_
->
OverlapCheck
(
CheckOverlap
());
50
51
if
(
GetParamsContainer
()->GetParameters(-1)->
get_int_param
(
"active"
))
52
{
53
std::set<std::string> nodes;
54
PHNodeIterator
dstIter(dstNode);
55
PHCompositeNode
*DetNode =
dynamic_cast<
PHCompositeNode
*
>
(dstIter.
findFirst
(
"PHCompositeNode"
,
SuperDetector
()));
56
if
(!DetNode)
57
{
58
DetNode =
new
PHCompositeNode
(
SuperDetector
());
59
dstNode->
addNode
(DetNode);
60
}
61
std::ostringstream nodename;
62
if
(
SuperDetector
() !=
"NONE"
)
63
{
64
nodename <<
"G4HIT_"
<<
SuperDetector
();
65
}
66
else
67
{
68
nodename <<
"G4HIT_"
<<
Name
();
69
}
70
nodes.insert(nodename.str());
71
for
(
auto
&
node
: nodes)
72
{
73
PHG4HitContainer
*g4_hits = findNode::getClass<PHG4HitContainer>(topNode,
node
);
74
if
(!g4_hits)
75
{
76
g4_hits =
new
PHG4HitContainer
(
node
);
77
DetNode->
addNode
(
new
PHIODataNode<PHObject>
(g4_hits,
node
,
"PHObject"
));
78
}
79
}
80
// create stepping action
81
steppingAction_
=
new
PHG4PSTOFSteppingAction
(
detector_
,
GetParamsContainer
());
82
steppingAction_
->
Init
();
83
}
84
85
return
0;
86
}
87
88
//_______________________________________________________________________
89
int
PHG4PSTOFSubsystem::process_event
(
PHCompositeNode
*topNode)
90
{
91
// pass top node to stepping action so that it gets
92
// relevant nodes needed internally
93
if
(
steppingAction_
)
94
{
95
steppingAction_
->
SetInterfacePointers
(topNode);
96
}
97
return
0;
98
}
99
100
void
PHG4PSTOFSubsystem::Print
(
const
std::string
&what)
const
101
{
102
// std::cout << "PSTOF Parameters: " << std::endl;
103
PrintDefaultParams
();
104
PrintMacroParams
();
105
GetParamsContainer
()->
Print
();
106
if
(
detector_
)
107
{
108
detector_
->
Print
(what);
109
}
110
return
;
111
}
112
113
//_______________________________________________________________________
114
PHG4Detector
*
PHG4PSTOFSubsystem::GetDetector
()
const
115
{
116
return
detector_
;
117
}
118
119
//_______________________________________________________________________
120
PHG4SteppingAction
*
PHG4PSTOFSubsystem::GetSteppingAction
()
const
121
{
122
return
steppingAction_
;
123
}
124
125
void
PHG4PSTOFSubsystem::SetDefaultParameters
()
126
{
127
set_default_double_param
(0,
"z_mod_0"
, -109.3);
128
set_default_double_param
(1,
"z_mod_0"
, -96.66);
129
set_default_double_param
(2,
"z_mod_0"
, -84.42);
130
set_default_double_param
(3,
"z_mod_0"
, -72.55);
131
set_default_double_param
(4,
"z_mod_0"
, -61.07);
132
set_default_double_param
(5,
"z_mod_0"
, -49.97);
133
set_default_double_param
(6,
"z_mod_0"
, -39.25);
134
set_default_double_param
(7,
"z_mod_0"
, -28.72);
135
set_default_double_param
(8,
"z_mod_0"
, -18.76);
136
set_default_double_param
(9,
"z_mod_0"
, -9.191);
137
set_default_double_param
(10,
"z_mod_0"
, 0);
138
set_default_double_param
(11,
"z_mod_0"
, 9.191);
139
set_default_double_param
(12,
"z_mod_0"
, 18.76);
140
set_default_double_param
(13,
"z_mod_0"
, 28.72);
141
set_default_double_param
(14,
"z_mod_0"
, 39.25);
142
set_default_double_param
(15,
"z_mod_0"
, 49.97);
143
set_default_double_param
(16,
"z_mod_0"
, 61.07);
144
set_default_double_param
(17,
"z_mod_0"
, 72.55);
145
set_default_double_param
(18,
"z_mod_0"
, 84.42);
146
set_default_double_param
(19,
"z_mod_0"
, 96.66);
147
set_default_double_param
(20,
"z_mod_0"
, 109.3);
148
149
set_default_double_param
(0,
"z_mod_1"
, -107.2);
150
set_default_double_param
(1,
"z_mod_1"
, -94.66);
151
set_default_double_param
(2,
"z_mod_1"
, -82.52);
152
set_default_double_param
(3,
"z_mod_1"
, -70.75);
153
set_default_double_param
(4,
"z_mod_1"
, -59.37);
154
set_default_double_param
(5,
"z_mod_1"
, -48.47);
155
set_default_double_param
(6,
"z_mod_1"
, -37.85);
156
set_default_double_param
(7,
"z_mod_1"
, -27.72);
157
set_default_double_param
(8,
"z_mod_1"
, -18.76);
158
set_default_double_param
(9,
"z_mod_1"
, -9.191);
159
set_default_double_param
(10,
"z_mod_1"
, 0);
160
set_default_double_param
(11,
"z_mod_1"
, 9.191);
161
set_default_double_param
(12,
"z_mod_1"
, 18.76);
162
set_default_double_param
(13,
"z_mod_1"
, 27.72);
163
set_default_double_param
(14,
"z_mod_1"
, 37.85);
164
set_default_double_param
(15,
"z_mod_1"
, 48.47);
165
set_default_double_param
(16,
"z_mod_1"
, 59.37);
166
set_default_double_param
(17,
"z_mod_1"
, 70.75);
167
set_default_double_param
(18,
"z_mod_1"
, 82.52);
168
set_default_double_param
(19,
"z_mod_1"
, 94.66);
169
set_default_double_param
(20,
"z_mod_1"
, 107.2);
170
171
set_default_double_param
(0,
"r_mod_0"
, 85.6);
172
set_default_double_param
(1,
"r_mod_0"
, 85.6);
173
set_default_double_param
(2,
"r_mod_0"
, 85.6);
174
set_default_double_param
(3,
"r_mod_0"
, 85.6);
175
set_default_double_param
(4,
"r_mod_0"
, 86);
176
set_default_double_param
(5,
"r_mod_0"
, 86.5);
177
set_default_double_param
(6,
"r_mod_0"
, 86.5);
178
set_default_double_param
(7,
"r_mod_0"
, 86.5);
179
set_default_double_param
(8,
"r_mod_0"
, 85.5);
180
set_default_double_param
(9,
"r_mod_0"
, 83.6);
181
set_default_double_param
(10,
"r_mod_0"
, 87.5);
182
set_default_double_param
(11,
"r_mod_0"
, 83.6);
183
set_default_double_param
(12,
"r_mod_0"
, 85.5);
184
set_default_double_param
(13,
"r_mod_0"
, 86.5);
185
set_default_double_param
(14,
"r_mod_0"
, 86.5);
186
set_default_double_param
(15,
"r_mod_0"
, 86.5);
187
set_default_double_param
(16,
"r_mod_0"
, 86);
188
set_default_double_param
(17,
"r_mod_0"
, 85.6);
189
set_default_double_param
(18,
"r_mod_0"
, 85.6);
190
set_default_double_param
(19,
"r_mod_0"
, 85.6);
191
set_default_double_param
(20,
"r_mod_0"
, 85.6);
192
193
set_default_double_param
(0,
"r_mod_1"
, 85.3);
194
set_default_double_param
(1,
"r_mod_1"
, 85.2);
195
set_default_double_param
(2,
"r_mod_1"
, 84.9);
196
set_default_double_param
(3,
"r_mod_1"
, 84.8);
197
set_default_double_param
(4,
"r_mod_1"
, 85.1);
198
set_default_double_param
(5,
"r_mod_1"
, 85);
199
set_default_double_param
(6,
"r_mod_1"
, 85);
200
set_default_double_param
(7,
"r_mod_1"
, 84.8);
201
set_default_double_param
(8,
"r_mod_1"
, 83.8);
202
set_default_double_param
(9,
"r_mod_1"
, 81.9);
203
set_default_double_param
(10,
"r_mod_1"
, 85.8);
204
set_default_double_param
(11,
"r_mod_1"
, 81.9);
205
set_default_double_param
(12,
"r_mod_1"
, 83.8);
206
set_default_double_param
(13,
"r_mod_1"
, 84.8);
207
set_default_double_param
(14,
"r_mod_1"
, 85);
208
set_default_double_param
(15,
"r_mod_1"
, 85);
209
set_default_double_param
(16,
"r_mod_1"
, 85.1);
210
set_default_double_param
(17,
"r_mod_1"
, 84.8);
211
set_default_double_param
(18,
"r_mod_1"
, 84.9);
212
set_default_double_param
(19,
"r_mod_1"
, 85.2);
213
set_default_double_param
(20,
"r_mod_1"
, 85.3);
214
215
// geometry version number
216
// we use negative numbers until the "official" version
217
// when we build the detector
218
// set_default_int_param(-1,"geometry_version",-1);
219
set_default_int_param
(-1,
"modules"
, 21);
220
set_default_int_param
(-1,
"rows"
, 56);
221
set_default_double_param
(-1,
"xsize"
, 0.8);
222
set_default_double_param
(-1,
"ysize"
, 6.);
223
set_default_double_param
(-1,
"zsize"
, 5.);
224
set_default_int_param
(-1,
"active"
, 1);
225
set_default_int_param
(-1,
"absorberactive"
, 0);
226
}
coresoftware
blob
master
simulation
g4simulation
g4detectors
PHG4PSTOFSubsystem.cc
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:18:13
using
1.8.2 with
sPHENIX GitHub integration