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
PHG4BbcSubsystem.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file PHG4BbcSubsystem.cc
1
#include "
PHG4BbcSubsystem.h
"
2
3
#include "
PHG4BbcDetector.h
"
4
#include "
PHG4BbcDisplayAction.h
"
5
#include "
PHG4BbcSteppingAction.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
#include <
phool/phool.h
>
20
21
#include <iostream>
// for operator<<, basic_ostream, endl
22
#include <set>
// for set
23
#include <sstream>
24
25
//_______________________________________________________________________
26
PHG4BbcSubsystem::PHG4BbcSubsystem
(
const
std::string &
name
)
27
:
PHG4DetectorSubsystem
(name)
28
{
29
InitializeParameters
();
30
}
31
32
//_______________________________________________________________________
33
PHG4BbcSubsystem::~PHG4BbcSubsystem
()
34
{
35
delete
m_DisplayAction
;
36
}
37
38
//_______________________________________________________________________
39
int
PHG4BbcSubsystem::InitRunSubsystem
(
PHCompositeNode
*topNode)
40
{
41
if
(
Verbosity
() > 1)
42
{
43
std::cout <<
PHWHERE
<<
" Initializing BBC Subsystem"
<< std::endl;
44
}
45
46
PHNodeIterator
iter(topNode);
47
PHCompositeNode
*dstNode =
dynamic_cast<
PHCompositeNode
*
>
(iter.
findFirst
(
"PHCompositeNode"
,
"DST"
));
48
49
// create display settings before detector
50
m_DisplayAction
=
new
PHG4BbcDisplayAction
(
Name
());
51
// create detector
52
m_Detector
=
new
PHG4BbcDetector
(
this
, topNode,
GetParams
(),
Name
());
53
m_Detector
->
SuperDetector
(
SuperDetector
());
54
m_Detector
->
OverlapCheck
(
CheckOverlap
());
55
56
std::set<std::string> nodes;
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"
)
75
{
76
detector_suffix =
Name
();
77
}
78
79
m_HitNodeName
=
"G4HIT_"
+ detector_suffix;
80
nodes.insert(
m_HitNodeName
);
81
m_SupportNodeName
=
"G4HIT_SUPPORT_"
+ detector_suffix;
82
if
(
GetParams
()->
get_int_param
(
"supportactive"
))
83
{
84
nodes.insert(
m_SupportNodeName
);
85
}
86
for
(
auto
nodename : nodes)
87
{
88
PHG4HitContainer
*g4_hits = findNode::getClass<PHG4HitContainer>(topNode, nodename);
89
if
(!g4_hits)
90
{
91
g4_hits =
new
PHG4HitContainer
(nodename);
92
DetNode->
addNode
(
new
PHIODataNode<PHObject>
(g4_hits, nodename,
"PHObject"
));
93
}
94
}
95
// create stepping action
96
m_SteppingAction
=
new
PHG4BbcSteppingAction
(
m_Detector
,
GetParams
());
97
m_SteppingAction
->
SetHitNodeName
(
"G4HIT"
,
m_HitNodeName
);
98
m_SteppingAction
->
SetHitNodeName
(
"G4HIT_SUPPORT"
,
m_SupportNodeName
);
99
}
100
else
if
(
GetParams
()->
get_int_param
(
"blackhole"
))
101
{
102
m_SteppingAction
=
new
PHG4BbcSteppingAction
(
m_Detector
,
GetParams
());
103
}
104
105
return
0;
106
}
107
108
//_______________________________________________________________________
109
int
PHG4BbcSubsystem::process_event
(
PHCompositeNode
*topNode)
110
{
111
// pass top node to stepping action so that it gets
112
// relevant nodes needed internally
113
if
(
m_SteppingAction
)
114
{
115
m_SteppingAction
->
SetInterfacePointers
(topNode);
116
}
117
return
0;
118
}
119
120
void
PHG4BbcSubsystem::Print
(
const
std::string &what)
const
121
{
122
std::cout <<
Name
() <<
" Parameters: "
<< std::endl;
123
GetParams
()->
Print
();
124
if
(
m_Detector
)
125
{
126
m_Detector
->
Print
(what);
127
}
128
if
(
m_SteppingAction
)
129
{
130
m_SteppingAction
->
Print
(what);
131
}
132
return
;
133
}
134
135
//_______________________________________________________________________
136
PHG4Detector
*
PHG4BbcSubsystem::GetDetector
(
void
)
const
137
{
138
return
m_Detector
;
139
}
140
141
void
PHG4BbcSubsystem::SetDefaultParameters
()
142
{
143
// geometry version number
144
// we use negative numbers until the "official" version
145
// when we build the detector
146
// set_default_int_param("geometry_version",-1);
147
}
coresoftware
blob
master
simulation
g4simulation
g4detectors
PHG4BbcSubsystem.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:40
using
1.8.2 with
ECCE GitHub integration