Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 // c++ includes --
0002 #include <string>
0003 #include <iostream>
0004 
0005 // root includes --
0006 #include <TSystem.h>
0007 #include <TROOT.h>
0008 
0009 #include <fun4all/SubsysReco.h>
0010 #include <fun4all/Fun4AllServer.h>
0011 #include <fun4all/Fun4AllInputManager.h>
0012 #include <fun4all/Fun4AllDstInputManager.h>
0013 #include <fun4all/Fun4AllUtils.h>
0014 
0015 #include <caloreco/CaloTowerStatus.h>
0016 
0017 #include <calotrigger/TriggerRunInfoReco.h>
0018 
0019 #include <phool/recoConsts.h>
0020 
0021 #include <calohottower/CaloHotTower.h>
0022 
0023 using std::cout;
0024 using std::endl;
0025 using std::string;
0026 using std::vector;
0027 using std::pair;
0028 
0029 R__LOAD_LIBRARY(libCaloHotTower.so)
0030 
0031 void Fun4All_CaloHotTower(const string  &inputFile,
0032                           const string  &hotTowerFile,
0033                           const string  &outputFile = "test.root",
0034                           UInt_t nEvents = 0) {
0035 
0036   cout << "#############################" << endl;
0037   cout << "Run Parameters" << endl;
0038   cout << "inputFile: "    << inputFile << endl;
0039   cout << "hotTowerFile: " << hotTowerFile << endl;
0040   cout << "outputFile: "   << outputFile << endl;
0041   cout << "Events: "       << nEvents << endl;
0042   cout << "#############################" << endl;
0043 
0044   Fun4AllServer *se = Fun4AllServer::instance();
0045   recoConsts *rc    = recoConsts::instance();
0046 
0047   rc->set_StringFlag("CDB_GLOBALTAG", "ProdA_2024");
0048 
0049   pair<Int_t, Int_t> runseg = Fun4AllUtils::GetRunSegment(inputFile);
0050   Int_t runnumber = runseg.first;
0051   rc->set_uint64Flag("TIMESTAMP", runnumber);
0052 
0053   // //! Quiet mode. Only output critical messages. Intended for batch production mode.
0054   // VERBOSITY_QUIET = 0,
0055 
0056   // //! Output some useful messages during manual command line running
0057   // VERBOSITY_SOME = 1,
0058 
0059   // //! Output more messages
0060   // VERBOSITY_MORE = 2,
0061 
0062   // //! Output even more messages
0063   // VERBOSITY_EVEN_MORE = 3,
0064 
0065   // //! Output a lot of messages
0066   // VERBOSITY_A_LOT = 4,
0067 
0068   Fun4AllInputManager *in = new Fun4AllDstInputManager("DSTcalo");
0069   // in->AddListFile(inputFile.c_str());
0070   in->AddFile(inputFile.c_str());
0071   se->registerInputManager(in);
0072 
0073   TriggerRunInfoReco* triggerruninforeco = new TriggerRunInfoReco();
0074   se->registerSubsystem(triggerruninforeco);
0075 
0076   // need to set the isBadChi2 flag for the towers
0077   CaloTowerStatus *statusEMC = new CaloTowerStatus("CEMCSTATUS");
0078   statusEMC->set_detector_type(CaloTowerDefs::CEMC);
0079   statusEMC->set_time_cut(1);
0080   se->registerSubsystem(statusEMC);
0081 
0082   CaloHotTower *calo = new CaloHotTower();
0083   calo->Verbosity(Fun4AllBase::VERBOSITY_QUIET);
0084   calo->setOutputFile(outputFile);
0085   calo->setHotTowerIndexFile(hotTowerFile);
0086 
0087   se->registerSubsystem(calo);
0088 
0089   se->run(nEvents);
0090   se->End();
0091   se->PrintTimer();
0092   cout << "All done!" << endl;
0093 
0094   gSystem->Exit(0);
0095 }
0096 
0097 # ifndef __CINT__
0098 int main(int argc, char* argv[]) {
0099     if(argc < 3 || argc > 5){
0100         cout << "usage: ./bin/Fun4All_CaloHotTower inputFile hotTowerFile [outputFile] [events]" << endl;
0101         cout << "inputFile: Location of fileList containing dst." << endl;
0102         cout << "hotTowerFile: Location of input hot tower list file." << endl;
0103         cout << "outputFile: name of output file. Default: diphoton.root" << endl;
0104         cout << "events: Number of events to analyze. Default: all" << endl;
0105         return 1;
0106     }
0107 
0108     string outputFile = "test.root";
0109     UInt_t events     = 0;
0110 
0111     if(argc >= 4) {
0112         outputFile = argv[3];
0113     }
0114     if(argc >= 5) {
0115         events = atoi(argv[4]);
0116     }
0117 
0118     Fun4All_CaloHotTower(argv[1], argv[2], outputFile, events);
0119 
0120     cout << "done" << endl;
0121     return 0;
0122 }
0123 # endif