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
PHG4EPDSubsystem.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file PHG4EPDSubsystem.cc
1
/* vim: set sw=2 ft=cpp: */
2
3
#include "
PHG4EPDSubsystem.h
"
4
5
#include "
PHG4EPDDetector.h
"
6
#include "
PHG4EPDDisplayAction.h
"
7
#include "
PHG4EPDSteppingAction.h
"
8
9
#include <phparameter/PHParameters.h>
10
11
#include <
g4detectors/PHG4DetectorSubsystem.h
>
// for PHG4DetectorSubsystem
12
13
#include <
g4main/PHG4DisplayAction.h
>
// for PHG4DisplayAction
14
#include <
g4main/PHG4HitContainer.h
>
15
#include <
g4main/PHG4SteppingAction.h
>
// for PHG4SteppingAction
16
17
#include <
phool/PHCompositeNode.h
>
18
#include <
phool/PHIODataNode.h
>
19
#include <
phool/PHNode.h
>
20
#include <
phool/PHNodeIterator.h
>
21
#include <
phool/PHObject.h
>
22
#include <
phool/getClass.h
>
23
24
#include <set>
25
#include <string>
26
27
PHG4EPDSubsystem::PHG4EPDSubsystem
(
std::string
const
&
name
)
28
:
PHG4DetectorSubsystem
(name)
29
{
30
InitializeParameters
();
31
}
32
33
PHG4EPDSubsystem::~PHG4EPDSubsystem
()
34
{
35
delete
m_DisplayAction
;
36
}
37
38
int
PHG4EPDSubsystem::InitRunSubsystem
(
PHCompositeNode
* topNode)
39
{
40
m_DisplayAction
=
new
PHG4EPDDisplayAction
(
Name
());
41
42
m_Detector
=
new
PHG4EPDDetector
(
this
, topNode,
GetParams
(),
Name
());
43
m_Detector
->
SuperDetector
(
SuperDetector
());
44
m_Detector
->
OverlapCheck
(
CheckOverlap
());
45
46
if
(
GetParams
()->
get_int_param
(
"active"
))
47
{
48
std::set<std::string> nodes;
49
PHNodeIterator
iter(topNode);
50
PHCompositeNode
* dstNode =
dynamic_cast<
PHCompositeNode
*
>
(iter.
findFirst
(
"PHCompositeNode"
,
"DST"
));
51
PHNodeIterator
dstIter(dstNode);
52
PHCompositeNode
* DetNode = dstNode;
53
if
(
SuperDetector
() !=
"NONE"
&& !
SuperDetector
().empty())
54
{
55
PHNodeIterator
iter_dst(dstNode);
56
DetNode =
dynamic_cast<
PHCompositeNode
*
>
(iter_dst.
findFirst
(
"PHCompositeNode"
,
SuperDetector
()));
57
58
if
(!DetNode)
59
{
60
DetNode =
new
PHCompositeNode
(
SuperDetector
());
61
dstNode->
addNode
(DetNode);
62
}
63
}
64
// create hit output nodes
65
std::string
detector_suffix =
SuperDetector
();
66
if
(detector_suffix ==
"NONE"
)
67
{
68
detector_suffix =
Name
();
69
}
70
71
m_HitNodeName
=
"G4HIT_"
+ detector_suffix;
72
nodes.insert(
m_HitNodeName
);
73
m_SupportNodeName
=
"G4HIT_SUPPORT_"
+ detector_suffix;
74
if
(
GetParams
()->
get_int_param
(
"supportactive"
))
75
{
76
nodes.insert(
m_SupportNodeName
);
77
}
78
79
for
(
const
auto
& nodename : nodes)
80
{
81
PHG4HitContainer
* g4_hits = findNode::getClass<PHG4HitContainer>(topNode, nodename);
82
if
(!g4_hits)
83
{
84
g4_hits =
new
PHG4HitContainer
(nodename);
85
DetNode->
addNode
(
new
PHIODataNode<PHObject>
(g4_hits, nodename,
"PHObject"
));
86
}
87
}
88
// create stepping action
89
m_SteppingAction
=
new
PHG4EPDSteppingAction
(
m_Detector
,
GetParams
());
90
m_SteppingAction
->
SetHitNodeName
(
"G4HIT"
,
m_HitNodeName
);
91
m_SteppingAction
->
SetHitNodeName
(
"G4HIT_SUPPORT"
,
m_SupportNodeName
);
92
}
93
else
if
(
GetParams
()->
get_int_param
(
"blackhole"
))
94
{
95
m_SteppingAction
=
new
PHG4EPDSteppingAction
(
m_Detector
,
GetParams
());
96
}
97
98
return
0;
99
}
100
101
int
PHG4EPDSubsystem::process_event
(
PHCompositeNode
* topNode)
102
{
103
if
(
m_SteppingAction
!=
nullptr
)
104
{
105
m_SteppingAction
->
SetInterfacePointers
(topNode);
106
}
107
return
0;
108
}
109
110
PHG4Detector
*
PHG4EPDSubsystem::GetDetector
()
const
111
{
112
return
m_Detector
;
113
}
114
115
void
PHG4EPDSubsystem::SetDefaultParameters
()
116
{
117
set_default_double_param
(
"place_z"
, 316.);
118
}
coresoftware
blob
master
simulation
g4simulation
g4epd
PHG4EPDSubsystem.cc
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:18:13
using
1.8.2 with
sPHENIX GitHub integration