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
G4EicDircSubsystem.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4EicDircSubsystem.cc
1
#include "
G4EicDircSubsystem.h
"
2
3
#include "
G4EicDircDetector.h
"
4
#include "
G4EicDircDisplayAction.h
"
5
#include "
G4EicDircOpBoundaryProcess.h
"
6
#include "
G4EicDircStackingAction.h
"
7
#include "
G4EicDircSteppingAction.h
"
8
9
#include <phparameter/PHParameters.h>
10
11
#include <
g4main/PHG4HitContainer.h
>
12
#include <
g4main/PHG4StackingAction.h
>
// for PHG4StackingAction
13
#include <
g4main/PHG4SteppingAction.h
>
// for PHG4SteppingAction
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 <Geant4/G4ParticleTable.hh>
23
#include <Geant4/G4ProcessManager.hh>
24
#include <Geant4/G4SystemOfUnits.hh>
25
#include <Geant4/G4ios.hh>
26
27
#include <cmath>
// for isfinite
28
29
//_______________________________________________________________________
30
G4EicDircSubsystem::G4EicDircSubsystem
(
const
std::string &
name
)
31
:
PHG4DetectorSubsystem
(name)
32
, m_Detector(nullptr)
33
, m_SteppingAction(nullptr)
34
, m_DisplayAction(nullptr)
35
{
36
// call base class method which will set up parameter infrastructure
37
// and call our SetDefaultParameters() method
38
InitializeParameters
();
39
}
40
41
//_______________________________________________________________________
42
G4EicDircSubsystem::~G4EicDircSubsystem
()
43
{
44
delete
m_DisplayAction
;
45
}
46
47
//_______________________________________________________________________
48
int
G4EicDircSubsystem::InitRunSubsystem
(
PHCompositeNode
*topNode)
49
{
50
PHNodeIterator
iter(topNode);
51
PHCompositeNode
*dstNode =
dynamic_cast<
PHCompositeNode
*
>
(iter.
findFirst
(
"PHCompositeNode"
,
"DST"
));
52
//DircBoundary = new G4EicDircOpBoundaryProcess();
53
// G4EicDircDisplayAction *disp_action = new G4EicDircDisplayAction(Name(), GetParams());
54
// if (isfinite(m_ColorArray[0]) &&
55
// isfinite(m_ColorArray[1]) &&
56
// isfinite(m_ColorArray[2]) &&
57
// isfinite(m_ColorArray[3]))
58
// {
59
// disp_action->SetColor(m_ColorArray[0], m_ColorArray[1], m_ColorArray[2], m_ColorArray[3]);
60
// }
61
// m_DisplayAction = disp_action;
62
m_DisplayAction
=
new
G4EicDircDisplayAction
(
Name
(),
GetParams
());
63
// create detector
64
m_Detector
=
new
G4EicDircDetector
(
this
, topNode,
GetParams
(),
Name
());
65
m_Detector
->
SuperDetector
(
SuperDetector
());
66
m_Detector
->
OverlapCheck
(
CheckOverlap
());
67
m_Detector
->
Verbosity
(
Verbosity
());
68
69
std::string detector_suffix =
SuperDetector
();
70
if
(detector_suffix ==
"NONE"
)
71
{
72
detector_suffix =
SuperDetector
();
73
}
74
75
std::set<std::string> nodes;
76
if
(
GetParams
()->
get_int_param
(
"active"
))
77
{
78
PHNodeIterator
dstIter(dstNode);
79
PHCompositeNode
*DetNode = dstNode;
80
if
(
SuperDetector
() !=
"NONE"
)
81
{
82
DetNode =
dynamic_cast<
PHCompositeNode
*
>
(dstIter.
findFirst
(
"PHCompositeNode"
,
SuperDetector
()));
83
if
(!DetNode)
84
{
85
DetNode =
new
PHCompositeNode
(
SuperDetector
());
86
dstNode->
addNode
(DetNode);
87
}
88
}
89
m_HitNodeName
=
"G4HIT_"
+ detector_suffix;
90
nodes.insert(
m_HitNodeName
);
91
m_AbsorberNodeName
=
"G4HIT_ABSORBER_"
+ detector_suffix;
92
if
(
GetParams
()->
get_int_param
(
"absorberactive"
))
93
{
94
nodes.insert(
m_AbsorberNodeName
);
95
}
96
m_SupportNodeName
=
"G4HIT_SUPPORT_"
+ detector_suffix;
97
if
(
GetParams
()->
get_int_param
(
"supportactive"
))
98
{
99
nodes.insert(
m_SupportNodeName
);
100
}
101
for
(
auto
thisnode : nodes)
102
{
103
PHG4HitContainer
*g4_hits = findNode::getClass<PHG4HitContainer>(topNode, thisnode);
104
if
(!g4_hits)
105
{
106
g4_hits =
new
PHG4HitContainer
(thisnode);
107
DetNode->
addNode
(
new
PHIODataNode<PHObject>
(g4_hits, thisnode,
"PHObject"
));
108
}
109
}
110
G4EicDircSteppingAction
*
tmp
=
new
G4EicDircSteppingAction
(
m_Detector
,
GetParams
());
111
tmp->
SetHitNodeName
(
m_HitNodeName
);
112
tmp->
SetAbsorberNodeName
(
m_AbsorberNodeName
);
113
tmp->
SetSupportNodeName
(
m_SupportNodeName
);
114
m_SteppingAction
=
tmp
;
115
}
116
m_StackingAction
=
new
G4EicDircStackingAction
(
m_Detector
);
117
m_StackingAction
->
Verbosity
(
Verbosity
());
118
119
return
0;
120
}
121
122
/*void G4EicDircSubsystem::AddProcesses(G4ParticleDefinition *particle)
123
{
124
G4ProcessManager* pmanager = particle->GetProcessManager();
125
if (DircBoundary->IsApplicable(*particle))
126
{
127
pmanager->AddDiscreteProcess(DircBoundary);
128
pmanager->SetProcessOrderingToFirst(DircBoundary, idxPostStep);
129
130
G4cout << "dirc boundary process index = " << pmanager->GetProcessIndex(DircBoundary) << G4endl;
131
G4cout << "dirc boundary process ordering = " << pmanager->GetProcessOrdering(DircBoundary, idxPostStep) << G4endl;
132
}
133
}*/
134
135
//_______________________________________________________________________
136
int
G4EicDircSubsystem::process_event
(
PHCompositeNode
*topNode)
137
{
138
// pass top node to stepping action so that it gets
139
// relevant nodes needed internally
140
if
(
m_SteppingAction
)
141
{
142
m_SteppingAction
->
SetInterfacePointers
(topNode);
143
}
144
return
0;
145
}
146
147
void
G4EicDircSubsystem::Print
(
const
std::string &what)
const
148
{
149
if
(
m_Detector
)
150
{
151
m_Detector
->
Print
(what);
152
}
153
return
;
154
}
155
156
//_______________________________________________________________________
157
PHG4Detector
*
G4EicDircSubsystem::GetDetector
(
void
)
const
158
{
159
return
m_Detector
;
160
}
161
162
void
G4EicDircSubsystem::SetDefaultParameters
()
163
{
164
// sizes are in cm
165
// angles are in deg
166
// units will be converted to G4 units when used
167
set_default_double_param
(
"place_x"
, 0.);
168
set_default_double_param
(
"place_y"
, 0.);
169
set_default_double_param
(
"place_z"
, 0.);
170
set_default_double_param
(
"rot_x"
, 0.);
171
set_default_double_param
(
"rot_y"
, 0.);
172
set_default_double_param
(
"rot_z"
, 0.);
173
set_default_double_param
(
"size_x"
, 20.);
174
set_default_double_param
(
"size_y"
, 20.);
175
set_default_double_param
(
"size_z"
, 20.);
176
177
set_default_double_param
(
"rMin"
, 74.1);
178
set_default_double_param
(
"rMin_inner"
, 60.0);
179
set_default_double_param
(
"length"
, 287 + 168);
180
181
set_default_double_param
(
"NBars"
, 11);
182
set_default_double_param
(
"Radius"
, 75.0 *
cm
);
183
set_default_double_param
(
"Prizm_width"
, 38.65 *
cm
);
184
set_default_double_param
(
"Prizm_length"
, 30.0 *
cm
);
185
set_default_double_param
(
"Prizm_height_at_lens"
, 5.0 *
cm
);
186
set_default_double_param
(
"Bar_thickness"
, 1.725 *
cm
);
187
set_default_double_param
(
"Bar_width"
, 3.5 *
cm
);
188
set_default_double_param
(
"BarL_length"
, 122.5 *
cm
);
189
set_default_double_param
(
"BarS_length"
, 56.0 *
cm
);
190
set_default_double_param
(
"Mirror_height"
, 2.0 *
cm
);
191
set_default_double_param
(
"z_shift"
, -43.75 *
cm
);
192
set_default_int_param
(
"Geom_type"
, 0);
// 0-whole DIRC, 1-one bar box
193
set_default_int_param
(
"Lens_id"
, 3);
// 3- 3-layer spherical lens
194
set_default_int_param
(
"MCP_rows"
, 6);
195
set_default_int_param
(
"MCP_columns"
, 4);
196
set_default_int_param
(
"NBoxes"
, 12);
197
set_default_int_param
(
"Bar_pieces"
, 4);
198
199
set_default_int_param
(
"disable_photon_sim"
, 0);
// if true, disable photon simulations
200
201
set_default_string_param
(
"material"
,
"G4_Galactic"
);
202
}
fun4all_eicdetectors
blob
master
simulation
g4simulation
g4eicdirc
G4EicDircSubsystem.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:47
using
1.8.2 with
ECCE GitHub integration