Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
PHG4Prototype2OuterHcalSubsystem.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file PHG4Prototype2OuterHcalSubsystem.cc
1
#include "
PHG4Prototype2OuterHcalSubsystem.h
"
2
#include "
PHG4Prototype2OuterHcalDetector.h
"
3
#include "
PHG4Prototype2OuterHcalSteppingAction.h
"
4
#include "
PHG4PrototypeHcalDefs.h
"
5
6
#include <phparameter/PHParameters.h>
7
8
#include <
g4detectors/PHG4DetectorSubsystem.h
>
// for PHG4DetectorSubsy...
9
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
20
#include <boost/foreach.hpp>
21
22
#include <cmath>
// for NAN
23
#include <iostream>
// for operator<<, basic...
24
#include <set>
25
#include <sstream>
26
27
class
PHG4Detector
;
28
29
using namespace
std;
30
31
//_______________________________________________________________________
32
PHG4Prototype2OuterHcalSubsystem::PHG4Prototype2OuterHcalSubsystem
(
const
std::string
&
name
,
const
int
lyr)
33
:
PHG4DetectorSubsystem
(name, lyr)
34
, m_Detector(nullptr)
35
, m_SteppingAction(nullptr)
36
{
37
InitializeParameters
();
38
}
39
40
//_______________________________________________________________________
41
int
PHG4Prototype2OuterHcalSubsystem::InitRunSubsystem
(
PHCompositeNode
*
topNode
)
42
{
43
PHNodeIterator
iter(topNode);
44
PHCompositeNode
*dstNode =
dynamic_cast<
PHCompositeNode
*
>
(iter.
findFirst
(
"PHCompositeNode"
,
"DST"
));
45
46
// create detector
47
m_Detector
=
new
PHG4Prototype2OuterHcalDetector
(
this
, topNode,
GetParams
(),
Name
());
48
m_Detector
->
SuperDetector
(
SuperDetector
());
49
m_Detector
->
OverlapCheck
(
CheckOverlap
());
50
set<string> nodes;
51
if
(
GetParams
()->
get_int_param
(
"active"
))
52
{
53
PHNodeIterator
dstiter(dstNode);
54
PHCompositeNode
*DetNode =
dynamic_cast<
PHCompositeNode
*
>
(dstiter.
findFirst
(
"PHCompositeNode"
,
SuperDetector
()));
55
if
(!DetNode)
56
{
57
DetNode =
new
PHCompositeNode
(
SuperDetector
());
58
dstNode->
addNode
(DetNode);
59
}
60
61
ostringstream nodename;
62
if
(
SuperDetector
() !=
"NONE"
)
63
{
64
nodename <<
"G4HIT_"
<<
SuperDetector
();
65
}
66
else
67
{
68
nodename <<
"G4HIT_"
<<
Name
();
69
}
70
nodes.insert(nodename.str());
71
if
(
GetParams
()->
get_int_param
(
"absorberactive"
))
72
{
73
nodename.str(
""
);
74
if
(
SuperDetector
() !=
"NONE"
)
75
{
76
nodename <<
"G4HIT_ABSORBER_"
<<
SuperDetector
();
77
}
78
else
79
{
80
nodename <<
"G4HIT_ABSORBER_"
<<
Name
();
81
}
82
nodes.insert(nodename.str());
83
}
84
BOOST_FOREACH (
string
node
, nodes)
85
{
86
PHG4HitContainer
*g4_hits = findNode::getClass<PHG4HitContainer>(
topNode
, node.c_str());
87
if
(!g4_hits)
88
{
89
g4_hits =
new
PHG4HitContainer
(node);
90
DetNode->
addNode
(
new
PHIODataNode<PHObject>
(g4_hits, node.c_str(),
"PHObject"
));
91
}
92
}
93
94
// create stepping action
95
m_SteppingAction
=
new
PHG4Prototype2OuterHcalSteppingAction
(
m_Detector
,
GetParams
());
96
}
97
else
98
{
99
// if this is a black hole it does not have to be active
100
if
(
GetParams
()->
get_int_param
(
"blackhole"
))
101
{
102
m_SteppingAction
=
new
PHG4Prototype2OuterHcalSteppingAction
(
m_Detector
,
GetParams
());
103
}
104
}
105
return
0;
106
}
107
108
//_______________________________________________________________________
109
int
PHG4Prototype2OuterHcalSubsystem::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
PHG4Prototype2OuterHcalSubsystem::Print
(
const
string
&what)
const
121
{
122
cout <<
Name
() <<
" Parameters: "
<< endl;
123
GetParams
()->
Print
();
124
if
(
m_Detector
)
125
{
126
m_Detector
->
Print
(what);
127
}
128
return
;
129
}
130
131
//_______________________________________________________________________
132
PHG4Detector
*
PHG4Prototype2OuterHcalSubsystem::GetDetector
(
void
)
const
133
{
134
return
m_Detector
;
135
}
136
137
void
PHG4Prototype2OuterHcalSubsystem::SetDefaultParameters
()
138
{
139
// all in cm
140
set_default_double_param
(
"light_balance_inner_corr"
, NAN);
141
set_default_double_param
(
"light_balance_inner_radius"
, NAN);
142
set_default_double_param
(
"light_balance_outer_corr"
, NAN);
143
set_default_double_param
(
"light_balance_outer_radius"
, NAN);
144
set_default_double_param
(
"place_x"
, 0.);
145
set_default_double_param
(
"place_y"
, 0.);
146
set_default_double_param
(
"place_z"
, 0.);
147
set_default_double_param
(
"rot_x"
, 0.);
148
set_default_double_param
(
"rot_y"
, 0.);
149
set_default_double_param
(
"rot_z"
, 0.);
150
set_default_double_param
(
"steplimits"
, NAN);
151
152
set_default_int_param
(
"hi_eta"
, 0);
153
set_default_int_param
(
"light_scint_model"
, 1);
154
set_default_int_param
(
PHG4PrototypeHcalDefs::scipertwr
, 5);
155
156
set_default_string_param
(
"material"
,
"SS310"
);
157
}
158
159
void
PHG4Prototype2OuterHcalSubsystem::SetLightCorrection
(
const
double
inner_radius
,
const
double
inner_corr,
const
double
outer_radius
,
const
double
outer_corr)
160
{
161
set_double_param
(
"light_balance_inner_corr"
, inner_corr);
162
set_double_param
(
"light_balance_inner_radius"
, inner_radius);
163
set_double_param
(
"light_balance_outer_corr"
, outer_corr);
164
set_double_param
(
"light_balance_outer_radius"
, outer_radius);
165
return
;
166
}
prototype
blob
master
simulation
g4simulation
g4caloprototype
PHG4Prototype2OuterHcalSubsystem.cc
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:18:29
using
1.8.2 with
sPHENIX GitHub integration