EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4_BECAL.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4_BECAL.C
1 #ifndef MACRO_G4BECAL_C
2 #define MACRO_G4BECAL_C
3 
4 #include <GlobalVariables.C>
5 
7 
10 
11 #include <g4eval/CaloEvaluator.h>
12 
13 #include <g4main/PHG4Reco.h>
14 
15 #include <caloreco/RawClusterBuilderFwd.h>
16 #include <caloreco/RawClusterBuilderTemplate.h>
17 #include <caloreco/RawTowerCalibration.h>
18 
19 #include <fun4all/Fun4AllServer.h>
20 
21 R__LOAD_LIBRARY(libcalo_reco.so)
22 R__LOAD_LIBRARY(libg4calo.so)
23 R__LOAD_LIBRARY(libg4eiccalos.so)
24 R__LOAD_LIBRARY(libg4eval.so)
25 
26 namespace Enable
27 {
28  bool BECAL = false;
29  bool BECAL_ABSORBER = false;
30  bool BECAL_CELL = false;
31  bool BECAL_TOWER = false;
32  bool BECAL_CLUSTER = false;
33  bool BECAL_EVAL = false;
34  bool BECAL_OVERLAPCHECK = false;
35  int BECAL_VERBOSITY = 0;
36 } // namespace Enable
37 
38 
39 
40 namespace G4BECAL
41 {
42 
43  double minz = -453;
44  double maxz = 371;
45  double topradius = 140;
46  double radius = 84;
47  // this is default set to -1.5<eta<1.24 for 2018 Letter of Intent
48  // if the user changes these, the z position of the
49 
50  // Digitization (default photon digi):
52  // directly pass the energy of sim tower to digitized tower
53  // kNo_digitization
54  // simple digitization with photon statistics, single amplitude ADC conversion and pedestal
55  // kSimple_photon_digitization
56  // digitization with photon statistics on SiPM with an effective pixel N, ADC conversion and pedestal
57  // kSiPM_photon_digitization
58 
59 } // namespace G4BECAL
60 
61 void BECALInit()
62 {
63 
64  // update black hole settings
68 
69 }
70 
71 double BECALSetup(PHG4Reco *g4Reco)
72 {
73 
74  bool AbsorberActive = Enable::ABSORBER || Enable::BECAL_ABSORBER;
75  bool OverlapCheck = Enable::OVERLAPCHECK || Enable::BECAL_OVERLAPCHECK;
76 
77  ostringstream mapping_becal;
78  mapping_becal << getenv("CALIBRATIONROOT") << "/BarrelEcal/mapping/towerMap_BEMC_v001.txt";
79 
81  becal->set_string_param("mapping_file", mapping_becal.str());
82  becal->OverlapCheck(OverlapCheck);
83  becal->SetActive();
84  becal->SuperDetector("BECAL");
85  if (AbsorberActive) becal->SetAbsorberActive();
86 
87  g4Reco->registerSubsystem(becal);
88 
89  return G4BECAL::topradius;
90 
91 }
92 
93 void BECAL_Cells(int verbosity = 0)
94 {
95  return;
96 }
97 
99 {
100 
102 
104 
105  ostringstream mapping_BECAL;
106  mapping_BECAL << getenv("CALIBRATIONROOT") << "/BarrelEcal/mapping/towerMap_BEMC_v001.txt";
107 
108  const double photoelectron_per_GeV = 5000;
109 
110  RawTowerBuilderByHitIndexBECAL *tower_BECAL = new RawTowerBuilderByHitIndexBECAL("TowerBuilder_BECAL");
111  tower_BECAL->Detector("BECAL");
112  tower_BECAL->set_sim_tower_node_prefix("SIM");
113  tower_BECAL->EminCut(1e-7);
114  tower_BECAL->GeometryTableFile(mapping_BECAL.str());
115  tower_BECAL->Verbosity(verbosity);
116  se->registerSubsystem(tower_BECAL);
117 
118  RawTowerDigitizer *TowerDigitizer_BECAL = new RawTowerDigitizer("BECALRawTowerDigitizer");
119  TowerDigitizer_BECAL->Detector("BECAL");
120  TowerDigitizer_BECAL->Verbosity(verbosity);
121 // TowerDigitizer_BECAL->Verbosity(verbosity);
122  TowerDigitizer_BECAL->set_digi_algorithm(G4BECAL::TowerDigi);
123  TowerDigitizer_BECAL->set_raw_tower_node_prefix("RAW");
124  TowerDigitizer_BECAL->set_pedstal_central_ADC(0);
125  TowerDigitizer_BECAL->set_pedstal_width_ADC(0); // eRD1 test beam setting
126  TowerDigitizer_BECAL->set_photonelec_ADC(1); // not simulating ADC discretization error
127  TowerDigitizer_BECAL->set_photonelec_yield_visible_GeV(photoelectron_per_GeV);
128  TowerDigitizer_BECAL->set_zero_suppression_ADC(0); // eRD1 test beam setting
129  se->registerSubsystem(TowerDigitizer_BECAL);
130 
131  RawTowerCalibration *TowerCalibration_BECAL = new RawTowerCalibration("BECALRawTowerCalibration");
132  TowerCalibration_BECAL->Detector("BECAL");
133  TowerCalibration_BECAL->Verbosity(verbosity);
135  TowerCalibration_BECAL->set_calib_const_GeV_ADC(1. / photoelectron_per_GeV);
136  TowerCalibration_BECAL->set_pedstal_ADC(0);
137  se->registerSubsystem(TowerCalibration_BECAL);
138 
139 }
140 
142 {
143 
144  return;
145 }
146 
147 void BECAL_Eval(const std::string &outputfile)
148 {
151 
152  CaloEvaluator *eval = new CaloEvaluator("BECALEVALUATOR", "BECAL", outputfile.c_str());
153  eval->set_do_cluster_eval(false);
154  eval->Verbosity(1);
155  se->registerSubsystem(eval);
156 
157  return;
158 }
159 #endif