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
EicRootSubsystem.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file EicRootSubsystem.cc
1
//____________________________________________________________________________..
2
//
3
// This is the interface to the framework. You only need to define the parameters
4
// you use for your detector in the SetDefaultParameters() method here;
5
//
6
// The parameters have no units, they need to be converted in the ConstructMe() method
7
//____________________________________________________________________________..
8
//
9
10
#include <phparameter/PHParameters.h>
11
12
#include <
g4main/PHG4HitContainer.h
>
13
#include <
g4main/PHG4SteppingAction.h
>
14
15
#include <
phool/PHCompositeNode.h
>
16
#include <
phool/PHIODataNode.h
>
17
#include <
phool/PHNode.h
>
18
#include <
phool/PHNodeIterator.h
>
19
#include <
phool/PHObject.h
>
20
#include <
phool/getClass.h
>
21
22
#include "
EicRootSubsystem.h
"
23
#include "
EicRootDetector.h
"
24
#include "
EicRootSteppingAction.h
"
25
26
using namespace
std;
27
28
// ---------------------------------------------------------------------------------------
29
30
EicRootSubsystem::EicRootSubsystem
(
const
std::string &
name
)
31
:
PHG4DetectorSubsystem
(name)
32
, m_Detector(nullptr)
33
, m_SteppingAction(nullptr)
34
{
35
// Avoid all the complications with "G4HIT_VST_[i]" hit collection names, etc;
36
// as long as one can distinguish the layers via detector ID encoded in the
37
// hit class instance in the stepping call, this only gives one a performance
38
// gain (potentially), but forces one to play dirty games trying to assign
39
// layer resolutions based on the index ID, etc; just create more than one
40
// instance of this subsystem if e.g. spatial resolution of the inner and
41
// outer silicon layer is supposed to be different (and pass it as such
42
// to the Kalman filter);
43
SuperDetector
(name);
44
45
m_G4HitName
=
"G4HIT_"
+
name
;
46
47
// Call the base class method which will set up parameter infrastructure
48
// and call our SetDefaultParameters() method internally;
49
InitializeParameters
();
50
}
// EicRootSubsystem::EicRootSubsystem()
51
52
// ---------------------------------------------------------------------------------------
53
54
int
EicRootSubsystem::InitRunSubsystem
(
PHCompositeNode
*topNode)
55
{
56
PHNodeIterator
iter(topNode);
57
PHCompositeNode
*dstNode =
dynamic_cast<
PHCompositeNode
*
>
(iter.
findFirst
(
"PHCompositeNode"
,
"DST"
));
58
59
// Create detector;
60
m_Detector
=
new
EicRootDetector
(
this
, topNode,
Name
());
61
m_Detector
->
OverlapCheck
(
CheckOverlap
());
62
63
// fun4all black magic around G4 hit container creation;
64
if
(
GetParams
()->
get_int_param
(
"active"
)) {
65
auto
DetNode =
new
PHCompositeNode
(
SuperDetector
());
66
67
dstNode->
addNode
(DetNode);
68
69
m_Detector
->
set_hitcontainer
(
new
PHG4HitContainer
(
GetG4HitName
()));
70
DetNode->addNode(
new
PHIODataNode<PHObject>
(
m_Detector
->
get_hitcontainer
(),
GetG4HitName
(),
"PHObject"
));
71
m_SteppingAction
=
new
GdmlImportDetectorSteppingAction
(
m_Detector
,
GetParams
());
72
}
//if
73
74
return
0;
75
}
// EicRootSubsystem::InitRunSubsystem()
76
77
// ---------------------------------------------------------------------------------------
78
79
int
EicRootSubsystem::process_event
(
PHCompositeNode
*topNode)
80
{
81
// pass top node to stepping action so that it gets
82
// relevant nodes needed internally
83
if
(
m_SteppingAction
)
m_SteppingAction
->
SetInterfacePointers
(topNode);
84
85
return
0;
86
}
// EicRootSubsystem::process_event()
87
88
// ---------------------------------------------------------------------------------------
89
90
void
EicRootSubsystem::Print
(
const
string
&what)
const
91
{
92
if
(
m_Detector
)
m_Detector
->
Print
(what);
93
}
// EicRootSubsystem::Print()
94
95
// ---------------------------------------------------------------------------------------
96
97
PHG4Detector
*
EicRootSubsystem::GetDetector
(
void
)
const
98
{
99
return
m_Detector
;
100
}
// EicRootSubsystem::GetDetector()
101
102
// ---------------------------------------------------------------------------------------
103
104
void
EicRootSubsystem::SetDefaultParameters
()
105
{
106
// sizes are in cm
107
// angles are in deg
108
// units should be converted to G4 units when used
109
set_default_double_param
(
"place_x"
, 0.);
110
set_default_double_param
(
"place_y"
, 0.);
111
set_default_double_param
(
"place_z"
, 0.);
112
set_default_double_param
(
"rot_x"
, 0.);
113
set_default_double_param
(
"rot_y"
, 0.);
114
set_default_double_param
(
"rot_z"
, 0.);
115
116
// One custom parameter;
117
set_default_string_param
(
"MotherVolume"
,
"DefaultParameters-Invalid"
);
118
}
// EicRootSubsystem::SetDefaultParameters()
119
120
// ---------------------------------------------------------------------------------------
EicToyModel
blob
master
fun4all_with_eicroot
sandbox
EicRootSubsystem.cc
Built by
Jin Huang
. updated:
Mon Jan 22 2024 12:43:37
using
1.8.2 with
EIC GitHub integration