Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Fun4All_TestBeam_HCAL_TowerCalib.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Fun4All_TestBeam_HCAL_TowerCalib.C
1 #pragma once
2 #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0)
3 #include <fun4all/SubsysReco.h>
11 #include <proto4showercalib/Proto4ShowerCalib.h>
12 
13 R__LOAD_LIBRARY(libfun4all.so)
14 R__LOAD_LIBRARY(libPrototype4.so)
15 R__LOAD_LIBRARY(/direct/phenix+u/xusun/WorkSpace/sPHENIX/install/lib/libProto4HCalTowerCalib.so)
16 #endif
17 
18 int
19 Fun4All_TestBeam_HCAL_TowerCalib(const int nEvents = 50000, const int colID = 0, const string det = "HCALOUT")
20 // Fun4All_TestBeam_HCAL_TowerCalib(const int nEvents = 1000, const int runID = 0)
21 {
22 
23  //---------------
24  // Load libraries
25  //---------------
26  gSystem->Load("libPrototype4.so");
27  gSystem->Load("libfun4all.so");
28  // gSystem->Load("libg4detectors.so");
29  // gSystem->Load("libphhepmc.so");
30  // gSystem->Load("libg4testbench.so");
31  // gSystem->Load("libg4hough.so");
32  // gSystem->Load("libg4eval.so");
33 
34  //---------------
35  // Fun4All server
36  //---------------
37 
39  se->Verbosity(1);
40 
41  //--------------
42  // IO management
43  //--------------
44 
45  bool _is_sim = false;
46  // Hits file
47  Fun4AllInputManager *hitsin = new Fun4AllDstInputManager("DSTin");
48  std::string inputlist;
49  if(_is_sim) inputlist = Form("../list/Cosmic_SIM_%s_col_%d.list",det.c_str(),colID);
50  if(!_is_sim) inputlist = Form("../list/Cosmic_RAW_%s_col_%d.list",det.c_str(),colID);
51  hitsin->AddListFile(inputlist); // you can also choose this and give a list of DST file names in the file.
52  se->registerInputManager(hitsin);
53 
54  //load your analysis module's lib
55  gSystem->Load("/direct/phenix+u/xusun/WorkSpace/sPHENIX/install/lib/libProto4HCalTowerCalib.so");
56 
57  //load your analysis module.
58  std::string outputfile;
59  if(_is_sim) outputfile = Form("/sphenix/user/xusun/TestBeam/TowerCalib/Proto4TowerInfoSIM_%s_%d.root",det.c_str(),colID);
60  if(!_is_sim) outputfile = Form("/sphenix/user/xusun/TestBeam/TowerCalib/Proto4TowerInfoRAW_%s_%d.root",det.c_str(),colID);
61 
62  Proto4TowerCalib* hcal_ana = new Proto4TowerCalib(outputfile.c_str());
63  hcal_ana->is_sim(_is_sim);
64  se->registerSubsystem(hcal_ana);
65 
66  se->run(nEvents);
67  se->End();
68 
69  std::cout << "All done" << std::endl;
70  delete se;
71  gSystem->Exit(0);
72 }