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
G4_ZDC.C
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4_ZDC.C
1
#ifndef MACRO_G4ZDC_C
2
#define MACRO_G4ZDC_C
3
4
#include <
GlobalVariables.C
>
5
6
#include <
G4_BeamLine.C
>
7
8
#include <
g4calo/RawTowerBuilderByHitIndex.h
>
9
#include <
g4calo/RawTowerDigitizer.h
>
10
11
#include <
g4detectors/PHG4DetectorSubsystem.h
>
12
#include <
g4detectors/PHG4ZDCDefs.h
>
13
#include <
g4detectors/PHG4ZDCSubsystem.h
>
14
15
#include <
g4eval/CaloEvaluator.h
>
16
17
#include <
g4main/PHG4Reco.h
>
18
19
#include <calobase/RawTowerDefs.h>
20
21
#include <caloreco/RawClusterBuilderFwd.h>
22
#include <caloreco/RawClusterBuilderTemplate.h>
23
#include <caloreco/RawTowerCalibration.h>
24
25
#include <
fun4all/Fun4AllServer.h
>
26
27
R__LOAD_LIBRARY
(libcalo_reco.so)
28
R__LOAD_LIBRARY
(libg4calo.so)
29
R__LOAD_LIBRARY
(libg4detectors.so)
30
R__LOAD_LIBRARY
(libg4eval.so)
31
32
namespace Enable
33
{
34
bool
ZDC
=
false
;
35
bool
ZDC_ABSORBER
=
false
;
36
bool
ZDC_SUPPORT
=
false
;
37
bool
ZDC_TOWER
=
false
;
38
bool
ZDC_EVAL
=
false
;
39
bool
ZDC_OVERLAPCHECK
=
false
;
40
int
ZDC_VERBOSITY
= 0;
41
}
// namespace Enable
42
43
namespace
G4ZDC
44
{
45
double
Gz0
= 1900.;
46
double
outer_radius
= 180.;
47
string
calibfile
=
"ZDC/mapping/towerMap_ZDC.txt"
;
48
double
ZDCPlaceZ
= 1843.0;
49
50
}
// namespace G4ZDC
51
52
void
ZDCInit
()
53
{
54
BlackHoleGeometry::max_radius
=
std::max
(
BlackHoleGeometry::max_radius
,
G4ZDC::outer_radius
);
55
BlackHoleGeometry::max_z
=
std::max
(
BlackHoleGeometry::max_z
,
G4ZDC::Gz0
);
56
BlackHoleGeometry::min_z
=
std::min
(
BlackHoleGeometry::min_z
, -
G4ZDC::Gz0
);
57
}
58
59
void
ZDCSetup
(
PHG4Reco
*g4Reco,
const
int
absorberactive = 0)
60
{
61
bool
AbsorberActive =
Enable::ABSORBER
||
Enable::ZDC_ABSORBER
|| (absorberactive > 0);
62
bool
OverlapCheck =
Enable::OVERLAPCHECK
||
Enable::ZDC_OVERLAPCHECK
;
63
64
bool
SupportActive =
Enable::SUPPORT
||
Enable::ZDC_SUPPORT
;
65
66
Fun4AllServer
*se =
Fun4AllServer::instance
();
67
68
PHG4ZDCSubsystem
*
zdc
=
new
PHG4ZDCSubsystem
(
"ZDC"
,PHG4ZDCDefs::NORTH);
69
// place zdc in beam enclosure
70
zdc->
set_double_param
(
"place_z"
,
G4ZDC::ZDCPlaceZ
-
G4BEAMLINE::enclosure_center
);
71
zdc->
OverlapCheck
(OverlapCheck);
72
zdc->
SetActive
();
73
zdc->
SuperDetector
(
"ZDC"
);
74
if
(AbsorberActive) zdc->
SetAbsorberActive
(AbsorberActive);
75
if
(SupportActive) zdc->
SetSupportActive
(SupportActive);
76
zdc->
SetMotherSubsystem
(
G4BEAMLINE::ForwardBeamLineEnclosure
);
77
g4Reco->
registerSubsystem
(zdc);
78
79
zdc =
new
PHG4ZDCSubsystem
(
"ZDC"
, PHG4ZDCDefs::SOUTH);
80
// place zdc in beam enclosure
81
zdc->
set_double_param
(
"place_z"
,
G4ZDC::ZDCPlaceZ
-
G4BEAMLINE::enclosure_center
);
82
zdc->
OverlapCheck
(OverlapCheck);
83
zdc->
SetActive
();
84
zdc->
SuperDetector
(
"ZDC"
);
85
if
(AbsorberActive) zdc->
SetAbsorberActive
(AbsorberActive);
86
if
(SupportActive) zdc->
SetSupportActive
(SupportActive);
87
zdc->
SetMotherSubsystem
(
G4BEAMLINE::BackwardBeamLineEnclosure
);
88
g4Reco->
registerSubsystem
(zdc);
89
}
90
91
void
ZDC_Towers
()
92
{
93
int
verbosity =
std::max
(
Enable::VERBOSITY
,
Enable::ZDC_VERBOSITY
);
94
Fun4AllServer
*se =
Fun4AllServer::instance
();
95
96
string
mapping_zdc = string(getenv(
"CALIBRATIONROOT"
)) +
"/"
+
G4ZDC::calibfile
;
97
98
RawTowerBuilderByHitIndex
*tower_ZDC =
new
RawTowerBuilderByHitIndex
(
"TowerBuilder_ZDC"
);
99
tower_ZDC->
Detector
(
"ZDC"
);
100
tower_ZDC->
set_sim_tower_node_prefix
(
"SIM"
);
101
tower_ZDC->
GeometryTableFile
(mapping_zdc);
102
se->
registerSubsystem
(tower_ZDC);
103
104
RawTowerDigitizer
*TowerDigitizer =
new
RawTowerDigitizer
(
"ZDCRawTowerDigitizer"
);
105
TowerDigitizer->
Detector
(
"ZDC"
);
106
TowerDigitizer->
TowerType
(0);
107
TowerDigitizer->
Verbosity
(verbosity);
108
TowerDigitizer->
set_digi_algorithm
(
RawTowerDigitizer::kNo_digitization
);
109
se->
registerSubsystem
(TowerDigitizer);
110
//SMD
111
RawTowerDigitizer
*TowerDigitizer1 =
new
RawTowerDigitizer
(
"ZDCRawTowerDigitizer1"
);
112
TowerDigitizer1->
Detector
(
"ZDC"
);
113
TowerDigitizer1->
TowerType
(1);
114
TowerDigitizer1->
Verbosity
(verbosity);
115
TowerDigitizer1->
set_digi_algorithm
(
RawTowerDigitizer::kNo_digitization
);
116
se->
registerSubsystem
(TowerDigitizer1);
117
118
RawTowerCalibration
*TowerCalibration =
new
RawTowerCalibration
(
"ZDCRawTowerCalibration"
);
119
TowerCalibration->
Detector
(
"ZDC"
);
120
TowerCalibration->
TowerType
(0);
121
TowerCalibration->
Verbosity
(verbosity);
122
TowerCalibration->
set_calib_algorithm
(
RawTowerCalibration::kSimple_linear_calibration
);
123
TowerCalibration->
set_calib_const_GeV_ADC
(1.0);
// sampling fraction = 0.010
124
TowerCalibration->
set_pedstal_ADC
(0);
125
se->
registerSubsystem
(TowerCalibration);
126
127
RawTowerCalibration
*TowerCalibration1 =
new
RawTowerCalibration
(
"ZDCRawTowerCalibration1"
);
128
TowerCalibration1->
Detector
(
"ZDC"
);
129
TowerCalibration1->
TowerType
(1);
130
TowerCalibration1->
Verbosity
(verbosity);
131
TowerCalibration1->
set_calib_algorithm
(
RawTowerCalibration::kSimple_linear_calibration
);
132
TowerCalibration1->
set_calib_const_GeV_ADC
(1.0);
133
TowerCalibration1->
set_pedstal_ADC
(0);
134
se->
registerSubsystem
(TowerCalibration1);
135
}
136
137
void
ZDC_Eval
(std::string
outputfile
)
138
{
139
int
verbosity =
std::max
(
Enable::VERBOSITY
,
Enable::ZDC_VERBOSITY
);
140
Fun4AllServer
*se =
Fun4AllServer::instance
();
141
142
CaloEvaluator
*eval =
new
CaloEvaluator
(
"ZDCEVALUATOR"
,
"ZDC"
, outputfile);
143
eval->
set_do_cluster_eval
(
false
);
144
eval->
Verbosity
(verbosity);
145
se->
registerSubsystem
(eval);
146
147
return
;
148
}
149
#endif
fun4all_macros
blob
master
common
G4_ZDC.C
Built by
Jin Huang
. updated:
Mon Jan 22 2024 12:43:54
using
1.8.2 with
EIC GitHub integration