Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Fun4All_CaloTreeGen.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Fun4All_CaloTreeGen.C
1 // c++ includes --
2 #include <string>
3 #include <iostream>
4 
5 // root includes --
6 #include <TSystem.h>
7 
8 #include <fun4all/SubsysReco.h>
12 
15 #include <fun4all/Fun4AllServer.h>
16 
17 #include <phool/PHRandomSeed.h>
18 #include <phool/recoConsts.h>
19 
20 #include <calotreegen/caloTreeGen.h>
21 
22 using std::cout;
23 using std::endl;
24 using std::string;
25 
26 R__LOAD_LIBRARY(libfun4all.so)
27 R__LOAD_LIBRARY(libcaloTreeGen.so)
28 
29 void Fun4All_CaloTreeGen(const string &file,
30  const int event = 0,
31  const int run = 0,
32  const float tow_cemc_min = 0,
33  const float tow_hcalin_min = 0,
34  const float tow_hcalout_min = 0,
35  const string& eventFile = "test.json",
36  const string &output = "commissioning.root") {
37 
39  // recoConsts *rc = recoConsts::instance();
40 
42  // in->AddListFile(file);
43  in->AddFile(file);
44  se->registerInputManager(in);
45 
46  caloTreeGen *calo = new caloTreeGen(output, eventFile, event, run, tow_cemc_min, tow_hcalin_min, tow_hcalout_min);
47  se->registerSubsystem(calo);
48 
49  // se->skip(skip);
50  se->run(event+1);
51  se->End();
52  se->PrintTimer();
53  std::cout << "All done!" << std::endl;
54 
55  gSystem->Exit(0);
56 }
57 
58 # ifndef __CINT__
59 int main(int argc, char* argv[]) {
60  if(argc < 2 || argc > 9){
61  cout << "usage: ./bin/Fun4All_CaloTreeGen inputFile event run tow_cemc_min tow_hcalin_min tow_hcalout_min eventFile outputFile" << endl;
62  cout << "inputFile: Location of fileList or file containing dst." << endl;
63  cout << "event: Event number to analyze." << endl;
64  cout << "run: Run number." << endl;
65  cout << "tow_cemc_min: Minimum tower energy for CEMC." << endl;
66  cout << "tow_hcalin_min: Minimum tower energy for HCALIN." << endl;
67  cout << "tow_hcalout_min: Minimum tower energy for HCALOUT." << endl;
68  cout << "eventFile: name of event File." << endl;
69  cout << "outputFile: name of output file." << endl;
70  return 1;
71  }
72 
73  string inputFile;
74  UInt_t event = 0;
75  UInt_t run = 0;
76  Float_t tow_cemc_min = 0;
77  Float_t tow_hcalin_min = 0;
78  Float_t tow_hcalout_min = 0;
79  string eventFile = "test.json";
80  string outputFile = "commissioning.root";
81 
82  if(argc >= 2) {
83  inputFile = argv[1];
84  }
85  if(argc >= 3) {
86  event = atoi(argv[2]);
87  }
88  if(argc >= 4) {
89  run = atoi(argv[3]);
90  }
91  if(argc >= 5) {
92  tow_cemc_min = atof(argv[4]);
93  }
94  if(argc >= 6) {
95  tow_hcalin_min = atof(argv[5]);
96  }
97  if(argc >= 7) {
98  tow_hcalout_min = atof(argv[6]);
99  }
100  if(argc >= 8) {
101  eventFile = argv[7];
102  }
103  if(argc >= 9) {
104  outputFile = argv[8];
105  }
106 
107  Fun4All_CaloTreeGen(inputFile, event, run, tow_cemc_min, tow_hcalin_min, tow_hcalout_min, eventFile, outputFile);
108 
109  cout << "done" << endl;
110  return 0;
111 }
112 # endif