File indexing completed on 2025-08-05 08:12:18
0001
0002 #include <string>
0003 #include <iostream>
0004
0005
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 <phool/recoConsts.h>
0018
0019 #include <calohottower/CaloHotTowerSim.h>
0020
0021 #include "Calo_Calib.C"
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_CaloHotTowerSim(const string &inputFile,
0032 const string &outputFile = "test.root",
0033 UInt_t nEvents = 0) {
0034
0035 cout << "#############################" << endl;
0036 cout << "Run Parameters" << endl;
0037 cout << "inputFile: " << inputFile << endl;
0038 cout << "outputFile: " << outputFile << endl;
0039 cout << "Events: " << nEvents << endl;
0040 cout << "#############################" << endl;
0041
0042 Fun4AllServer *se = Fun4AllServer::instance();
0043 recoConsts *rc = recoConsts::instance();
0044
0045 rc->set_StringFlag("CDB_GLOBALTAG","MDC2");
0046
0047 pair<Int_t, Int_t> runseg = Fun4AllUtils::GetRunSegment(inputFile);
0048 Int_t runnumber = runseg.first;
0049 rc->set_uint64Flag("TIMESTAMP", runnumber);
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066 Fun4AllInputManager *in = new Fun4AllDstInputManager("DSTcalo");
0067
0068 in->AddFile(inputFile.c_str());
0069 se->registerInputManager(in);
0070
0071 Process_Calo_Calib();
0072
0073 CaloHotTowerSim *calo = new CaloHotTowerSim();
0074 calo->Verbosity(Fun4AllBase::VERBOSITY_QUIET);
0075 calo->setOutputFile(outputFile);
0076
0077 se->registerSubsystem(calo);
0078
0079 se->run(nEvents);
0080 se->End();
0081 se->PrintTimer();
0082 cout << "All done!" << endl;
0083
0084 gSystem->Exit(0);
0085 }
0086
0087 # ifndef __CINT__
0088 int main(int argc, char* argv[]) {
0089 if(argc < 2 || argc > 4){
0090 cout << "usage: ./bin/Fun4All_CaloHotTowerSim inputFile [outputFile] [events]" << endl;
0091 cout << "inputFile: Location of fileList containing dst." << endl;
0092 cout << "outputFile: name of output file. Default: diphoton.root" << endl;
0093 cout << "events: Number of events to analyze. Default: all" << endl;
0094 return 1;
0095 }
0096
0097 string outputFile = "test.root";
0098 UInt_t events = 0;
0099
0100 if(argc >= 3) {
0101 outputFile = argv[2];
0102 }
0103 if(argc >= 4) {
0104 events = atoi(argv[3]);
0105 }
0106
0107 Fun4All_CaloHotTowerSim(argv[1], outputFile, events);
0108
0109 cout << "done" << endl;
0110 return 0;
0111 }
0112 # endif