ECCE @ EIC Software
Reference for
ECCE @ 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
EICG4dRICHSubsystem.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file EICG4dRICHSubsystem.cc
1
//____________________________________________________________________________..
2
//
3
// This is the interface to the framework. You only need to define the
4
// parameters you use for your detector in the SetDefaultParameters() method
5
// here The place to do this is marked by //implement your own here// The
6
// parameters have no units, they need to be converted in the
7
// EICG4dRICHDetector::ConstructMe() method
8
// but the convention is as mentioned cm and deg
9
//____________________________________________________________________________..
10
//
11
#include "
EICG4dRICHSubsystem.h
"
12
#include "
EICG4dRICHDetector.h
"
13
#include "
EICG4dRICHSteppingAction.h
"
14
15
#include <phparameter/PHParameters.h>
16
17
#include <
g4main/PHG4HitContainer.h
>
18
#include <
g4main/PHG4SteppingAction.h
>
19
20
#include <
phool/PHCompositeNode.h
>
21
#include <
phool/PHIODataNode.h
>
22
#include <
phool/PHNode.h
>
23
#include <
phool/PHNodeIterator.h
>
24
#include <
phool/PHObject.h
>
25
#include <
phool/getClass.h
>
26
27
//_______________________________________________________________________
28
EICG4dRICHSubsystem::EICG4dRICHSubsystem
(
const
std::string &
name
)
29
:
PHG4DetectorSubsystem
(name)
30
, m_Detector(nullptr)
31
, m_SteppingAction(nullptr)
32
{
33
// call base class method which will set up parameter infrastructure
34
// and call our SetDefaultParameters() method
35
InitializeParameters
();
36
}
37
//_______________________________________________________________________
38
int
EICG4dRICHSubsystem::InitRunSubsystem
(
PHCompositeNode
*topNode)
39
{
40
PHNodeIterator
iter(topNode);
41
PHCompositeNode
*dstNode =
dynamic_cast<
PHCompositeNode
*
>
(iter.
findFirst
(
"PHCompositeNode"
,
"DST"
));
42
PHNodeIterator
dstIter(dstNode);
43
if
(
GetParams
()->
get_int_param
(
"active"
))
44
{
45
PHCompositeNode
*DetNode =
dynamic_cast<
PHCompositeNode
*
>
(dstIter.
findFirst
(
"PHCompositeNode"
,
Name
()));
46
if
(!DetNode)
47
{
48
DetNode =
new
PHCompositeNode
(
Name
());
49
dstNode->
addNode
(DetNode);
50
}
51
std::string g4hitnodename =
"G4HIT_"
+
Name
();
52
PHG4HitContainer
*g4_hits = findNode::getClass<PHG4HitContainer>(DetNode, g4hitnodename);
53
if
(!g4_hits)
54
{
55
g4_hits =
new
PHG4HitContainer
(g4hitnodename);
56
DetNode->addNode(
new
PHIODataNode<PHObject>
(g4_hits, g4hitnodename,
"PHObject"
));
57
}
58
}
59
60
if
(
m_geoFile
.empty())
61
{
62
std::cout <<
"ERROR in "
<< __FILE__ <<
": No EICG4dRICH geometry file specified. Abort detector construction."
<< std::endl;
63
std::cout <<
"Please run SetGeometryFile(std::string filename) first."
<< std::endl;
64
exit
(1);
65
}
66
set_string_param
(
"mapping_file"
,
m_geoFile
);
67
UpdateParametersWithMacro
();
68
69
// create detector
70
m_Detector
=
new
EICG4dRICHDetector
(
this
, topNode,
GetParams
(),
Name
());
71
m_Detector
->
OverlapCheck
(
CheckOverlap
());
72
// create stepping action if detector is active
73
if
(
GetParams
()->
get_int_param
(
"active"
))
74
{
75
m_SteppingAction
=
new
EICG4dRICHSteppingAction
(
m_Detector
,
GetParams
());
76
}
77
return
0;
78
}
79
//_______________________________________________________________________
80
int
EICG4dRICHSubsystem::process_event
(
PHCompositeNode
*topNode)
81
{
82
// pass top node to stepping action so that it gets
83
// relevant nodes needed internally
84
if
(
m_SteppingAction
)
85
{
86
m_SteppingAction
->
SetInterfacePointers
(topNode);
87
}
88
return
0;
89
}
90
//_______________________________________________________________________
91
void
EICG4dRICHSubsystem::Print
(
const
std::string &what)
const
92
{
93
if
(
m_Detector
)
94
{
95
m_Detector
->
Print
(what);
96
}
97
return
;
98
}
99
100
//_______________________________________________________________________
101
PHG4Detector
*
EICG4dRICHSubsystem::GetDetector
(
void
)
const
{
return
m_Detector
; }
102
103
//_______________________________________________________________________
104
void
EICG4dRICHSubsystem::SetDefaultParameters
()
105
{
106
//set_default_int_param("verbosity", 0);
107
// sizes are in cm
108
// angles are in deg
109
// units should be converted to G4 units when used
110
// implement your own here//
111
112
set_default_double_param
(
"place_x"
, 0.);
113
set_default_double_param
(
"place_y"
, 0.);
114
set_default_double_param
(
"place_z"
, 0.);
115
set_default_double_param
(
"rot_x"
, 0.);
116
set_default_double_param
(
"rot_y"
, 0.);
117
set_default_double_param
(
"rot_z"
, 0.);
118
set_default_double_param
(
"size_x"
, 20.);
119
set_default_double_param
(
"size_y"
, 20.);
120
set_default_double_param
(
"size_z"
, 20.);
121
122
//set_default_string_param("material", "G4_Cu");
123
124
set_default_string_param
(
"mapping_file"
,
m_geoFile
.c_str());
125
}
fun4all_eicdetectors
blob
master
simulation
g4simulation
g4drich
EICG4dRICHSubsystem.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:46
using
1.8.2 with
ECCE GitHub integration