ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4_HcalOut_ref.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4_HcalOut_ref.C
1 #ifndef MACRO_G4HCALOUTREF_C
2 #define MACRO_G4HCALOUTREF_C
3 
4 #include <GlobalVariables.C>
5 #include <QA.C>
6 
9 
12 
13 #include <g4eval/CaloEvaluator.h>
14 
15 #include <g4main/PHG4Reco.h>
16 
19 
20 #include <caloreco/RawClusterBuilderGraph.h>
21 #include <caloreco/RawClusterBuilderTemplate.h>
22 #include <caloreco/RawTowerCalibration.h>
23 #include <qa_modules/QAG4SimulationCalorimeter.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 R__LOAD_LIBRARY(libqa_modules.so)
32 
33 namespace Enable
34 {
35  bool HCALOUT = false;
36  bool HCALOUT_ABSORBER = false;
37  bool HCALOUT_OVERLAPCHECK = false;
38  bool HCALOUT_CELL = false;
39  bool HCALOUT_TOWER = false;
40  bool HCALOUT_CLUSTER = false;
41  bool HCALOUT_EVAL = false;
42  bool HCALOUT_QA = false;
44 } // namespace Enable
45 
46 namespace G4HCALOUT
47 {
48  double outer_radius = 264.71;
49  double size_z = 304.91 * 2;
50 
51  // Digitization (default photon digi):
53  // directly pass the energy of sim tower to digitized tower
54  // kNo_digitization
55  // simple digitization with photon statistics, single amplitude ADC conversion and pedestal
56  // kSimple_photon_digitization
57  // digitization with photon statistics on SiPM with an effective pixel N, ADC conversion and pedestal
58  // kSiPM_photon_digitization
59 
61  {
64  };
65 
69  //enu_HCalOut_clusterizer HCalOut_clusterizer = kHCalOutGraphClusterizer;
70 } // namespace G4HCALOUT
71 
72 // Init is called by G4Setup.C
74 {
78 }
79 
80 double HCalOuter(PHG4Reco *g4Reco,
81  double radius,
82  const int crossings)
83 {
84  bool AbsorberActive = Enable::ABSORBER || Enable::HCALOUT_ABSORBER;
87 
88  PHG4OuterHcalSubsystem *hcal = new PHG4OuterHcalSubsystem("HCALOUT");
89  // hcal->set_double_param("inner_radius", 183.3);
90  //-----------------------------------------
91  // the light correction can be set in a single call
92  // hcal->set_double_param("light_balance_inner_corr", NAN);
93  // hcal->set_double_param("light_balance_inner_radius", NAN);
94  // hcal->set_double_param("light_balance_outer_corr", NAN);
95  // hcal->set_double_param("light_balance_outer_radius", NAN);
96  // hcal->set_double_param("magnet_cutout_radius", 195.31);
97  // hcal->set_double_param("magnet_cutout_scinti_radius", 195.96);
98  // hcal->SetLightCorrection(NAN,NAN,NAN,NAN);
99  //-----------------------------------------
100  // hcal->set_double_param("outer_radius", G4HCALOUT::outer_radius);
101  // hcal->set_double_param("place_x", 0.);
102  // hcal->set_double_param("place_y", 0.);
103  // hcal->set_double_param("place_z", 0.);
104  // hcal->set_double_param("rot_x", 0.);
105  // hcal->set_double_param("rot_y", 0.);
106  // hcal->set_double_param("rot_z", 0.);
107  // hcal->set_double_param("scinti_eta_coverage", 1.1);
108  // hcal->set_double_param("scinti_gap", 0.85);
109  // hcal->set_double_param("scinti_gap_neighbor", 0.1);
110  // hcal->set_double_param("scinti_inner_radius",183.89);
111  // hcal->set_double_param("scinti_outer_radius",263.27);
112  // hcal->set_double_param("scinti_tile_thickness", 0.7);
113  // hcal->set_double_param("size_z", G4HCALOUT::size_z);
114  // hcal->set_double_param("steplimits", NAN);
115  // hcal->set_double_param("tilt_angle", -11.23);
116 
117  // hcal->set_int_param("light_scint_model", 1);
118  // hcal->set_int_param("magnet_cutout_first_scinti", 8);
119  // hcal->set_int_param("ncross", 0);
120  // hcal->set_int_param("n_towers", 64);
121  // hcal->set_int_param("n_scinti_plates_per_tower", 5);
122  // hcal->set_int_param("n_scinti_tiles", 12);
123 
124  // hcal->set_string_param("material", "Steel_1006");
125 
126  hcal->SetActive();
127  hcal->SuperDetector("HCALOUT");
128  if (AbsorberActive)
129  {
130  hcal->SetAbsorberActive();
131  }
132  hcal->OverlapCheck(OverlapCheck);
133  g4Reco->registerSubsystem(hcal);
134 
135  radius = hcal->get_double_param("outer_radius");
136 
137  radius += no_overlapp;
138 
139  return radius;
140 }
141 
143 {
145 
147 
148  PHG4HcalCellReco *hc = new PHG4HcalCellReco("HCALOUT_CELLRECO");
149  hc->Detector("HCALOUT");
150  // hc->Verbosity(2);
151  // check for energy conservation - needs modified "infinite" timing cuts
152  // 0-999999999
153  // hc->checkenergy();
154  // timing cuts with their default settings
155  // hc->set_double_param("tmin",0.);
156  // hc->set_double_param("tmax",60.0);
157  // or all at once:
158  // hc->set_timing_window(0.0,60.0);
159  se->registerSubsystem(hc);
160 
161  return;
162 }
163 
165 {
167 
169 
170  HcalRawTowerBuilder *TowerBuilder = new HcalRawTowerBuilder("HcalOutRawTowerBuilder");
171  TowerBuilder->Detector("HCALOUT");
172  TowerBuilder->set_sim_tower_node_prefix("SIM");
173  TowerBuilder->Verbosity(verbosity);
174  se->registerSubsystem(TowerBuilder);
175 
176  // From 2016 Test beam sim
177  RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("HcalOutRawTowerDigitizer");
178  TowerDigitizer->Detector("HCALOUT");
179  // TowerDigitizer->set_raw_tower_node_prefix("RAW_LG");
180  TowerDigitizer->set_digi_algorithm(G4HCALOUT::TowerDigi);
181  TowerDigitizer->set_pedstal_central_ADC(0);
182  TowerDigitizer->set_pedstal_width_ADC(1); // From Jin's guess. No EMCal High Gain data yet! TODO: update
183  TowerDigitizer->set_photonelec_ADC(16. / 5.);
184  TowerDigitizer->set_photonelec_yield_visible_GeV(16. / 5 / (0.2e-3));
185  TowerDigitizer->set_zero_suppression_ADC(-0); // no-zero suppression
186  se->registerSubsystem(TowerDigitizer);
187 
188  const double visible_sample_fraction_HCALOUT = 3.38021e-02; // /gpfs/mnt/gpfs04/sphenix/user/jinhuang/prod_analysis/hadron_shower_res_nightly/./G4Hits_sPHENIX_pi-_eta0_16GeV.root_qa.rootQA_Draw_HCALOUT_G4Hit.pdf
189 
190  RawTowerCalibration *TowerCalibration = new RawTowerCalibration("HcalOutRawTowerCalibration");
191  TowerCalibration->Detector("HCALOUT");
192  // TowerCalibration->set_raw_tower_node_prefix("RAW_LG");
193  // TowerCalibration->set_calib_tower_node_prefix("CALIB_LG");
196  {
197  TowerCalibration->set_calib_const_GeV_ADC(1. / visible_sample_fraction_HCALOUT);
198  }
199  else
200  {
201  TowerCalibration->set_calib_const_GeV_ADC(0.2e-3 / visible_sample_fraction_HCALOUT);
202  }
203  TowerCalibration->set_pedstal_ADC(0);
204  se->registerSubsystem(TowerCalibration);
205 
206  return;
207 }
208 
210 {
212 
214 
216  {
217  RawClusterBuilderHelper *ClusterBuilder = new RawClusterBuilderkV3("HcalOuRawClusterBuilderkV3");
218  ClusterBuilder->Detector("HCALOUT");
219  ClusterBuilder->set_seed_e(0.5);
220  ClusterBuilder->set_agg_e(0.1);
221  se->registerSubsystem(ClusterBuilder);
222  /*
223  RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("HcalOutRawClusterBuilderTemplate");
224  ClusterBuilder->Detector("HCALOUT");
225  ClusterBuilder->SetCylindricalGeometry(); // has to be called after Detector()
226  ClusterBuilder->Verbosity(verbosity);
227  se->registerSubsystem(ClusterBuilder);
228  */
229  }
231  {
232  RawClusterBuilderGraph *ClusterBuilder = new RawClusterBuilderGraph("HcalOutRawClusterBuilderGraph");
233  ClusterBuilder->Detector("HCALOUT");
234  ClusterBuilder->Verbosity(verbosity);
235  se->registerSubsystem(ClusterBuilder);
236  }
237  else
238  {
239  cout << "HCALOuter_Clusters - unknown clusterizer setting!" << endl;
240  exit(1);
241  }
242 
243  return;
244 }
245 
246 void HCALOuter_Eval(const std::string &outputfile)
247 {
249 
251 
252  CaloEvaluator *eval = new CaloEvaluator("HCALOUTEVALUATOR", "HCALOUT", outputfile);
253  eval->Verbosity(verbosity);
254  se->registerSubsystem(eval);
255 
256  return;
257 }
258 
260 {
262 
265  qa->Verbosity(verbosity);
266  se->registerSubsystem(qa);
267 
268  return;
269 }
270 
271 #endif