EIC Software
 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 
10 
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 {
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 
67 
68  PHG4ZDCSubsystem *zdc = new PHG4ZDCSubsystem("ZDC",PHG4ZDCDefs::NORTH);
69 // place zdc in beam enclosure
71  zdc->OverlapCheck(OverlapCheck);
72  zdc->SetActive();
73  zdc->SuperDetector("ZDC");
74  if (AbsorberActive) zdc->SetAbsorberActive(AbsorberActive);
75  if (SupportActive) zdc->SetSupportActive(SupportActive);
77  g4Reco->registerSubsystem(zdc);
78 
79  zdc = new PHG4ZDCSubsystem("ZDC", PHG4ZDCDefs::SOUTH);
80 // place zdc in beam enclosure
82  zdc->OverlapCheck(OverlapCheck);
83  zdc->SetActive();
84  zdc->SuperDetector("ZDC");
85  if (AbsorberActive) zdc->SetAbsorberActive(AbsorberActive);
86  if (SupportActive) zdc->SetSupportActive(SupportActive);
88  g4Reco->registerSubsystem(zdc);
89 }
90 
91 void ZDC_Towers()
92 {
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);
109  se->registerSubsystem(TowerDigitizer);
110  //SMD
111  RawTowerDigitizer *TowerDigitizer1 = new RawTowerDigitizer("ZDCRawTowerDigitizer1");
112  TowerDigitizer1->Detector("ZDC");
113  TowerDigitizer1->TowerType(1);
114  TowerDigitizer1->Verbosity(verbosity);
116  se->registerSubsystem(TowerDigitizer1);
117 
118  RawTowerCalibration *TowerCalibration = new RawTowerCalibration("ZDCRawTowerCalibration");
119  TowerCalibration->Detector("ZDC");
120  TowerCalibration->TowerType(0);
121  TowerCalibration->Verbosity(verbosity);
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);
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 {
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