File indexing completed on 2025-12-17 09:23:55
0001 #ifndef INTT_CALIB_MACRO_C
0002 #define INTT_CALIB_MACRO_C
0003
0004 #include <fun4all/Fun4AllServer.h>
0005 #include <fun4all/Fun4AllInputManager.h>
0006 #include <fun4all/Fun4AllOutputManager.h>
0007 #include <fun4all/Fun4AllDstOutputManager.h>
0008
0009 #include <fun4allraw/Fun4AllStreamingInputManager.h>
0010 #include <fun4allraw/InputManagerType.h>
0011 #include <fun4allraw/SingleInttPoolInput.h>
0012
0013 #include <inttcalib/InttCalib.h>
0014
0015 #include <phool/recoConsts.h>
0016
0017 #include <Rtypes.h> // resolves R__LOAD_LIBRARY for clang-tidy
0018 #include <TSystem.h>
0019
0020 #include <filesystem>
0021 #include <iostream>
0022 #include <string>
0023
0024 R__LOAD_LIBRARY(libfun4allraw.so)
0025 R__LOAD_LIBRARY(libinttcalib.so)
0026 R__LOAD_LIBRARY(libfun4all.so)
0027 R__LOAD_LIBRARY(libphool.so)
0028
0029 void
0030 macro (
0031 int run_num,
0032 int num_evt,
0033 std::string const& intt_format,
0034 std::string const& hotmap_cdb_file,
0035 std::string const& hotmap_png_file,
0036 std::string const& bcomap_cdb_file,
0037 std::string const& bcomap_png_file
0038 ) {
0039 char buff[256];
0040
0041
0042 Fun4AllServer* se = Fun4AllServer::instance();
0043 se->Verbosity(0);
0044
0045 recoConsts* rc = recoConsts::instance();
0046 rc->set_StringFlag("CDB_GLOBALTAG", "ProdA_2023");
0047 rc->set_uint64Flag("TIMESTAMP", run_num);
0048
0049
0050 Fun4AllStreamingInputManager* in = new Fun4AllStreamingInputManager("Comb");
0051 std::vector<std::string> missing_list_files = {};
0052
0053 for(int i = 0; i < 8; ++i) {
0054 snprintf(buff, sizeof(buff), intt_format.c_str(), run_num, i);
0055 if(!std::filesystem::exists(buff)) {
0056 missing_list_files.emplace_back(buff);
0057 continue;
0058 }
0059
0060 auto* intt_sngl = new SingleInttPoolInput("INTT_" + std::to_string(i));
0061 intt_sngl->SetNegativeBco(0);
0062 intt_sngl->SetBcoRange(2);
0063 intt_sngl->AddListFile(buff);
0064 in->registerStreamingInput(intt_sngl, InputManagerType::INTT);
0065 }
0066 se->registerInputManager(in);
0067
0068 if(!missing_list_files.empty()) {
0069 std::cerr << "Missing expected list files:" << std::endl;
0070 for(std::string const& file : missing_list_files) {
0071 std::cerr << "\t" << file << std::endl;
0072 }
0073
0074 delete se;
0075 gSystem->Exit(1);
0076 exit(1);
0077 }
0078
0079
0080 InttCalib* inttcalib = new InttCalib();
0081 inttcalib->Verbosity(0);
0082 inttcalib->SetHotMapCdbFile(hotmap_cdb_file);
0083 inttcalib->SetHotMapPngFile(hotmap_png_file);
0084 inttcalib->SetBcoMapCdbFile(bcomap_cdb_file);
0085 inttcalib->SetBcoMapPngFile(bcomap_png_file);
0086 se->registerSubsystem(inttcalib);
0087
0088 if(inttcalib->Verbosity()) {
0089 std::cout << "\n"
0090 << "hotmap_cdb_file: " << hotmap_cdb_file << "\n"
0091 << "hotmap_png_file: " << hotmap_png_file << "\n"
0092 << "bcomap_cdb_file: " << bcomap_cdb_file << "\n"
0093 << "bcomap_png_file: " << bcomap_png_file << "\n"
0094 << std::endl;
0095 }
0096
0097
0098 se->run(num_evt);
0099
0100
0101 se->End();
0102 if(inttcalib->Verbosity()) {
0103 std::cout << "Macro done" << std::endl;
0104 }
0105 delete se;
0106 gSystem->Exit(0);
0107 exit(0);
0108 }
0109
0110 #endif