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