Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
plain_sim_dst_simple_preNov23.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file plain_sim_dst_simple_preNov23.C
1 #pragma once
2 #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0)
3 #include <fun4all/SubsysReco.h>
9 //#include <rawwaveformtowerbuilder/RawWaveformTowerBuilder.h>
11 
12 //#include <litecaloeval/LiteCaloEval.h>
13 #include <caloreco/CaloTowerCalib.h>
14 #include <caloreco/RawClusterBuilderTemplate.h>
15 #include <calib_emc_pi0/CaloCalibEmc_Pi0.h>
16 
17 #include <phool/recoConsts.h>
19 
20 
21 R__LOAD_LIBRARY(libfun4all.so)
22 R__LOAD_LIBRARY(libfun4allraw.so)
23 R__LOAD_LIBRARY(libcalo_reco.so)
24 //R__LOAD_LIBRARY(libLiteCaloEvalTowSlope.so)
25 R__LOAD_LIBRARY(libcalibCaloEmc_pi0.so)
26 
27 
28 
29 #endif
30 
31 // to get files from my local area
32 void clus_dst_simple_superfastcalib( const int file_num = 0 )
33 
34 {
35  const int nEvents = -1;
36 
38  se->Verbosity(0);
39 
41 
42  string inputFile0 = "DST_CALO_G4HIT_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000007-";
43  string inputFile1 = "DST_CALO_CLUSTER_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000007-";
44  //string inputFile2 = "DST_TRUTH_G4HIT_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000007-";
45  string inputFile3 = "DST_GLOBAL_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000007-";
46 
47  string outputFile = "RESULTS/mult_clus_ntuple/iter_23/Fun4All_ntuples_run7_sHijing_iter23_";
48 
49  int ynum_int = 100000 + file_num;
50  TString yn_tstr = "";
51  yn_tstr += ynum_int;
52  yn_tstr.Remove(0,1);
53  inputFile0 += yn_tstr.Data();
54  inputFile1 += yn_tstr.Data();
55  //inputFile2 += yn_tstr.Data();
56  inputFile3 += yn_tstr.Data();
57  outputFile += yn_tstr.Data();
58 
59  inputFile0 += ".root";
60  inputFile1 += ".root";
61  //inputFile2 += ".root";
62  inputFile3 += ".root";
63  outputFile += ".root";
64 
65  std::cout << "-------------------------------------------------------------------" << std::endl;
66  std::cout << " input files are" << std::endl;
67  std::cout << "-------------------------------------------------------------------" << std::endl;
68  std::cout << inputFile0 << std::endl;
69  std::cout << inputFile1 << std::endl;
70  //std::cout << inputFile2 << std::endl;
71  std::cout << inputFile3 << std::endl;
72 
73  std::cout << "-------------------------------------------------------------------" << std::endl;
74  std::cout << "output file is " << std::endl;
75  std::cout << "-------------------------------------------------------------------" << std::endl;
76  std::cout << outputFile << std::endl;
77 
78 
79  gSystem->Load("libg4dst");
80 
81  //Fun4AllServer *se = Fun4AllServer::instance();
82 
83  // CaloWaveFormSim *ca = new CaloWaveFormSim("CALOWAVEFORMSIM",outfile);
84  // ca->Detector("CEMC");
85  // se->registerSubsystem(ca);
86 
87  // Fun4AllInputManager *in = new Fun4AllPrdfInputManager("in");
88  // in->fileopen(fname);
89 
91  in1->fileopen(inputFile1);
92  se->registerInputManager(in1);
93 
95  in3->fileopen(inputFile3);
96  se->registerInputManager(in3);
97 
98  //CaloTowerBuilder *ca = new CaloTowerBuilder();
99  //Enable::CDB = true;
100 
102  //===============
103  // conditions DB flags
104  //===============
105  // global tag
106  rc->set_StringFlag("CDB_GLOBALTAG","MDC2");
107  // // 64 bit timestamp
108  rc->set_uint64Flag("TIMESTAMP",6);
109 
110 
111  CaloTowerCalib *calib = new CaloTowerCalib("CALO_TOWER_CEMC");
112  // make sure there is not any mistake in "full file path + name"
113  // for first iteration file name can be any as we will not use correction factor and default is "1"
114  calib->setCalibUseMode(1); // decide if we want to use correction factor("0" = do not use (set for first iteration), "1" = use (set for remaining))
115 
116  // these two lines are needed to choose your own correction factor (this is filename)
117  calib->setCalibName("/sphenix/user/sregmi/WORKING_AREA/PI_0/pi0_calib_m-clust/CDB_CEMC/iter_file/m_clust_pi0_iter22_CDB.root");
118  calib->setFieldName("cemc_pi0_abs_calib"); // (this is field name)
120 
121  se->registerSubsystem(calib);
122 
123 
124  RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplate2");
125  ClusterBuilder->Detector("CEMC");
126  ClusterBuilder->Verbosity(10);
127  ClusterBuilder->set_threshold_energy(0.032); // This threshold should be the same as in CEMCprof_Thresh**.root file below
128  std::string emc_prof = getenv("CALIBRATIONROOT");
129  emc_prof += "/EmcProfile/CEMCprof_Thresh30MeV.root";
130  ClusterBuilder->LoadProfile(emc_prof);
131  ClusterBuilder->set_UseTowerInfo(1); // to use towerinfo objects rather than old RawTower
132  se->registerSubsystem(ClusterBuilder);
133 
134 
135  CaloCalibEmc_Pi0 *eval_pi2 = new CaloCalibEmc_Pi0("dummy", outputFile);
136  // this call is needed for embedding
137  // eval_pi2->set_centrality_nclusters_cut(350); // which uses more central events
138  // than we will for data to enhance Bkg
139  // to match the enhanced signal from embed
140  eval_pi2->set_UseTowerInfo(1); // to use towerinfo objects rather than old RawTower
141  se->registerSubsystem(eval_pi2);
142 
143 
144  // in->AddListFile("g4hits.list");
145 
146 // Fun4All
147 // se->registerInputManager(in);
148 
149  //Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", "testoutput_400.root");
150 
151  //out->StripNode("WAVEFORMS_CEMC");
152  //se->registerOutputManager(out);
153 
154  se->run(nEvents);
155 
156  se->End();
157  se->PrintTimer();
158  gSystem->Exit(0);
159 }