ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4_BWD.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4_BWD.C
1 #ifndef MACRO_G4BWD_C
2 #define MACRO_G4BWD_C
3 
4 #include <GlobalVariables.C>
5 
6 //include our own Bwd Raw Tower Builder
7 #include <eicg4bwd/BwdRawTowerBuilderByHitIndex.h>
8 
10 
12 // Use Forward Cal Cell Reco .
13 
14 #include <eicg4bwd/EICG4BwdSubsystem.h>
15 // Include our Subsystem
16 
17 //Standard RawTowerDefs.h is modified
18 
19 #include <g4eval/CaloEvaluator.h>
20 
21 #include <g4main/PHG4Reco.h>
22 
25 
26 #include <caloreco/RawClusterBuilderFwd.h>
27 #include <caloreco/RawClusterBuilderTemplate.h>
28 #include <caloreco/RawTowerCalibration.h>
29 
30 #include <fun4all/Fun4AllServer.h>
31 
32 R__LOAD_LIBRARY(libcalo_reco.so)
33 R__LOAD_LIBRARY(libg4calo.so)
34 R__LOAD_LIBRARY(libg4eiccalos.so)
35 R__LOAD_LIBRARY(libg4eval.so)
36 
37 namespace Enable
38 {
39  bool BWD = false;
40  bool BWDN[5]={true,false,false,false,false};
41  bool BWD_ABSORBER = false;
42  bool BWD_CELL = false;
43  bool BWD_TOWER = false;
44  bool BWD_CLUSTER = false;
45  bool BWD_EVAL = false;
46  bool BWD_OVERLAPCHECK = false;
47  int BWD_VERBOSITY = 0;
48 } // namespace Enable
49 
50 
51 namespace G4BWD
52 {
53 
54  string mapname[5]={"BWD_mapping_v1.txt","BWD_mapping_v2.txt","BWD_mapping_v3.txt","BWD_mapping_v4.txt","BWD_mapping_v5.txt"};
55  double minz = -5000;
56  double maxz = -300;
57  double radius = 100;
58 
59  // Default set to B0 Ecal position at IP6
60 
61  // Digitization (default photon digi):
63  // directly pass the energy of sim tower to digitized tower
64  // kNo_digitization
65  // simple digitization with photon statistics, single amplitude ADC conversion and pedestal
66  // kSimple_photon_digitization
67  // digitization with photon statistics on SiPM with an effective pixel N, ADC conversion and pedestal
68  // kSiPM_photon_digitization
69 
70 } // namespace G4B0ECAL
71 
72 void BWDInit()
73 {
74 }
75 
76 void BWDSetup(PHG4Reco *g4Reco)
77 {
78 //Done in G4_hFarBwdBeamLine.C
79 }
80 
81 void BWD_Cells(int verbosity = 0)
82 {
83  return;
84 }
85 
86 void BWD_Towers()
87 {
89 
90 
91 for (int i = 0; i < 5; i++){
92  if (!Enable::BWDN[i])continue;
94  ostringstream mapping_bwd;
95  mapping_bwd << getenv("CALIBRATIONROOT") << "/BWD/mapping/"<<G4BWD::mapname[i];
96  //mapping_bwd << G4BWD::mapname[i];
97  BwdRawTowerBuilderByHitIndex *tower_BWD = new BwdRawTowerBuilderByHitIndex(Form("TowerBuilder_BWD_%d", i));
98  tower_BWD->Detector(Form("BWD_%d", i));
99  tower_BWD->set_sim_tower_node_prefix("SIM");
100  tower_BWD->GeometryTableFile(mapping_bwd.str());
101 
102  se->registerSubsystem(tower_BWD);
103 
104 
105  RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer(Form("BWDRawTowerDigitizer_%d",i));
106  TowerDigitizer->Detector(Form("BWD_%d", i));
107  TowerDigitizer->Verbosity(verbosity);
109  se->registerSubsystem(TowerDigitizer);
110 
111  RawTowerCalibration *TowerCalibration = new RawTowerCalibration(Form("BWDRawTowerCalibration_%d",i));
112  TowerCalibration->Detector(Form("BWD_%d", i));
113  TowerCalibration->Verbosity(verbosity);
115  TowerCalibration->set_calib_const_GeV_ADC(1. );
116  TowerCalibration->set_pedstal_ADC(0);
117  se->registerSubsystem(TowerCalibration);
118 }
119 }
120 
122 {
124 
125 for (int i = 0; i < 5; i++){
126  if (!Enable::BWDN[i])continue;
128  RawClusterBuilderFwd *ClusterBuilder = new RawClusterBuilderFwd(Form("BWDRawClusterBuilderFwd_%d",i));
129  ClusterBuilder->Detector(Form("BWD_%d", i));
130  ClusterBuilder->Verbosity(verbosity);
131  ClusterBuilder->set_threshold_energy(0.100);
132  se->registerSubsystem(ClusterBuilder);
133 }
134  return;
135 }
136 
137 void BWD_Eval(const std::string &outputfile)
138 {
140  string filename=outputfile.c_str();
141 for (int i = 0; i < 5; i++){
142  if (!Enable::BWDN[i])continue;
144  CaloEvaluator *eval = new CaloEvaluator(Form("BWDEVALUATOR_%d",i), Form("BWD_%d", i), (filename+Form("_%d.root",i)) );
145  eval->Verbosity(verbosity);
146  se->registerSubsystem(eval);
147 }
148  return;
149 }
150 #endif