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