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
PHG4CrystalCalorimeterSubsystem.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file PHG4CrystalCalorimeterSubsystem.cc
1
#include "
PHG4CrystalCalorimeterSubsystem.h
"
2
#include "
PHG4CrystalCalorimeterDetector.h
"
3
#include "
PHG4CrystalCalorimeterDisplayAction.h
"
4
#include "
PHG4CrystalCalorimeterSteppingAction.h
"
5
#include "
PHG4ProjCrystalCalorimeterDetector.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
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 <iostream>
// for operator<<, ostrin...
22
#include <sstream>
23
24
class
PHG4Detector
;
25
26
using namespace
std;
27
28
//_______________________________________________________________________
29
PHG4CrystalCalorimeterSubsystem::PHG4CrystalCalorimeterSubsystem
(
const
std::string&
name
,
const
int
lyr)
30
:
PHG4DetectorSubsystem
(name, lyr)
31
{
32
InitializeParameters
();
33
}
34
35
//_______________________________________________________________________
36
PHG4CrystalCalorimeterSubsystem::~PHG4CrystalCalorimeterSubsystem
()
37
{
38
delete
m_DisplayAction
;
39
}
40
41
//_______________________________________________________________________
42
int
PHG4CrystalCalorimeterSubsystem::InitRunSubsystem
(
PHCompositeNode
*
topNode
)
43
{
44
// create display settings before detector
45
m_DisplayAction
=
new
PHG4CrystalCalorimeterDisplayAction
(
Name
());
46
// create detector
47
if
(
get_int_param
(
"projective"
) == 1)
48
{
49
if
(
Verbosity
() > 1)
50
{
51
cout <<
"PHG4CrystalCalorimeterSubsystem::InitRun - use PHG4ProjCrystalCalorimeterDetector"
<< endl;
52
}
53
m_Detector
=
new
PHG4ProjCrystalCalorimeterDetector
(
this
, topNode,
GetParams
(),
Name
());
54
}
55
else
56
{
57
if
(
Verbosity
() > 1)
58
{
59
cout <<
"PHG4CrystalCalorimeterSubsystem::InitRun - use PHG4CrystalCalorimeterDetector"
<< endl;
60
}
61
m_Detector
=
new
PHG4CrystalCalorimeterDetector
(
this
, topNode,
GetParams
(),
Name
());
62
}
63
64
m_Detector
->
OverlapCheck
(
CheckOverlap
());
65
m_Detector
->
SuperDetector
(
SuperDetector
());
66
m_Detector
->
DetectorId
(
GetLayer
());
67
68
if
(
GetParams
()->
get_int_param
(
"active"
))
69
{
70
PHNodeIterator
iter(topNode);
71
PHCompositeNode
* dstNode =
dynamic_cast<
PHCompositeNode
*
>
(iter.
findFirst
(
"PHCompositeNode"
,
"DST"
));
72
73
// create hit output node
74
string
nodename =
"G4HIT_"
;
75
if
(
SuperDetector
() !=
"NONE"
)
76
{
77
PHNodeIterator
iter_dst(dstNode);
78
PHCompositeNode
* superSubNode =
dynamic_cast<
PHCompositeNode
*
>
(iter_dst.
findFirst
(
"PHCompositeNode"
,
SuperDetector
()));
79
if
(!superSubNode)
80
{
81
superSubNode =
new
PHCompositeNode
(
SuperDetector
());
82
dstNode->
addNode
(superSubNode);
83
}
84
dstNode = superSubNode;
85
nodename +=
SuperDetector
();
86
}
87
else
88
{
89
nodename +=
Name
();
90
}
91
92
PHG4HitContainer
* crystal_hits = findNode::getClass<PHG4HitContainer>(
topNode
, nodename);
93
if
(!crystal_hits)
94
{
95
crystal_hits =
new
PHG4HitContainer
(nodename);
96
PHIODataNode<PHObject>
* hitNode =
new
PHIODataNode<PHObject>
(crystal_hits, nodename,
"PHObject"
);
97
dstNode->
addNode
(hitNode);
98
}
99
100
if
(
GetParams
()->
get_int_param
(
"absorberactive"
))
101
{
102
string
absnodename =
"G4HIT_ABSORBER_"
;
103
if
(
SuperDetector
() !=
"NONE"
)
104
{
105
absnodename +=
SuperDetector
();
106
}
107
else
108
{
109
absnodename +=
Name
();
110
}
111
112
PHG4HitContainer
* absorber_hits = findNode::getClass<PHG4HitContainer>(
topNode
, absnodename);
113
if
(!absorber_hits)
114
{
115
absorber_hits =
new
PHG4HitContainer
(absnodename);
116
PHIODataNode<PHObject>
* abshitNode =
new
PHIODataNode<PHObject>
(absorber_hits, absnodename,
"PHObject"
);
117
dstNode->
addNode
(abshitNode);
118
}
119
}
120
// create stepping action
121
m_SteppingAction
=
new
PHG4CrystalCalorimeterSteppingAction
(
m_Detector
,
GetParams
());
122
}
123
return
0;
124
}
125
126
//_______________________________________________________________________
127
int
PHG4CrystalCalorimeterSubsystem::process_event
(
PHCompositeNode
*
topNode
)
128
{
129
// pass top node to stepping action so that it gets
130
// relevant nodes needed internally
131
if
(
m_SteppingAction
)
132
{
133
m_SteppingAction
->
SetInterfacePointers
(topNode);
134
}
135
return
0;
136
}
137
138
//_______________________________________________________________________
139
PHG4Detector
*
PHG4CrystalCalorimeterSubsystem::GetDetector
(
void
)
const
140
{
141
return
m_Detector
;
142
}
143
144
void
PHG4CrystalCalorimeterSubsystem::SetDefaultParameters
()
145
{
146
// values in cm and degrees
147
set_default_int_param
(
"projective"
, 0);
148
149
set_default_double_param
(
"crystal_dx"
, 2.);
150
set_default_double_param
(
"crystal_dy"
, 2.);
151
set_default_double_param
(
"crystal_dz"
, 18.);
152
set_default_double_param
(
"dz"
, 18.);
153
set_default_double_param
(
"place_x"
, 0.);
154
set_default_double_param
(
"place_y"
, 0.);
155
set_default_double_param
(
"place_z"
, -108.);
156
set_default_double_param
(
"rMin1"
, 2.2);
157
set_default_double_param
(
"rMax1"
, 65.6);
158
set_default_double_param
(
"rMin2"
, 2.6);
159
set_default_double_param
(
"rMax2"
, 77.5);
160
set_default_double_param
(
"rot_x"
, 0.);
161
set_default_double_param
(
"rot_y"
, 180.);
162
set_default_double_param
(
"rot_z"
, 0.);
163
164
set_default_string_param
(
"material"
,
"G4_PbWO4"
);
165
set_default_string_param
(
"mappingtower"
,
""
);
166
set_default_string_param
(
"mapping4x4"
,
""
);
167
return
;
168
}
169
170
void
PHG4CrystalCalorimeterSubsystem::SetTowerMappingFile
(
const
std::string&
filename
)
171
{
172
set_string_param
(
"mappingtower"
, filename);
173
}
174
175
void
PHG4CrystalCalorimeterSubsystem::SetProjectiveGeometry
(
const
std::string& filename1,
const
std::string& filename2)
176
{
177
set_string_param
(
"mappingtower"
, filename1);
178
set_string_param
(
"mapping4x4"
, filename2);
179
set_int_param
(
"projective"
, 1);
180
}
fun4all_eicdetectors
blob
master
simulation
g4simulation
g4eiccalos
PHG4CrystalCalorimeterSubsystem.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:47
using
1.8.2 with
ECCE GitHub integration