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