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
EICG4B0Subsystem.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file EICG4B0Subsystem.cc
1
//____________________________________________________________________________..
2
//
3
// This is the interface to the framework. You only need to define the parameters
4
// you use for your detector in the SetDefaultParameters() method here
5
// The place to do this is marked by //implement your own here//
6
// The parameters have no units, they need to be converted in the
7
// EICG4B0Detector::ConstructMe() method
8
// but the convention is as mentioned cm and deg
9
//____________________________________________________________________________..
10
//
11
#include "
EICG4B0Subsystem.h
"
12
13
#include "
EICG4B0Detector.h
"
14
#include "
EICG4B0SteppingAction.h
"
15
16
#include <phparameter/PHParameters.h>
17
18
#include <
g4main/PHG4HitContainer.h
>
19
#include <
g4main/PHG4SteppingAction.h
>
20
21
#include <
phool/PHCompositeNode.h
>
22
#include <
phool/PHIODataNode.h
>
23
#include <
phool/PHNode.h
>
24
#include <
phool/PHNodeIterator.h
>
25
#include <
phool/PHObject.h
>
26
#include <
phool/getClass.h
>
27
28
//_______________________________________________________________________
29
EICG4B0Subsystem::EICG4B0Subsystem
(
const
std::string &
name
,
const
int
lyr)
30
:
PHG4DetectorSubsystem
(name, lyr)
31
, m_Detector(nullptr)
32
, m_SteppingAction(nullptr)
33
, mappingfile_(
""
)
34
{
35
// call base class method which will set up parameter infrastructure
36
// and call our SetDefaultParameters() method
37
InitializeParameters
();
38
}
39
//_______________________________________________________________________
40
int
EICG4B0Subsystem::InitRunSubsystem
(
PHCompositeNode
*topNode)
41
{
42
// create detector
43
m_Detector
=
new
EICG4B0Detector
(
this
, topNode,
GetParams
(),
Name
(),
GetLayer
());
44
m_Detector
->
SuperDetector
(
SuperDetector
());
45
m_Detector
->
OverlapCheck
(
CheckOverlap
());
46
47
if
(
GetParams
()->
get_int_param
(
"active"
))
48
{
49
PHNodeIterator
iter(topNode);
50
PHCompositeNode
*dstNode =
dynamic_cast<
PHCompositeNode
*
>
(iter.
findFirst
(
"PHCompositeNode"
,
"DST"
));
51
52
std::string nodename;
53
54
if
(
SuperDetector
() !=
"NONE"
)
55
{
56
// create super detector subnodes
57
PHNodeIterator
iter_dst(dstNode);
58
PHCompositeNode
*superSubNode =
dynamic_cast<
PHCompositeNode
*
>
(iter_dst.
findFirst
(
"PHCompositeNode"
,
SuperDetector
()));
59
if
(!superSubNode)
60
{
61
superSubNode =
new
PHCompositeNode
(
SuperDetector
());
62
dstNode->
addNode
(superSubNode);
63
}
64
dstNode = superSubNode;
65
66
nodename =
"G4HIT_"
+
SuperDetector
();
67
}
68
69
else
70
{
71
nodename =
"G4HIT_"
+
Name
();
72
}
73
PHG4HitContainer
*b0_hits = findNode::getClass<PHG4HitContainer>(topNode, nodename);
74
if
(!b0_hits)
75
{
76
dstNode->
addNode
(
new
PHIODataNode<PHObject>
(b0_hits =
new
PHG4HitContainer
(nodename), nodename,
"PHObject"
));
77
}
78
b0_hits->
AddLayer
(
GetLayer
());
79
auto
*
tmp
=
new
EICG4B0SteppingAction
(
this
,
m_Detector
,
GetParams
());
80
tmp
->HitNodeName(nodename);
81
m_SteppingAction
=
tmp
;
82
}
83
else
if
(
GetParams
()->
get_int_param
(
"blackhole"
))
84
{
85
m_SteppingAction
=
new
EICG4B0SteppingAction
(
this
,
m_Detector
,
GetParams
());
86
}
87
if
(
m_SteppingAction
)
88
{
89
(
dynamic_cast<
EICG4B0SteppingAction
*
>
(
m_SteppingAction
))->SaveAllHits(
m_SaveAllHitsFlag
);
90
}
91
return
0;
92
}
93
//_______________________________________________________________________
94
int
EICG4B0Subsystem::process_event
(
PHCompositeNode
*topNode)
95
{
96
// pass top node to stepping action so that it gets
97
// relevant nodes needed internally
98
if
(
m_SteppingAction
)
99
{
100
m_SteppingAction
->
SetInterfacePointers
(topNode);
101
}
102
return
0;
103
}
104
//_______________________________________________________________________
105
void
EICG4B0Subsystem::Print
(
const
std::string &what)
const
106
{
107
if
(
m_Detector
)
108
{
109
m_Detector
->
Print
(what);
110
}
111
return
;
112
}
113
114
//_______________________________________________________________________
115
PHG4Detector
*
EICG4B0Subsystem::GetDetector
(
void
)
const
116
{
117
return
m_Detector
;
118
}
119
120
//_______________________________________________________________________
121
void
EICG4B0Subsystem::SetDefaultParameters
()
122
{
123
// sizes are in cm
124
// angles are in deg
125
// units should be converted to G4 units when used
126
//implement your own here//
127
set_default_double_param
(
"place_x"
, 0.);
//subdetector position
128
set_default_double_param
(
"place_y"
, 0.);
//subdetector position
129
set_default_double_param
(
"place_z"
, 0.);
//subdetector position
130
set_default_double_param
(
"pipe_ir"
, 2.8);
//beam pipe inner radius (for future implementation)
131
set_default_double_param
(
"pipe_or"
, 3.05);
//beam pipe outer raidus (for future implementation)
132
set_default_double_param
(
"pipe_x"
, -.75);
//beam pipe position
133
set_default_double_param
(
"pipe_y"
, 0.);
//beam pipe position
134
set_default_double_param
(
"pipe_z"
, 0.);
//beam pipe position
135
set_default_double_param
(
"pipe_hole_r"
, 3.5);
//beam pipe cut off radius in the detector volume
136
set_default_double_param
(
"pipe_hole"
, 1.0);
//beam pipe cut off rectangle in the detector volume
137
set_default_double_param
(
"cable_hole"
, 2.0);
//beam pipe cut off radius in the detector volume
138
set_default_double_param
(
"cable_x"
, -17.0);
//cable hole position
139
set_default_double_param
(
"cable_y"
, 0.);
// position
140
set_default_double_param
(
"cable_z"
, 0.);
// position
141
set_default_double_param
(
"rot_y"
, 0.);
//subdetector rotation
142
set_default_double_param
(
"outer_radius"
, 2.);
//detector outer radiues
143
set_default_double_param
(
"d_radius"
, 7.);
//packman cutoff size
144
set_default_double_param
(
"length"
, 10.);
//detector length
145
set_default_double_param
(
"startAngle"
, 0.);
//start Angle for packman cutoff
146
set_default_double_param
(
"spanningAngle"
, 360.);
//spanning Angle of the detector (for packman cutoff)
147
set_default_double_param
(
"detid"
, 0.);
//detector id
148
set_default_int_param
(
"ispipe"
, 0);
//pipe or detector (for future implementation)
149
set_default_int_param
(
"lightyield"
, 0);
150
set_default_int_param
(
"use_g4steps"
, 0);
151
set_default_double_param
(
"tower_size"
, 2.);
152
set_default_double_param
(
"readout_size"
, 2.);
153
set_default_double_param
(
"tmin"
, NAN);
154
set_default_double_param
(
"tmax"
, NAN);
155
set_default_string_param
(
"material"
,
"G4_PbWO4"
);
//detector material
156
}
157
158
void
EICG4B0Subsystem::SetTowerMappingFile
(
const
std::string &
filename
)
159
{
160
mappingfile_
=
filename
;
161
}
fun4all_eicdetectors
blob
master
simulation
g4simulation
g4b0
EICG4B0Subsystem.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:46
using
1.8.2 with
ECCE GitHub integration