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
PHG4SpacalPrototype4Subsystem.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file PHG4SpacalPrototype4Subsystem.cc
1
#include "
PHG4SpacalPrototype4Subsystem.h
"
2
3
#include "
PHG4SpacalPrototype4Detector.h
"
4
#include "
PHG4SpacalPrototype4SteppingAction.h
"
5
6
#include <phparameter/PHParameters.h>
7
8
#include <
g4main/PHG4HitContainer.h
>
9
#include <
g4main/PHG4SteppingAction.h
>
// for PHG4SteppingAction
10
11
#include <
phool/PHCompositeNode.h
>
12
#include <
phool/PHIODataNode.h
>
// for PHIODataNode
13
#include <
phool/PHNode.h
>
// for PHNode
14
#include <
phool/PHNodeIterator.h
>
// for PHNodeIterator
15
#include <
phool/PHObject.h
>
// for PHObject
16
#include <
phool/getClass.h
>
17
18
#include <iostream>
// for operator<<, basic_ost...
19
#include <sstream>
20
21
class
PHG4Detector
;
22
23
using namespace
std;
24
25
//_______________________________________________________________________
26
PHG4SpacalPrototype4Subsystem::PHG4SpacalPrototype4Subsystem
(
const
std::string
& na)
27
:
PHG4DetectorSubsystem
(na, 0)
28
, detector_(nullptr)
29
, steppingAction_(nullptr)
30
{
31
InitializeParameters
();
32
}
33
34
//_______________________________________________________________________
35
int
PHG4SpacalPrototype4Subsystem::InitRunSubsystem
(
PHCompositeNode
*
topNode
)
36
{
37
PHNodeIterator
iter(topNode);
38
PHCompositeNode
* dstNode =
dynamic_cast<
PHCompositeNode
*
>
(iter.
findFirst
(
"PHCompositeNode"
,
"DST"
));
39
40
if
(
Verbosity
() > 0)
41
cout
42
<<
"PHG4SpacalPrototype4Subsystem::InitRun - use PHG4SpacalPrototype4Detector"
43
<< endl;
44
detector_
=
new
PHG4SpacalPrototype4Detector
(
this
, topNode,
GetParams
(),
Name
());
45
46
detector_
->
SetActive
(
GetParams
()->
get_int_param
(
"active"
));
47
detector_
->
SetAbsorberActive
(
GetParams
()->
get_int_param
(
"absorberactive"
));
48
detector_
->
SuperDetector
(
SuperDetector
());
49
detector_
->
OverlapCheck
(
CheckOverlap
());
50
51
if
(
GetParams
()->
get_int_param
(
"active"
))
52
{
53
ostringstream nodename;
54
if
(
SuperDetector
() !=
"NONE"
)
55
{
56
nodename <<
"G4HIT_"
<<
SuperDetector
();
57
}
58
else
59
{
60
nodename <<
"G4HIT_"
<<
Name
();
61
}
62
PHG4HitContainer
* cylinder_hits = findNode::getClass<PHG4HitContainer>(
63
topNode
, nodename.str());
64
if
(!cylinder_hits)
65
{
66
dstNode->
addNode
(
67
new
PHIODataNode<PHObject>
(
68
cylinder_hits =
new
PHG4HitContainer
(nodename.str()),
69
nodename.str(),
"PHObject"
));
70
}
71
cylinder_hits->
AddLayer
(0);
72
if
(
GetParams
()->
get_int_param
(
"absorberactive"
))
73
{
74
nodename.str(
""
);
75
if
(
SuperDetector
() !=
"NONE"
)
76
{
77
nodename <<
"G4HIT_ABSORBER_"
<<
SuperDetector
();
78
}
79
else
80
{
81
nodename <<
"G4HIT_ABSORBER_"
<<
Name
();
82
}
83
PHG4HitContainer
* cylinder_hits =
84
findNode::getClass<PHG4HitContainer>(
topNode
, nodename.str());
85
if
(!cylinder_hits)
86
{
87
cylinder_hits =
new
PHG4HitContainer
(nodename.str());
88
dstNode->
addNode
(
new
PHIODataNode<PHObject>
(cylinder_hits, nodename.str(),
"PHObject"
));
89
}
90
cylinder_hits->
AddLayer
(0);
91
}
92
steppingAction_
=
new
PHG4SpacalPrototype4SteppingAction
(
detector_
);
93
steppingAction_
->
Verbosity
(
Verbosity
());
94
}
95
96
return
0;
97
}
98
99
//_______________________________________________________________________
100
int
PHG4SpacalPrototype4Subsystem::process_event
(
PHCompositeNode
*
topNode
)
101
{
102
// pass top node to stepping action so that it gets
103
// relevant nodes needed internally
104
if
(
steppingAction_
)
105
{
106
steppingAction_
->
SetInterfacePointers
(topNode);
107
}
108
return
0;
109
}
110
111
//_______________________________________________________________________
112
PHG4Detector
*
113
PHG4SpacalPrototype4Subsystem::GetDetector
(
void
)
const
114
{
115
return
detector_
;
116
}
117
118
void
PHG4SpacalPrototype4Subsystem::Print
(
const
std::string
& what)
const
119
{
120
detector_
->
Print
(what);
121
cout <<
Name
() <<
" Parameters: "
<< endl;
122
if
(!
BeginRunExecuted
())
123
{
124
cout <<
"Need to execute BeginRun() before parameter printout is meaningful"
<< endl;
125
cout <<
"To do so either run one or more events or on the command line execute: "
<< endl;
126
cout <<
"Fun4AllServer *se = Fun4AllServer::instance();"
<< endl;
127
cout <<
"PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco(\"PHG4RECO\");"
<< endl;
128
cout <<
"g4->InitRun(se->topNode());"
<< endl;
129
cout <<
"PHG4SpacalPrototype4Subsystem *sys = (PHG4SpacalPrototype4Subsystem *) g4->getSubsystem(\""
<<
Name
() <<
"\");"
<< endl;
130
cout <<
"sys->Print()"
<< endl;
131
return
;
132
}
133
GetParams
()->
Print
();
134
return
;
135
}
136
137
void
PHG4SpacalPrototype4Subsystem::SetDefaultParameters
()
138
{
139
set_default_double_param
(
"xpos"
, 0.);
// translation in 3D
140
set_default_double_param
(
"ypos"
, 0.);
// translation in 3D
141
set_default_double_param
(
"zpos"
, 0.);
// translation in 3D
142
set_default_double_param
(
"z_rotation_degree"
, 0.);
// roation in the vertical plane
143
set_default_int_param
(
"construction_verbose"
, 0.);
// roation in the vertical plane
144
return
;
145
}
prototype
blob
master
simulation
g4simulation
g4caloprototype
PHG4SpacalPrototype4Subsystem.cc
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:18:29
using
1.8.2 with
sPHENIX GitHub integration