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
PHG4DetectorSubsystem.h
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file PHG4DetectorSubsystem.h
1
// Tell emacs that this is a C++ source
2
// -*- C++ -*-.
3
#ifndef G4DETECTORS_PHG4DETECTORSUBSYSTEM_H
4
#define G4DETECTORS_PHG4DETECTORSUBSYSTEM_H
5
6
#include <
g4main/PHG4Subsystem.h
>
7
8
#include <map>
9
#include <string>
10
11
class
PHCompositeNode
;
12
class
PHParameters
;
13
class
PHParametersContainer
;
14
15
class
PHG4DetectorSubsystem
:
public
PHG4Subsystem
16
{
17
public
:
18
enum
FILE_TYPE
19
{
20
none
= 0,
21
xml
= 1,
22
root
= 2
23
};
24
25
~PHG4DetectorSubsystem
()
override
{}
26
27
int
Init
(
PHCompositeNode
*) final;
28
int
InitRun
(
PHCompositeNode
*) final;
29
30
virtual
int
InitRunSubsystem
(
PHCompositeNode
*) {
return
0; }
31
virtual
int
InitSubsystem
(
PHCompositeNode
*) {
return
0; }
32
33
void
OverlapCheck
(
const
bool
chk =
true
) {
overlapcheck
= chk; }
34
bool
CheckOverlap
()
const
{
return
overlapcheck
; }
35
36
PHParameters
*
GetParams
()
const
{
return
params
; }
37
38
// Get/Set parameters from macro
39
void
set_double_param
(
const
std::string
&
name
,
const
double
dval);
40
double
get_double_param
(
const
std::string
&
name
)
const
;
41
void
set_int_param
(
const
std::string
&
name
,
const
int
ival);
42
int
get_int_param
(
const
std::string
&
name
)
const
;
43
void
set_string_param
(
const
std::string
&
name
,
const
std::string
&sval);
44
std::string
get_string_param
(
const
std::string
&
name
)
const
;
45
46
void
UseDB
(
const
int
i
= 1) {
usedb
=
i
; }
47
int
ReadDB
()
const
{
return
usedb
; }
48
void
UseCDB
(
const
std::string
&domain)
49
{
50
usedb
= 1;
51
m_Domain
= domain;
52
}
53
54
FILE_TYPE
get_filetype
()
const
{
return
filetype
; }
55
56
void
UseCalibFiles
(
const
FILE_TYPE
ftyp) {
filetype
= ftyp; }
57
int
ReadParamsFromCDB
(
const
std::string
&domain);
58
int
SaveParamsToDB
();
59
int
ReadParamsFromDB
(
const
std::string
&
name
,
const
int
issuper);
60
int
SaveParamsToFile
(
const
FILE_TYPE
ftyp);
61
int
ReadParamsFromFile
(
const
std::string
&
name
,
const
FILE_TYPE
ftyp,
const
int
issuper);
62
void
SetCalibrationFileDir
(
const
std::string
&calibdir) {
calibfiledir
= calibdir; }
63
64
void
UpdateParametersWithMacro
();
65
66
void
SetActive
(
const
int
i
= 1);
67
void
SetAbsorberActive
(
const
int
i
= 1);
68
void
SetAbsorberTruth
(
const
int
i
= 1);
69
void
BlackHole
(
const
int
i
= 1);
70
void
SetSupportActive
(
const
int
i
= 1);
71
72
void
SuperDetector
(
const
std::string
&
name
);
73
const
std::string
SuperDetector
()
const
{
return
superdetector
; }
74
75
int
GetLayer
()
const
{
return
layer
; }
76
virtual
void
SetDefaultParameters
() = 0;
// this one has to be implemented by the daughter
77
protected
:
// those cannot be executed on the cmd line
78
PHG4DetectorSubsystem
(
const
std::string
&
name
=
"GenericSubsystem"
,
const
int
lyr = 0);
79
// these initialize the defaults and add new entries to the
80
// list of variables. This should not be possible from the macro to
81
// prevent abuse (this makes the list of possible parameters deterministic)
82
void
InitializeParameters
();
83
void
set_default_double_param
(
const
std::string
&
name
,
const
double
dval);
84
void
set_default_int_param
(
const
std::string
&
name
,
const
int
ival);
85
void
set_default_string_param
(
const
std::string
&
name
,
const
std::string
&sval);
86
int
BeginRunExecuted
()
const
{
return
beginrunexecuted
; }
87
88
private
:
89
PHParameters
*
params
=
nullptr
;
90
PHParametersContainer
*
paramscontainer
=
nullptr
;
91
PHCompositeNode
*
savetopNode
=
nullptr
;
92
bool
overlapcheck
=
false
;
93
int
layer
= -1;
94
int
usedb
= 0;
95
int
beginrunexecuted
= 0;
96
FILE_TYPE
filetype
=
PHG4DetectorSubsystem::none
;
97
std::string
superdetector
=
"NONE"
;
98
std::string
calibfiledir
=
"./"
;
99
std::string
m_Domain
;
100
101
std::map<const std::string, double>
dparams
;
102
std::map<const std::string, int>
iparams
;
103
std::map<const std::string, std::string>
cparams
;
104
105
std::map<const std::string, double>
default_double
;
106
std::map<const std::string, int>
default_int
;
107
std::map<const std::string, std::string>
default_string
;
108
};
109
110
#endif
coresoftware
blob
master
simulation
g4simulation
g4detectors
PHG4DetectorSubsystem.h
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:18:12
using
1.8.2 with
sPHENIX GitHub integration