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