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
PHG4ForwardDualReadoutSubsystem.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file PHG4ForwardDualReadoutSubsystem.cc
1
#include "
PHG4ForwardDualReadoutSubsystem.h
"
2
#include "
PHG4ForwardDualReadoutDetector.h
"
3
#include "
PHG4ForwardDualReadoutDisplayAction.h
"
4
#include "
PHG4ForwardDualReadoutSteppingAction.h
"
5
6
#include <
g4main/PHG4DisplayAction.h
>
// for PHG4DisplayAction
7
#include <
g4main/PHG4HitContainer.h
>
8
#include <
g4main/PHG4SteppingAction.h
>
// for PHG4SteppingAction
9
#include <
g4main/PHG4Subsystem.h
>
// for PHG4Subsystem
10
#include <
g4main/PHG4Utils.h
>
11
12
#include <
phool/PHCompositeNode.h
>
13
#include <
phool/PHIODataNode.h
>
// for PHIODataNode
14
#include <
phool/PHNode.h
>
// for PHNode
15
#include <
phool/PHNodeIterator.h
>
// for PHNodeIterator
16
#include <
phool/PHObject.h
>
// for PHObject
17
#include <
phool/getClass.h
>
18
19
#include <set>
// for set
20
#include <sstream>
21
22
class
PHG4Detector
;
23
24
using namespace
std;
25
26
//_______________________________________________________________________
27
PHG4ForwardDualReadoutSubsystem::PHG4ForwardDualReadoutSubsystem
(
const
std::string&
name
,
const
int
lyr)
28
:
PHG4DetectorSubsystem
(name)
29
, m_Detector(nullptr)
30
, m_SteppingAction(nullptr)
31
, m_DisplayAction(nullptr)
32
,
active
(1)
33
, absorber_active(0)
34
, blackhole(0)
35
, detector_type(name)
36
, mappingfile_(
""
)
37
{
38
}
39
40
//_______________________________________________________________________
41
PHG4ForwardDualReadoutSubsystem::~PHG4ForwardDualReadoutSubsystem
()
42
{
43
delete
m_DisplayAction
;
44
}
45
46
//_______________________________________________________________________
47
int
PHG4ForwardDualReadoutSubsystem::InitRunSubsystem
(
PHCompositeNode
*
topNode
)
48
{
49
PHNodeIterator
iter(topNode);
50
PHCompositeNode
* dstNode =
dynamic_cast<
PHCompositeNode
*
>
(iter.
findFirst
(
"PHCompositeNode"
,
"DST"
));
51
52
// create display settings before detector
53
m_DisplayAction
=
new
PHG4ForwardDualReadoutDisplayAction
(
Name
());
54
// create detector
55
m_Detector
=
new
PHG4ForwardDualReadoutDetector
(
this
, topNode,
Name
());
56
m_Detector
->
SetActive
(
active
);
57
m_Detector
->
SetAbsorberActive
(
absorber_active
);
58
m_Detector
->
BlackHole
(
blackhole
);
59
m_Detector
->
OverlapCheck
(
CheckOverlap
());
60
m_Detector
->
Verbosity
(
Verbosity
());
61
m_Detector
->
SetTowerMappingFile
(
mappingfile_
);
62
m_Detector
->
SuperDetector
(
SuperDetector
());
63
64
65
66
67
68
std::set<std::string> nodes;
69
if
(
active
)
70
{
71
PHNodeIterator
dstIter(dstNode);
72
PHCompositeNode
* DetNode = dstNode;
73
if
(
SuperDetector
() !=
"NONE"
)
74
{
75
DetNode =
dynamic_cast<
PHCompositeNode
*
>
(dstIter.
findFirst
(
"PHCompositeNode"
,
SuperDetector
()));
76
if
(!DetNode)
77
{
78
DetNode =
new
PHCompositeNode
(
SuperDetector
());
79
dstNode->
addNode
(DetNode);
80
}
81
}
82
// create hit output node
83
std::string nodename;
84
if
(
SuperDetector
() !=
"NONE"
)
85
{
86
nodename =
"G4HIT_"
+
SuperDetector
();
87
}
88
else
89
{
90
nodename =
"G4HIT_"
+
Name
();
91
}
92
nodes.insert(nodename);
93
if
(
absorber_active
)
94
{
95
if
(
SuperDetector
() !=
"NONE"
)
96
{
97
nodename =
"G4HIT_ABSORBER_"
+
SuperDetector
();
98
}
99
else
100
{
101
nodename =
"G4HIT_ABSORBER_"
+
Name
();
102
}
103
nodes.insert(nodename);
104
}
105
for
(
auto
thisnode : nodes)
106
{
107
PHG4HitContainer
* g4_hits = findNode::getClass<PHG4HitContainer>(
topNode
, thisnode);
108
if
(!g4_hits)
109
{
110
g4_hits =
new
PHG4HitContainer
(thisnode);
111
DetNode->
addNode
(
new
PHIODataNode<PHObject>
(g4_hits, thisnode,
"PHObject"
));
112
}
113
}
114
// create stepping action
115
m_SteppingAction
=
new
PHG4ForwardDualReadoutSteppingAction
(
m_Detector
,
absorber_active
);
116
m_Detector
->
SetSteppingAction
(dynamic_cast<PHG4ForwardDualReadoutSteppingAction*>(
m_SteppingAction
));
117
}
118
119
return
0;
120
}
121
122
//_______________________________________________________________________
123
int
PHG4ForwardDualReadoutSubsystem::process_event
(
PHCompositeNode
*
topNode
)
124
{
125
// pass top node to stepping action so that it gets
126
// relevant nodes needed internally
127
if
(
m_SteppingAction
)
128
{
129
m_SteppingAction
->
SetInterfacePointers
(topNode);
130
}
131
return
0;
132
}
133
134
//_______________________________________________________________________
135
PHG4Detector
*
PHG4ForwardDualReadoutSubsystem::GetDetector
()
const
136
{
137
return
m_Detector
;
138
}
139
140
141
void
PHG4ForwardDualReadoutSubsystem::SetDefaultParameters
()
142
{
143
set_default_double_param
(
"place_x"
, 0.);
144
set_default_double_param
(
"place_y"
, 0.);
145
set_default_double_param
(
"place_z"
, 375.);
146
set_default_double_param
(
"tower_dx"
, 0.3);
147
set_default_double_param
(
"tower_dy"
, 0.3);
148
set_default_double_param
(
"tower_dz"
, 150.);
149
set_default_double_param
(
"dz"
, 150.);
150
set_default_double_param
(
"rMin1"
, 20.);
151
set_default_double_param
(
"rMax1"
, 220.);
152
set_default_double_param
(
"rMin2"
, 20.);
153
set_default_double_param
(
"rMax2"
, 220.);
154
// set_default_double_param("wls_dw", 0.3);
155
// set_default_double_param("support_dw", 0.2);
156
set_default_double_param
(
"rot_x"
, 0.);
157
set_default_double_param
(
"rot_y"
, 0.);
158
set_default_double_param
(
"rot_z"
, 0.);
159
// set_default_double_param("thickness_absorber", 2.);
160
// set_default_double_param("thickness_scintillator", 0.231);
161
// set_default_string_param("scintillator", "G4_POLYSTYRENE");
162
// set_default_string_param("absorber", "G4_Fe");
163
// set_default_string_param("support", "G4_Fe");
164
return
;
165
}
166
167
168
void
PHG4ForwardDualReadoutSubsystem::SetTowerMappingFile
(
const
std::string&
filename
)
169
{
170
// set_string_param("mapping_file", filename);
171
// set_string_param("mapping_file_md5", PHG4Utils::md5sum(get_string_param("mapping_file")));
172
mappingfile_
=
filename
;
173
}
fun4all_eicdetectors
blob
master
simulation
g4simulation
g4drcalo
PHG4ForwardDualReadoutSubsystem.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:46
using
1.8.2 with
ECCE GitHub integration