Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:12:32

0001 // c++ includes --
0002 #include <string>
0003 #include <iostream>
0004 
0005 // root includes --
0006 #include <TSystem.h>
0007 
0008 #include <fun4all/SubsysReco.h>
0009 #include <fun4all/Fun4AllServer.h>
0010 #include <fun4all/Fun4AllInputManager.h>
0011 #include <fun4all/Fun4AllDstInputManager.h>
0012 
0013 #include <fun4all/Fun4AllDstOutputManager.h>
0014 #include <fun4all/Fun4AllOutputManager.h>
0015 #include <fun4all/Fun4AllServer.h>
0016 
0017 #include <phool/PHRandomSeed.h>
0018 #include <phool/recoConsts.h>
0019 
0020 #include <calotreegen/caloTreeGen.h>
0021 
0022 using std::cout;
0023 using std::endl;
0024 using std::string;
0025 
0026 R__LOAD_LIBRARY(libfun4all.so)
0027 R__LOAD_LIBRARY(libcaloTreeGen.so)
0028 
0029 void Fun4All_CaloTreeGen(const string &file,
0030                          const int event = 0,
0031                          const int run = 0,
0032                          const float tow_cemc_min = 0,
0033                          const float tow_hcalin_min = 0,
0034                          const float tow_hcalout_min = 0,
0035                          const string& eventFile = "test.json",
0036                          const string &output = "commissioning.root") {
0037 
0038   Fun4AllServer *se = Fun4AllServer::instance();
0039   // recoConsts *rc = recoConsts::instance();
0040 
0041   Fun4AllInputManager *in = new Fun4AllDstInputManager("DSTcalo");
0042   // in->AddListFile(file);
0043   in->AddFile(file);
0044   se->registerInputManager(in);
0045 
0046   caloTreeGen *calo = new caloTreeGen(output, eventFile, event, run, tow_cemc_min, tow_hcalin_min, tow_hcalout_min);
0047   se->registerSubsystem(calo);
0048 
0049   // se->skip(skip);
0050   se->run(event+1);
0051   se->End();
0052   se->PrintTimer();
0053   std::cout << "All done!" << std::endl;
0054 
0055   gSystem->Exit(0);
0056 }
0057 
0058 # ifndef __CINT__
0059 int main(int argc, char* argv[]) {
0060     if(argc < 2 || argc > 9){
0061         cout << "usage: ./bin/Fun4All_CaloTreeGen inputFile event run tow_cemc_min tow_hcalin_min tow_hcalout_min eventFile outputFile" << endl;
0062         cout << "inputFile: Location of fileList or file containing dst." << endl;
0063         cout << "event: Event number to analyze." << endl;
0064         cout << "run: Run number." << endl;
0065         cout << "tow_cemc_min: Minimum tower energy for CEMC." << endl;
0066         cout << "tow_hcalin_min: Minimum tower energy for HCALIN." << endl;
0067         cout << "tow_hcalout_min: Minimum tower energy for HCALOUT." << endl;
0068         cout << "eventFile: name of event File." << endl;
0069         cout << "outputFile: name of output file." << endl;
0070         return 1;
0071     }
0072 
0073     string inputFile;
0074     UInt_t event = 0;
0075     UInt_t run = 0;
0076     Float_t tow_cemc_min = 0;
0077     Float_t tow_hcalin_min = 0;
0078     Float_t tow_hcalout_min = 0;
0079     string eventFile = "test.json";
0080     string outputFile = "commissioning.root";
0081 
0082     if(argc >= 2) {
0083         inputFile = argv[1];
0084     }
0085     if(argc >= 3) {
0086         event = atoi(argv[2]);
0087     }
0088     if(argc >= 4) {
0089         run = atoi(argv[3]);
0090     }
0091     if(argc >= 5) {
0092         tow_cemc_min = atof(argv[4]);
0093     }
0094     if(argc >= 6) {
0095         tow_hcalin_min = atof(argv[5]);
0096     }
0097     if(argc >= 7) {
0098         tow_hcalout_min = atof(argv[6]);
0099     }
0100     if(argc >= 8) {
0101         eventFile = argv[7];
0102     }
0103     if(argc >= 9) {
0104         outputFile = argv[8];
0105     }
0106 
0107     Fun4All_CaloTreeGen(inputFile, event, run, tow_cemc_min, tow_hcalin_min, tow_hcalout_min, eventFile, outputFile);
0108 
0109     cout << "done" << endl;
0110     return 0;
0111 }
0112 # endif