Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
srundst_mdc2_clustest.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file srundst_mdc2_clustest.C
1 #pragma once
2 #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0)
3 #include <fun4all/SubsysReco.h>
8 //#include <calotowerbuilder/RawWaveformTowerBuilder.h>
10 #include <litecaloeval/LiteCaloEval.h>
11 
12 #include <calib_emc_pi0/CaloCalibEmc_Pi0.h>
13 
14 #include <caloreco/RawClusterBuilderGraph.h>
15 #include <caloreco/RawClusterBuilderTemplate.h>
16 #include <caloreco/RawClusterPositionCorrection.h>
17 #include <caloreco/RawTowerCalibration.h>
18 
19 
20 R__LOAD_LIBRARY(libfun4all.so)
21 //R__LOAD_LIBRARY(libfun4allraw.so)
22 R__LOAD_LIBRARY(libcalo_reco.so)
23 R__LOAD_LIBRARY(libcalibCaloEmc_pi0.so)
24 R__LOAD_LIBRARY(libLiteCaloEvalTowSlope.so)
25 
26 
27 #endif
28 
29 // void Fun4All_TowerBuilder(const char *fname = "/sphenix/data/data02/sphenix/cemc/combinedEvents/EmCalSEB01-000000222-0000_x.prdf", const char *outfile = "trees/0.root")
31  const int nEvents = 5,
32  const string &outputFile = "secoutput4_raw",
33  const string &inputFile0 = "ongoing/dstnewoutput5_calo5.root"
34  //const string &inputFile1 = "DST_VERTEX_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000004-10000.root",
35  // const int mdc2_4_file_num = 1,
36  )
37 {
38 
39  // gSystem->Load("libg4dst");
40 
42 
43 /*
44  string inputFile0 = "DST_CALO_CLUSTER_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000062-";
45  string inputFile1 = "DST_VERTEX_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000062-";
46 
47 
48  int ynum_int = 100000+ mdc2_4_file_num;
49  TString yn_tstr = "";
50  yn_tstr += ynum_int;
51  yn_tstr.Remove(0,1);
52  inputFile0 += yn_tstr.Data();
53  inputFile1 += yn_tstr.Data();
54 
55  inputFile0 += ".root";
56  inputFile1 += ".root";
57 
58  cout << "running over these files" << endl;
59  cout << inputFile0 << endl;
60  cout << inputFile1 << endl;
61 */
62 
63  // CaloWaveFormSim *ca = new CaloWaveFormSim("CALOWAVEFORMSIM",outfile);
64  // ca->Detector("CEMC");
65  // se->registerSubsystem(ca);
66 
67  // Fun4AllInputManager *in = new Fun4AllPrdfInputManager("in");
68  // in->fileopen(fname);
69 
71 
72 // in->fileopen(inputFile0.c_str());
73 // in->fileopen(inputFile1.c_str());
74  in->AddFile(inputFile0.c_str());
75 //in->AddFile(inputFile1.c_str());
76 
77  //CaloTowerBuilder *ca = new CaloTowerBuilder();
78  // RawWaveformTowerBuilder *rw = new RawWaveformTowerBuilder();
79 
80  // rw->set_detector_type(RawWaveformTowerBuilder::CEMC);
81  // se->registerSubsystem(rw);
83 
84 
85 
87  // in->AddListFile("g4hits.list");
88 
89 
90 
91 // Fun4All
92  se->registerInputManager(in);
93 
94 
95  RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplate");
96  ClusterBuilder->Detector("CEMC");
97 // ClusterBuilder->Verbosity(verbosity);
98  ClusterBuilder->set_threshold_energy(0.030); // This threshold should be the same as in CEMCprof_Thresh**.root file below
99  std::string emc_prof = getenv("CALIBRATIONROOT");
100  emc_prof += "/EmcProfile/CEMCprof_Thresh30MeV.root";
101  ClusterBuilder->LoadProfile(emc_prof);
102  se->registerSubsystem(ClusterBuilder);
103 
104 
105  RawClusterPositionCorrection *clusterCorrection = new RawClusterPositionCorrection("CEMC");
106 
107  clusterCorrection->Get_eclus_CalibrationParameters().ReadFromFile("CEMC_RECALIB", "xml", 0, 0,
108  //raw location
109  string(getenv("CALIBRATIONROOT")) + string("/CEMC/PositionRecalibration_EMCal_9deg_tilt/"));
110  clusterCorrection->Get_ecore_CalibrationParameters().ReadFromFile("CEMC_ECORE_RECALIB", "xml", 0, 0,
111  //raw location
112  string(getenv("CALIBRATIONROOT")) + string("/CEMC/PositionRecalibration_EMCal_9deg_tilt/"));
113 
114 
115 //clusterCorrection->Verbosity(verbosity);
116  se->registerSubsystem(clusterCorrection);
117 
118 
119 
120  RawClusterBuilderTemplate *ClusterBuilder2 = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplate2");
121  ClusterBuilder2->Detector("CEMC");
122  // ClusterBuilder2->Verbosity(verbosity);
123  ClusterBuilder2->set_threshold_energy(0.030); // This threshold should be the same as in CEMCprof_Thresh**.root file below
124  std::string emc_prof2 = getenv("CALIBRATIONROOT");
125  emc_prof2 += "/EmcProfile/CEMCprof_Thresh30MeV.root";
126  ClusterBuilder2->LoadProfile(emc_prof2);
127  ClusterBuilder2->set_UseTowerInfo(1);
128  se->registerSubsystem(ClusterBuilder2);
129 
130  RawClusterPositionCorrection *clusterCorrection2 = new RawClusterPositionCorrection("CEMC");
131 
132  clusterCorrection2->set_UseTowerInfo(1);
133  if (false)
134  {
135  clusterCorrection2->Get_eclus_CalibrationParameters().ReadFromCDB("CEMCRECALIB");
136  clusterCorrection2->Get_ecore_CalibrationParameters().ReadFromCDB("CEMC_ECORE_RECALIB");
137  }
138  else
139  {
140  clusterCorrection2->Get_eclus_CalibrationParameters().ReadFromFile("CEMC_RECALIB", "xml", 0, 0,
141  //raw location
142  string(getenv("CALIBRATIONROOT")) + string("/CEMC/PositionRecalibration_EMCal_9deg_tilt/"));
143  clusterCorrection2->Get_ecore_CalibrationParameters().ReadFromFile("CEMC_ECORE_RECALIB", "xml", 0, 0,
144  //raw location
145  string(getenv("CALIBRATIONROOT")) + string("/CEMC/PositionRecalibration_EMCal_9deg_tilt/"));
146  }
147 
148  // clusterCorrection2->Verbosity(verbosity);
149  se->registerSubsystem(clusterCorrection2);
150 
151 
152 
153  string outputFile2 = outputFile.c_str();
154  outputFile2 = outputFile2 + ".root";
155  string outputfile5 = outputFile2 + "_cemc_eval5.root";
156  string outputFile3 = outputFile2 + "_cemc_eval3.root";
157 
158 
159 
160  LiteCaloEval *eval5 = new LiteCaloEval("CEMCEVALUATOR2", "CEMC", outputfile5.c_str());
161  // eval->Verbosity(verbosity);
163  se->registerSubsystem(eval5);
164 
165 
166  CaloCalibEmc_Pi0 *eval_pi1 = new CaloCalibEmc_Pi0("CEMC_CALIB_PI0", outputFile2);
167  // eval_pi1->set_mode(1);
168  // eval->Verbosity(verbosity);
169  se->registerSubsystem(eval_pi1);
170 
171 
172  CaloCalibEmc_Pi0 *eval_pi2 = new CaloCalibEmc_Pi0("CEMC_CALIB_PI02", outputFile3);
173  // eval_pi2->set_mode(1);
174  // eval->Verbosity(verbosity);
175  eval_pi2->set_UseTowerInfo(1);
176  se->registerSubsystem(eval_pi2);
177  cout << "successful registration of pi0 2" << endl;
178 
179 
180 
181  /*
182  Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", "testoutput_simfile_ver2_5.root");
183 
184  out->StripNode("WAVEFORMS_CEMC");
185  se->registerOutputManager(out);
186 
187  */
188 
189  se->run(nEvents);
190  se->End();
191  se->PrintTimer();
192  // gSystem->Exit(0);
193 }