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
PHG4ZDCSubsystem.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file PHG4ZDCSubsystem.cc
1
#include "
PHG4ZDCSubsystem.h
"
2
3
#include "
PHG4ZDCDetector.h
"
4
#include "
PHG4ZDCDisplayAction.h
"
5
#include "
PHG4ZDCSteppingAction.h
"
6
7
#include <phparameter/PHParameters.h>
8
9
#include <
g4main/PHG4DisplayAction.h
>
// for PHG4DisplayAction
10
#include <
g4main/PHG4HitContainer.h
>
11
#include <
g4main/PHG4SteppingAction.h
>
// for PHG4SteppingAction
12
13
#include <
phool/PHCompositeNode.h
>
14
#include <
phool/PHIODataNode.h
>
// for PHIODataNode
15
#include <
phool/PHNode.h
>
// for PHNode
16
#include <
phool/PHNodeIterator.h
>
// for PHNodeIterator
17
#include <
phool/PHObject.h
>
// for PHObject
18
#include <
phool/getClass.h
>
19
20
#include <fstream>
21
#include <set>
// for set
22
#include <sstream>
23
24
class
PHG4Detector
;
25
26
using namespace
std;
27
28
//_______________________________________________________________________
29
PHG4ZDCSubsystem::PHG4ZDCSubsystem
(
const
std::string&
name
,
const
int
lyr)
30
:
PHG4DetectorSubsystem
(name, lyr)
31
{
32
InitializeParameters
();
33
}
34
35
//_______________________________________________________________________
36
PHG4ZDCSubsystem::~PHG4ZDCSubsystem
()
37
{
38
delete
m_DisplayAction
;
39
}
40
41
//_______________________________________________________________________
42
int
PHG4ZDCSubsystem::InitRunSubsystem
(
PHCompositeNode
*
topNode
)
43
{
44
PHNodeIterator
iter(topNode);
45
PHCompositeNode
* dstNode =
dynamic_cast<
PHCompositeNode
*
>
(iter.
findFirst
(
"PHCompositeNode"
,
"DST"
));
46
47
// create display settings before detector
48
m_DisplayAction
=
new
PHG4ZDCDisplayAction
(
Name
());
49
// create detector
50
m_Detector
=
new
PHG4ZDCDetector
(
this
, topNode,
GetParams
(),
Name
(),
GetLayer
());
51
52
m_Detector
->
SuperDetector
(
SuperDetector
());
53
m_Detector
->
OverlapCheck
(
CheckOverlap
());
54
m_Detector
->
Verbosity
(
Verbosity
());
55
set<string> nodes;
56
57
if
(
GetParams
()->
get_int_param
(
"active"
))
58
{
59
PHNodeIterator
dstIter(dstNode);
60
PHCompositeNode
* DetNode = dstNode;
61
if
(
SuperDetector
() !=
"NONE"
&& !
SuperDetector
().empty())
62
{
63
PHNodeIterator
iter_dst(dstNode);
64
DetNode =
dynamic_cast<
PHCompositeNode
*
>
(iter_dst.
findFirst
(
"PHCompositeNode"
,
SuperDetector
()));
65
66
if
(!DetNode)
67
{
68
DetNode =
new
PHCompositeNode
(
SuperDetector
());
69
dstNode->
addNode
(DetNode);
70
}
71
}
72
// create hit output nodes
73
std::string detector_suffix =
SuperDetector
();
74
if
(detector_suffix ==
"NONE"
|| detector_suffix.empty())
75
{
76
detector_suffix =
Name
();
77
}
78
79
m_HitNodeName
=
"G4HIT_"
+ detector_suffix;
80
nodes.insert(
m_HitNodeName
);
81
m_AbsorberNodeName
=
"G4HIT_ABSORBER_"
+ detector_suffix;
82
if
(
GetParams
()->
get_int_param
(
"absorberactive"
))
83
{
84
nodes.insert(
m_AbsorberNodeName
);
85
}
86
m_SupportNodeName
=
"G4HIT_SUPPORT_"
+ detector_suffix;
87
if
(
GetParams
()->
get_int_param
(
"supportactive"
))
88
{
89
nodes.insert(
m_SupportNodeName
);
90
}
91
92
for
(
auto
nodename : nodes)
93
{
94
PHG4HitContainer
* g4_hits = findNode::getClass<PHG4HitContainer>(
topNode
, nodename);
95
if
(!g4_hits)
96
{
97
g4_hits =
new
PHG4HitContainer
(nodename);
98
DetNode->
addNode
(
new
PHIODataNode<PHObject>
(g4_hits, nodename,
"PHObject"
));
99
}
100
}
101
// create stepping action
102
m_SteppingAction
=
new
PHG4ZDCSteppingAction
(
m_Detector
,
GetParams
());
103
m_SteppingAction
->
SetHitNodeName
(
"G4HIT"
,
m_HitNodeName
);
104
m_SteppingAction
->
SetHitNodeName
(
"G4HIT_ABSORBER"
,
m_AbsorberNodeName
);
105
m_SteppingAction
->
SetHitNodeName
(
"G4HIT_SUPPORT"
,
m_SupportNodeName
);
106
}
107
else
if
(
GetParams
()->
get_int_param
(
"blackhole"
))
108
{
109
m_SteppingAction
=
new
PHG4ZDCSteppingAction
(
m_Detector
,
GetParams
());
110
}
111
return
0;
112
}
113
114
//_______________________________________________________________________
115
int
PHG4ZDCSubsystem::process_event
(
PHCompositeNode
*
topNode
)
116
{
117
// pass top node to stepping action so that it gets
118
// relevant nodes needed internally
119
if
(
m_SteppingAction
)
120
{
121
m_SteppingAction
->
SetInterfacePointers
(topNode);
122
}
123
return
0;
124
}
125
126
//_______________________________________________________________________
127
PHG4Detector
*
PHG4ZDCSubsystem::GetDetector
(
void
)
const
128
{
129
return
m_Detector
;
130
}
131
132
void
PHG4ZDCSubsystem::SetDefaultParameters
()
133
{
134
set_default_double_param
(
"place_x"
, 0.);
135
set_default_double_param
(
"place_y"
, 0.);
136
set_default_double_param
(
"place_z"
, 1843.0);
137
set_default_double_param
(
"rot_x"
, 0.);
138
set_default_double_param
(
"rot_y"
, 0.);
139
set_default_double_param
(
"rot_z"
, 0.);
140
return
;
141
}
coresoftware
blob
master
simulation
g4simulation
g4detectors
PHG4ZDCSubsystem.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:42
using
1.8.2 with
ECCE GitHub integration