Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:19:43

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