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_FEMC.C
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4_FEMC.C
1
#ifndef MACRO_G4FEMC_C
2
#define MACRO_G4FEMC_C
3
4
#include <GlobalVariables.C>
5
6
#include <
g4calo/RawTowerBuilderByHitIndex.h
>
7
#include <
g4calo/RawTowerDigitizer.h
>
8
9
#include <
g4eiccalos/PHG4ForwardCalCellReco.h
>
10
#include <
g4eiccalos/PHG4ForwardEcalSubsystem.h
>
11
12
#include <
g4eval/CaloEvaluator.h
>
13
14
#include <
g4main/PHG4Reco.h
>
15
16
#include <caloreco/RawClusterBuilderFwd.h>
17
#include <caloreco/RawClusterBuilderTemplate.h>
18
#include <caloreco/RawTowerCalibration.h>
19
20
#include <
fun4all/Fun4AllServer.h
>
21
22
R__LOAD_LIBRARY
(libcalo_reco.so)
23
R__LOAD_LIBRARY
(libg4calo.so)
24
R__LOAD_LIBRARY
(libg4detectors.so)
25
R__LOAD_LIBRARY
(libg4eval.so)
26
27
namespace Enable
28
{
29
bool
FEMC
=
false
;
30
bool
FEMC_ABSORBER
=
false
;
31
bool
FEMC_CELL
=
false
;
32
bool
FEMC_TOWER
=
false
;
33
bool
FEMC_CLUSTER
=
false
;
34
bool
FEMC_EVAL
=
false
;
35
bool
FEMC_OVERLAPCHECK
=
false
;
36
int
FEMC_VERBOSITY
= 0;
37
}
// namespace Enable
38
39
namespace
G4FEMC
40
{
41
// from ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt
42
double
Gz0
= 305.;
43
double
Gdz
= 40.;
44
double
outer_radius
= 180.;
45
string
calibfile
=
"/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"
;
46
enum
enu_Femc_clusterizer
47
{
48
kFemcGraphClusterizer
,
49
kFemcTemplateClusterizer
50
};
51
52
//template clusterizer, as developed by Sasha Bazilevsky
53
enu_Femc_clusterizer
Femc_clusterizer
=
kFemcTemplateClusterizer
;
54
// graph clusterizer
55
//enu_Femc_clusterizer Femc_clusterizer = kFemcGraphClusterizer;
56
}
// namespace G4FEMC
57
58
void
FEMCInit
()
59
{
60
BlackHoleGeometry::max_radius
=
std::max
(
BlackHoleGeometry::max_radius
,
G4FEMC::outer_radius
);
61
BlackHoleGeometry::max_z
=
std::max
(
BlackHoleGeometry::max_z
,
G4FEMC::Gz0
+
G4FEMC::Gdz
/ 2.);
62
BlackHoleGeometry::min_z
=
std::min
(
BlackHoleGeometry::min_z
, -10.);
63
}
64
65
void
FEMCSetup
(
PHG4Reco
*g4Reco,
const
int
absorberactive = 0)
66
{
67
bool
AbsorberActive =
Enable::ABSORBER
||
Enable::FEMC_ABSORBER
|| (absorberactive > 0);
68
bool
OverlapCheck =
Enable::OVERLAPCHECK
||
Enable::FEMC_OVERLAPCHECK
;
69
70
Fun4AllServer
*se =
Fun4AllServer::instance
();
71
73
PHG4ForwardEcalSubsystem
*
femc
=
new
PHG4ForwardEcalSubsystem
(
"FEMC"
);
74
75
ostringstream mapping_femc;
76
77
// fsPHENIX ECAL
78
femc->
SetfsPHENIXDetector
();
79
mapping_femc << getenv(
"CALIBRATIONROOT"
) <<
G4FEMC::calibfile
;
80
81
// cout << mapping_femc.str() << endl;
82
femc->
SetTowerMappingFile
(mapping_femc.str());
83
femc->
OverlapCheck
(OverlapCheck);
84
femc->
SetActive
();
85
femc->
SetDetailed
(
true
);
86
femc->
SuperDetector
(
"FEMC"
);
87
if
(AbsorberActive) femc->
SetAbsorberActive
(AbsorberActive);
88
89
g4Reco->
registerSubsystem
(femc);
90
}
91
92
void
FEMC_Cells
()
93
{
94
return
;
95
}
96
97
void
FEMC_Towers
()
98
{
99
int
verbosity =
std::max
(
Enable::VERBOSITY
,
Enable::FEMC_VERBOSITY
);
100
Fun4AllServer
*se =
Fun4AllServer::instance
();
101
102
ostringstream mapping_femc;
103
104
// fsPHENIX ECAL
105
mapping_femc << getenv(
"CALIBRATIONROOT"
) <<
G4FEMC::calibfile
;
106
107
RawTowerBuilderByHitIndex
*tower_FEMC =
new
RawTowerBuilderByHitIndex
(
"TowerBuilder_FEMC"
);
108
tower_FEMC->
Detector
(
"FEMC"
);
109
tower_FEMC->
set_sim_tower_node_prefix
(
"SIM"
);
110
tower_FEMC->
GeometryTableFile
(mapping_femc.str());
111
112
se->
registerSubsystem
(tower_FEMC);
113
114
// PbW crystals
115
//RawTowerDigitizer *TowerDigitizer1 = new RawTowerDigitizer("FEMCRawTowerDigitizer1");
116
//TowerDigitizer1->Detector("FEMC");
117
//TowerDigitizer1->TowerType(1);
118
//TowerDigitizer1->Verbosity(verbosity);
119
//TowerDigitizer1->set_digi_algorithm(RawTowerDigitizer::kNo_digitization);
120
//se->registerSubsystem( TowerDigitizer1 );
121
122
// PbSc towers
123
//RawTowerDigitizer *TowerDigitizer2 = new RawTowerDigitizer("FEMCRawTowerDigitizer2");
124
//TowerDigitizer2->Detector("FEMC");
125
//TowerDigitizer2->TowerType(2);
126
//TowerDigitizer2->Verbosity(verbosity);
127
//TowerDigitizer2->set_digi_algorithm(RawTowerDigitizer::kNo_digitization);
128
//se->registerSubsystem( TowerDigitizer2 );
129
130
// E864 towers (three types for three sizes)
131
RawTowerDigitizer
*TowerDigitizer3 =
new
RawTowerDigitizer
(
"FEMCRawTowerDigitizer3"
);
132
TowerDigitizer3->
Detector
(
"FEMC"
);
133
TowerDigitizer3->
TowerType
(3);
134
TowerDigitizer3->
Verbosity
(verbosity);
135
TowerDigitizer3->
set_digi_algorithm
(
RawTowerDigitizer::kNo_digitization
);
136
se->
registerSubsystem
(TowerDigitizer3);
137
138
RawTowerDigitizer
*TowerDigitizer4 =
new
RawTowerDigitizer
(
"FEMCRawTowerDigitizer4"
);
139
TowerDigitizer4->
Detector
(
"FEMC"
);
140
TowerDigitizer4->
TowerType
(4);
141
TowerDigitizer4->
Verbosity
(verbosity);
142
TowerDigitizer4->
set_digi_algorithm
(
RawTowerDigitizer::kNo_digitization
);
143
se->
registerSubsystem
(TowerDigitizer4);
144
145
RawTowerDigitizer
*TowerDigitizer5 =
new
RawTowerDigitizer
(
"FEMCRawTowerDigitizer5"
);
146
TowerDigitizer5->
Detector
(
"FEMC"
);
147
TowerDigitizer5->
TowerType
(5);
148
TowerDigitizer5->
Verbosity
(verbosity);
149
TowerDigitizer5->
set_digi_algorithm
(
RawTowerDigitizer::kNo_digitization
);
150
se->
registerSubsystem
(TowerDigitizer5);
151
152
RawTowerDigitizer
*TowerDigitizer6 =
new
RawTowerDigitizer
(
"FEMCRawTowerDigitizer6"
);
153
TowerDigitizer6->
Detector
(
"FEMC"
);
154
TowerDigitizer6->
TowerType
(6);
155
TowerDigitizer6->
Verbosity
(verbosity);
156
TowerDigitizer6->
set_digi_algorithm
(
RawTowerDigitizer::kNo_digitization
);
157
se->
registerSubsystem
(TowerDigitizer6);
158
159
// PbW crystals
160
//RawTowerCalibration *TowerCalibration1 = new RawTowerCalibration("FEMCRawTowerCalibration1");
161
//TowerCalibration1->Detector("FEMC");
162
//TowerCalibration1->TowerType(1);
163
//TowerCalibration1->Verbosity(verbosity);
164
//TowerCalibration1->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration);
165
//TowerCalibration1->set_calib_const_GeV_ADC(1.0); // sampling fraction = 1.0
166
//TowerCalibration1->set_pedstal_ADC(0);
167
//se->registerSubsystem( TowerCalibration1 );
168
169
// PbSc towers
170
//RawTowerCalibration *TowerCalibration2 = new RawTowerCalibration("FEMCRawTowerCalibration2");
171
//TowerCalibration2->Detector("FEMC");
172
//TowerCalibration2->TowerType(2);
173
//TowerCalibration2->Verbosity(verbosity);
174
//TowerCalibration2->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration);
175
//TowerCalibration2->set_calib_const_GeV_ADC(1.0/0.249); // sampling fraction = 0.249 for e-
176
//TowerCalibration2->set_pedstal_ADC(0);
177
//se->registerSubsystem( TowerCalibration2 );
178
179
// E864 towers (three types for three sizes)
180
RawTowerCalibration
*TowerCalibration3 =
new
RawTowerCalibration
(
"FEMCRawTowerCalibration3"
);
181
TowerCalibration3->
Detector
(
"FEMC"
);
182
TowerCalibration3->
TowerType
(3);
183
TowerCalibration3->
Verbosity
(verbosity);
184
TowerCalibration3->
set_calib_algorithm
(
RawTowerCalibration::kSimple_linear_calibration
);
185
TowerCalibration3->
set_calib_const_GeV_ADC
(1.0 / 0.030);
// sampling fraction = 0.030
186
TowerCalibration3->
set_pedstal_ADC
(0);
187
se->
registerSubsystem
(TowerCalibration3);
188
189
RawTowerCalibration
*TowerCalibration4 =
new
RawTowerCalibration
(
"FEMCRawTowerCalibration4"
);
190
TowerCalibration4->
Detector
(
"FEMC"
);
191
TowerCalibration4->
TowerType
(4);
192
TowerCalibration4->
Verbosity
(verbosity);
193
TowerCalibration4->
set_calib_algorithm
(
RawTowerCalibration::kSimple_linear_calibration
);
194
TowerCalibration4->
set_calib_const_GeV_ADC
(1.0 / 0.030);
// sampling fraction = 0.030
195
TowerCalibration4->
set_pedstal_ADC
(0);
196
se->
registerSubsystem
(TowerCalibration4);
197
198
RawTowerCalibration
*TowerCalibration5 =
new
RawTowerCalibration
(
"FEMCRawTowerCalibration5"
);
199
TowerCalibration5->
Detector
(
"FEMC"
);
200
TowerCalibration5->
TowerType
(5);
201
TowerCalibration5->
Verbosity
(verbosity);
202
TowerCalibration5->
set_calib_algorithm
(
RawTowerCalibration::kSimple_linear_calibration
);
203
TowerCalibration5->
set_calib_const_GeV_ADC
(1.0 / 0.030);
// sampling fraction = 0.030
204
TowerCalibration5->
set_pedstal_ADC
(0);
205
se->
registerSubsystem
(TowerCalibration5);
206
207
RawTowerCalibration
*TowerCalibration6 =
new
RawTowerCalibration
(
"FEMCRawTowerCalibration6"
);
208
TowerCalibration6->
Detector
(
"FEMC"
);
209
TowerCalibration6->
TowerType
(6);
210
TowerCalibration6->
Verbosity
(verbosity);
211
TowerCalibration6->
set_calib_algorithm
(
RawTowerCalibration::kSimple_linear_calibration
);
212
TowerCalibration6->
set_calib_const_GeV_ADC
(1.0 / 0.030);
// sampling fraction = 0.030
213
TowerCalibration6->
set_pedstal_ADC
(0);
214
se->
registerSubsystem
(TowerCalibration6);
215
}
216
217
void
FEMC_Clusters
()
218
{
219
int
verbosity =
std::max
(
Enable::VERBOSITY
,
Enable::FEMC_VERBOSITY
);
220
221
Fun4AllServer
*se =
Fun4AllServer::instance
();
222
223
if
(
G4FEMC::Femc_clusterizer
==
G4FEMC::kFemcTemplateClusterizer
)
224
{
225
RawClusterBuilderTemplate
*ClusterBuilder =
new
RawClusterBuilderTemplate
(
"EmcRawClusterBuilderTemplateFEMC"
);
226
ClusterBuilder->
Detector
(
"FEMC"
);
227
ClusterBuilder->
Verbosity
(verbosity);
228
ClusterBuilder->
set_threshold_energy
(0.020);
// This threshold should be the same as in FEMCprof_Thresh**.root file below
229
std::string femc_prof = getenv(
"CALIBRATIONROOT"
);
230
femc_prof +=
"/EmcProfile/FEMCprof_Thresh20MeV.root"
;
231
ClusterBuilder->
LoadProfile
(femc_prof.c_str());
232
se->
registerSubsystem
(ClusterBuilder);
233
}
234
else
if
(
G4FEMC::Femc_clusterizer
==
G4FEMC::kFemcGraphClusterizer
)
235
{
236
RawClusterBuilderFwd
*ClusterBuilder =
new
RawClusterBuilderFwd
(
"FEMCRawClusterBuilderFwd"
);
237
238
ClusterBuilder->
Detector
(
"FEMC"
);
239
ClusterBuilder->
Verbosity
(verbosity);
240
ClusterBuilder->
set_threshold_energy
(0.010);
241
se->
registerSubsystem
(ClusterBuilder);
242
}
243
else
244
{
245
cout <<
"FEMC_Clusters - unknown clusterizer setting!"
<< endl;
246
exit
(1);
247
}
248
249
return
;
250
}
251
252
void
FEMC_Eval
(std::string
outputfile
)
253
{
254
int
verbosity =
std::max
(
Enable::VERBOSITY
,
Enable::FEMC_VERBOSITY
);
255
Fun4AllServer
*se =
Fun4AllServer::instance
();
256
257
CaloEvaluator
*eval =
new
CaloEvaluator
(
"FEMCEVALUATOR"
,
"FEMC"
, outputfile.c_str());
258
eval->
Verbosity
(verbosity);
259
se->
registerSubsystem
(eval);
260
261
return
;
262
}
263
#endif
fun4all_eicmacros
blob
master
common
G4_FEMC.C
Built by
Jin Huang
. updated:
Mon Jan 22 2024 12:43:53
using
1.8.2 with
EIC GitHub integration