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
PHG4EnvelopeSubsystem.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file PHG4EnvelopeSubsystem.cc
1
#include "
PHG4EnvelopeSubsystem.h
"
2
3
#include "
PHG4EnvelopeDetector.h
"
4
#include "
PHG4EnvelopeSteppingAction.h
"
5
6
#include <
g4main/PHG4HitContainer.h
>
7
#include <
g4main/PHG4Subsystem.h
>
// for PHG4Subsystem
8
9
#include <
phool/PHCompositeNode.h
>
10
#include <
phool/PHIODataNode.h
>
// for PHIODataNode
11
#include <
phool/PHNode.h
>
// for PHNode
12
#include <
phool/PHNodeIterator.h
>
// for PHNodeIterator
13
#include <
phool/PHObject.h
>
// for PHObject
14
#include <
phool/getClass.h
>
15
16
#include <sstream>
17
18
PHG4EnvelopeSubsystem::PHG4EnvelopeSubsystem
(
const
std::string
&
name
,
const
int
/*lyr*/
)
19
:
PHG4Subsystem
(name)
20
, detector_(nullptr)
21
, steppingAction_(nullptr)
22
,
material
(
"G4_PbWO4"
)
23
,
// default - lead tungstate crystal
24
active
(1)
25
, detector_type(name)
26
{
27
}
28
29
int
PHG4EnvelopeSubsystem::Init
(
PHCompositeNode
* topNode)
30
{
31
PHNodeIterator
iter(topNode);
32
PHCompositeNode
* dstNode =
dynamic_cast<
PHCompositeNode
*
>
(iter.
findFirst
(
"PHCompositeNode"
,
"DST"
));
33
34
// create detector
35
detector_
=
new
PHG4EnvelopeDetector
(
this
, topNode,
Name
());
36
detector_
->
SetActive
(
active
);
37
detector_
->
OverlapCheck
(
CheckOverlap
());
38
39
if
(
active
)
40
{
41
// create hit output node
42
std::string
nodename;
43
nodename =
"G4HIT_ENVELOPE_"
+
detector_type
;
44
45
PHG4HitContainer
* crystal_hits = findNode::getClass<PHG4HitContainer>(topNode, nodename);
46
if
(!crystal_hits)
47
{
48
crystal_hits =
new
PHG4HitContainer
(nodename);
49
PHIODataNode<PHObject>
* hitNode =
new
PHIODataNode<PHObject>
(crystal_hits, nodename,
"PHObject"
);
50
dstNode->
addNode
(hitNode);
51
}
52
53
// create stepping action
54
steppingAction_
=
new
PHG4EnvelopeSteppingAction
(
detector_
);
55
}
56
return
0;
57
}
58
59
//_______________________________________________________________________
60
int
PHG4EnvelopeSubsystem::process_event
(
PHCompositeNode
* topNode)
61
{
62
// pass top node to stepping action so that it gets
63
// relevant nodes needed internally
64
if
(
steppingAction_
)
65
{
66
steppingAction_
->
SetInterfacePointers
(topNode);
67
}
68
return
0;
69
}
70
71
//_______________________________________________________________________
72
PHG4Detector
*
PHG4EnvelopeSubsystem::GetDetector
()
const
73
{
74
return
detector_
;
75
}
76
77
//_______________________________________________________________________
78
PHG4SteppingAction
*
PHG4EnvelopeSubsystem::GetSteppingAction
()
const
79
{
80
return
steppingAction_
;
81
}
coresoftware
blob
master
simulation
g4simulation
g4detectors
PHG4EnvelopeSubsystem.cc
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:18:12
using
1.8.2 with
sPHENIX GitHub integration