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