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
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
m_SteppingAction
=
new
PHG4EPDSteppingAction
(
m_Detector
,
GetParams
());
47
48
if
(
GetParams
()->
get_int_param
(
"active"
))
49
{
50
std::set<std::string> nodes;
51
PHNodeIterator
iter(topNode);
52
PHCompositeNode
* dstNode =
dynamic_cast<
PHCompositeNode
*
>
(iter.
findFirst
(
"PHCompositeNode"
,
"DST"
));
53
PHNodeIterator
dstIter(dstNode);
54
PHCompositeNode
* DetNode = dstNode;
55
if
(
SuperDetector
() !=
"NONE"
&& !
SuperDetector
().empty())
56
{
57
PHNodeIterator
iter_dst(dstNode);
58
DetNode =
dynamic_cast<
PHCompositeNode
*
>
(iter_dst.
findFirst
(
"PHCompositeNode"
,
SuperDetector
()));
59
60
if
(!DetNode)
61
{
62
DetNode =
new
PHCompositeNode
(
SuperDetector
());
63
dstNode->
addNode
(DetNode);
64
}
65
}
66
// create hit output nodes
67
std::string detector_suffix =
SuperDetector
();
68
if
(detector_suffix ==
"NONE"
)
69
{
70
detector_suffix =
Name
();
71
}
72
73
m_HitNodeName
=
"G4HIT_"
+ detector_suffix;
74
nodes.insert(
m_HitNodeName
);
75
m_SupportNodeName
=
"G4HIT_SUPPORT_"
+ detector_suffix;
76
if
(
GetParams
()->
get_int_param
(
"supportactive"
))
77
{
78
nodes.insert(
m_SupportNodeName
);
79
}
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
// create stepping action
91
m_SteppingAction
=
new
PHG4EPDSteppingAction
(
m_Detector
,
GetParams
());
92
m_SteppingAction
->
SetHitNodeName
(
"G4HIT"
,
m_HitNodeName
);
93
m_SteppingAction
->
SetHitNodeName
(
"G4HIT_SUPPORT"
,
m_SupportNodeName
);
94
}
95
else
if
(
GetParams
()->
get_int_param
(
"blackhole"
))
96
{
97
m_SteppingAction
=
new
PHG4EPDSteppingAction
(
m_Detector
,
GetParams
());
98
}
99
100
return
0;
101
}
102
103
int
PHG4EPDSubsystem::process_event
(
PHCompositeNode
* topNode)
104
{
105
if
(
m_SteppingAction
!=
nullptr
)
106
{
107
m_SteppingAction
->
SetInterfacePointers
(topNode);
108
}
109
return
0;
110
}
111
112
PHG4Detector
*
PHG4EPDSubsystem::GetDetector
()
const
113
{
114
return
m_Detector
;
115
}
116
117
void
PHG4EPDSubsystem::SetDefaultParameters
()
118
{
119
set_default_double_param
(
"place_z"
, 300.);
120
}
coresoftware
blob
master
simulation
g4simulation
g4epd
PHG4EPDSubsystem.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:42
using
1.8.2 with
ECCE GitHub integration