Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:13:09

0001 #ifndef MACRO_FUN4ALL_JETSPECTRUM_C
0002 #define MACRO_FUN4ALL_JETSPECTRUM_C
0003 
0004 #include <fstream>
0005 #include <limits>
0006 #include <iostream>
0007 
0008 #include <fun4all/Fun4AllServer.h>
0009 #include <fun4all/SubsysReco.h>
0010 #include <fun4all/Fun4AllInputManager.h>
0011 #include <fun4all/Fun4AllRunNodeInputManager.h>
0012 #include <fun4all/Fun4AllDstInputManager.h>
0013 #include <fun4all/Fun4AllDstOutputManager.h>
0014 #include <fun4all/Fun4AllOutputManager.h>
0015 #include <fun4all/Fun4AllUtils.h>
0016 
0017 #include <phool/PHRandomSeed.h>
0018 #include <phool/recoConsts.h>
0019 
0020 #include <ffamodules/CDBInterface.h>
0021 #include <ffamodules/FlagHandler.h>
0022 #include <ffamodules/HeadReco.h>
0023 #include <ffamodules/SyncReco.h>
0024 
0025 #include <mbd/MbdReco.h>
0026 #include <globalvertex/GlobalVertexReco.h>
0027 #include <GlobalVariables.C>
0028 #include <G4_Global.C>
0029 
0030 #include <jetbase/JetReco.h>
0031 #include <jetbase/TowerJetInput.h>
0032 #include <jetbackground/RetowerCEMC.h>
0033 
0034 #include <Calo_Calib.C>
0035 #include <calotreegen/caloTreeGen.h> 
0036 
0037 R__LOAD_LIBRARY(libfun4all.so)
0038 R__LOAD_LIBRARY(libjetbase.so)
0039 R__LOAD_LIBRARY(libjetbackground.so)
0040 R__LOAD_LIBRARY(libmbd.so)
0041 R__LOAD_LIBRARY(libglobalvertex.so)
0042 R__LOAD_LIBRARY(libcaloTreeGen.so)
0043 R__LOAD_LIBRARY(libffarawobjects.so)
0044 R__LOAD_LIBRARY(libg4jets.so)
0045 
0046 void Fun4All_JetSpectrum(
0047   const string &filedstlist0 = "example_list/dst_jet2.list",
0048   const string &filedstlist1 = "example_list/dst_jetcalo2.list",
0049     const string &outputFile = "output_data.root",
0050   int n_event = 0) {
0051 
0052   int verbosity = 0;
0053 
0054   Fun4AllServer *se = Fun4AllServer::instance();
0055   se->Verbosity(verbosity);
0056   recoConsts *rc = recoConsts::instance();
0057 
0058   int runnumber;
0059   std::ifstream file(filedstlist0);
0060   std::string line;
0061   std::getline(file, line);
0062   file.close();
0063   std::regex pattern(R"((\d+)-\d+\.root)");
0064   std::smatch matches;    
0065   if (std::regex_search(line, matches, pattern) && matches.size() > 1) {
0066     runnumber = std::stoi(matches[1].str());
0067     std::cout << "Run number: " << runnumber << std::endl;
0068   } else {
0069     std::cerr << "Run number is not clear." << std::endl;
0070     return;
0071   }
0072   rc->set_StringFlag("CDB_GLOBALTAG","ProdA_2024");
0073   rc->set_uint64Flag("TIMESTAMP",runnumber);
0074   CDBInterface::instance()->Verbosity(0); 
0075 
0076   Fun4AllInputManager *in0 = new Fun4AllDstInputManager("DSTJet");
0077   in0->AddListFile(filedstlist0, 1);
0078   se->registerInputManager(in0);
0079 
0080   Fun4AllInputManager *in1 = new Fun4AllDstInputManager("DSTJetCalo");
0081   in1->AddListFile(filedstlist1, 1);
0082   se->registerInputManager(in1);
0083 
0084   Process_Calo_Calib();
0085 
0086   caloTreeGen *_caloTreeGen = new caloTreeGen("caloTreeGen",outputFile);
0087   _caloTreeGen->SetVerbosity(verbosity);
0088   se->registerSubsystem(_caloTreeGen);
0089   
0090   se->run(n_event);
0091   se->End();
0092   se->PrintTimer();
0093   gSystem->Exit(0);
0094 }
0095 #endif