Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Fun4All_EMCal_sp.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Fun4All_EMCal_sp.C
1 #include <caloreco/RawClusterPositionCorrection.h>
2 
4 #include <ffamodules/HeadReco.h>
5 #include <ffamodules/SyncReco.h>
6 
8 
13 #include <fun4all/Fun4AllServer.h>
14 #include <fun4all/Fun4AllUtils.h>
15 #include <fun4all/SubsysReco.h>
16 
17 #include <phool/recoConsts.h>
18 
20 #include <GlobalVariables.C>
21 
22 
23 R__LOAD_LIBRARY(libcdbobjects)
24 
25 R__LOAD_LIBRARY(libfun4all.so)
26 R__LOAD_LIBRARY(libfun4allraw.so)
27 R__LOAD_LIBRARY(libcalo_reco.so)
28 R__LOAD_LIBRARY(libffamodules.so)
29 
30 #include <caloana/CaloAna.h>
31 R__LOAD_LIBRARY(libcaloana.so)
32 
33 void Fun4All_EMCal_sp(int nevents = 100000, const std::string &fname = "inputdata_sp.txt")
34 {
35 
37  se->Verbosity(0);
38 
39  // se->Verbosity(verbosity);
41 
42  ifstream file(fname);
43  string first_file;
44  getline(file, first_file);
45 
46  //===============
47  // conditions DB flags
48  //===============
49  pair<int, int> runseg = Fun4AllUtils::GetRunSegment(first_file);
50  int runnumber = runseg.first;
51  cout << "run number = " << runnumber << endl;
52 
53  // global tag
54  rc->set_StringFlag("CDB_GLOBALTAG", "MDC2");
55  // // 64 bit timestamp
56  rc->set_uint64Flag("TIMESTAMP", runnumber);
57 
58  Fun4AllInputManager *in = new Fun4AllDstInputManager("DST_TOWERS");
59  in->AddListFile(fname);
60  se->registerInputManager(in);
61 
62  std::string filename = first_file.substr(first_file.find_last_of("/\\") + 1);
63  std::string OutFile = Form("OUTHIST_iter_%s",filename.c_str());
64 
65 
66 /*
67  std::cout << "Applying Position Dependent Correction" << std::endl;
68  RawClusterPositionCorrection *clusterCorrection = new RawClusterPositionCorrection("CEMC");
69  clusterCorrection->set_UseTowerInfo(1); // to use towerinfo objects rather than old RawTower
70  se->registerSubsystem(clusterCorrection);
71 */
72 
74  // analysis modules
75  CaloAna *ca = new CaloAna("calomodulename", OutFile);
76  ca->set_timing_cut_width(16);
77  ca->apply_vertex_cut(false);
78  ca->set_vertex_cut(20.);
79  se->registerSubsystem(ca);
80 
81  se->run(nevents);
82  se->End();
83  se->PrintTimer();
84  delete se;
85 
86  TFile* f_done_signal = new TFile("DONE.root","recreate");
87  std::cout << "All done!" << std::endl;
88  gSystem->Exit(0);
89 
90 }
91