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