EIC Software
Reference for
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
G4Example01Subsystem.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4Example01Subsystem.cc
1
#include "
G4Example01Subsystem.h
"
2
#include "
G4Example01Detector.h
"
3
#include "
G4Example01SteppingAction.h
"
4
5
#include <
g4main/PHG4HitContainer.h
>
6
#include <
g4main/PHG4SteppingAction.h
>
// for PHG4SteppingAction
7
8
#include <
phool/PHCompositeNode.h
>
9
#include <
phool/PHIODataNode.h
>
// for PHIODataNode
10
#include <
phool/PHNode.h
>
// for PHNode
11
#include <
phool/PHNodeIterator.h
>
// for PHNodeIterator
12
#include <
phool/PHObject.h
>
// for PHObject
13
#include <
phool/getClass.h
>
14
15
using namespace
std;
16
17
//_______________________________________________________________________
18
G4Example01Subsystem::G4Example01Subsystem
(
const
std::string &
name
)
19
:
PHG4Subsystem
(name)
20
, m_Detector(nullptr)
21
, m_SteppingAction(nullptr)
22
{
23
}
24
25
//_______________________________________________________________________
26
int
G4Example01Subsystem::Init
(
PHCompositeNode
*topNode)
27
{
28
PHNodeIterator
iter(topNode);
29
PHCompositeNode
*dstNode =
dynamic_cast<
PHCompositeNode
*
>
(iter.
findFirst
(
"PHCompositeNode"
,
"DST"
));
30
PHNodeIterator
dstIter(dstNode);
31
PHCompositeNode
*DetNode =
dynamic_cast<
PHCompositeNode
*
>
(dstIter.
findFirst
(
"PHCompositeNode"
,
Name
()));
32
if
(!DetNode)
33
{
34
DetNode =
new
PHCompositeNode
(
Name
());
35
dstNode->
addNode
(DetNode);
36
}
37
string
g4hitnodename =
"G4HIT_"
+
Name
();
38
PHG4HitContainer
*g4_hits = findNode::getClass<PHG4HitContainer>(DetNode, g4hitnodename);
39
if
(!g4_hits)
40
{
41
g4_hits =
new
PHG4HitContainer
(g4hitnodename);
42
DetNode->addNode(
new
PHIODataNode<PHObject>
(g4_hits, g4hitnodename,
"PHObject"
));
43
}
44
45
// create detector
46
m_Detector
=
new
G4Example01Detector
(
this
, topNode,
Name
());
47
m_Detector
->
OverlapCheck
(
CheckOverlap
());
48
49
// create stepping action
50
m_SteppingAction
=
new
G4Example01SteppingAction
(
m_Detector
);
51
52
return
0;
53
}
54
55
//_______________________________________________________________________
56
int
G4Example01Subsystem::process_event
(
PHCompositeNode
*topNode)
57
{
58
// pass top node to stepping action so that it gets
59
// relevant nodes needed internally
60
if
(
m_SteppingAction
)
61
{
62
m_SteppingAction
->
SetInterfacePointers
(topNode);
63
}
64
return
0;
65
}
66
67
void
G4Example01Subsystem::Print
(
const
string
&what)
const
68
{
69
//cout << "PSTOF Parameters: " << endl;
70
if
(
m_Detector
)
71
{
72
m_Detector
->
Print
(what);
73
}
74
return
;
75
}
76
77
//_______________________________________________________________________
78
PHG4Detector
*
G4Example01Subsystem::GetDetector
(
void
)
const
79
{
80
return
m_Detector
;
81
}
g4exampledetector
blob
master
simple
source
G4Example01Subsystem.cc
Built by
Jin Huang
. updated:
Mon Jan 22 2024 12:43:55
using
1.8.2 with
EIC GitHub integration