File indexing completed on 2025-12-18 09:22:24
0001 #ifndef FUN4ALL_CALOONLYJETVALID_C
0002 #define FUN4ALL_CALOONLYJETVALID_C
0003
0004
0005
0006
0007 #include <GlobalVariables.C>
0008
0009 #include <G4_ActsGeom.C>
0010 #include <G4_Centrality.C>
0011 #include <G4_Global.C>
0012 #include <G4_Magnet.C>
0013 #include <HIJetReco.C>
0014 #include <Jet_QA.C>
0015 #include <QA.C>
0016
0017
0018 #include <g4centrality/PHG4CentralityReco.h>
0019
0020 #include <globalvertex/GlobalVertexReco.h>
0021
0022 #include <jetbackground/DetermineTowerRho.h>
0023 #include <jetbackground/TowerRho.h>
0024
0025 #include <mbd/MbdReco.h>
0026
0027 #include <zdcinfo/ZdcReco.h>
0028
0029 #include <qautils/QAHistManagerDef.h>
0030
0031 #include <ffamodules/CDBInterface.h>
0032 #include <ffamodules/FlagHandler.h>
0033
0034 #include <fun4all/Fun4AllDstInputManager.h>
0035 #include <fun4all/Fun4AllDstOutputManager.h>
0036 #include <fun4all/Fun4AllInputManager.h>
0037 #include <fun4all/Fun4AllRunNodeInputManager.h>
0038 #include <fun4all/Fun4AllServer.h>
0039 #include <fun4all/Fun4AllUtils.h>
0040
0041 #include <phool/recoConsts.h>
0042
0043
0044
0045 #include <fstream>
0046 #include <iostream>
0047 #include <optional>
0048 #include <string>
0049 #include <utility>
0050 #include <vector>
0051
0052
0053 R__LOAD_LIBRARY(libcentrality.so)
0054 R__LOAD_LIBRARY(libg4centrality.so)
0055 R__LOAD_LIBRARY(libglobalvertex.so)
0056 R__LOAD_LIBRARY(libfun4all.so)
0057 R__LOAD_LIBRARY(libffamodules.so)
0058 R__LOAD_LIBRARY(libjetbackground.so)
0059 R__LOAD_LIBRARY(libjetqa.so)
0060 R__LOAD_LIBRARY(libmbd.so)
0061 R__LOAD_LIBRARY(libqautils.so)
0062 R__LOAD_LIBRARY(libzdcinfo.so)
0063
0064
0065 using SVec = std::vector<std::string>;
0066
0067
0068
0069 void Fun4All_CaloOnlyJetValid(
0070 const int verb = 10,
0071 const int nEvts = 100,
0072 const int nSkip = 0,
0073 const SVec& inputs = {
0074 "./lists/runs/dst_calo_run2pp-00042586.list"
0075 },
0076 const std::string& qaBase = "HIST_JET_QA_TEST",
0077 std::optional<int> run = std::nullopt
0078 ) {
0079
0080
0081 Enable::QA = true;
0082
0083
0084 HIJETS::is_pp = true;
0085
0086
0087 JetQA::HasTracks = false;
0088 JetQA::DoInclusive = true;
0089 JetQA::DoTriggered = true;
0090 JetQA::RestrictPtToTrig = false;
0091 JetQA::RestrictEtaByR = true;
0092
0093
0094
0095
0096 std::cout << "\n -------- OwO -- Starting Jet QA Macro -- OwO -------- \n "
0097 << " [Using Calo-only Jets]\n"
0098 << std::endl;
0099
0100
0101 Fun4AllServer* se = Fun4AllServer::instance();
0102
0103 recoConsts* rc = recoConsts::instance();
0104 se->Verbosity(verb);
0105
0106
0107 Enable::CDB = true;
0108
0109
0110 int runNum = 6;
0111 int segNum = 0;
0112 if (!run.has_value()) {
0113
0114
0115 std::ifstream firstList(inputs.at(0));
0116 std::string firstFile;
0117 std::getline(firstList, firstFile);
0118
0119
0120 std::pair<int, int> runAndSeg = Fun4AllUtils::GetRunSegment(firstFile);
0121 runNum = runAndSeg.first;
0122 segNum = runAndSeg.second;
0123 } else {
0124 runNum = run.value();
0125 }
0126
0127
0128 rc->set_StringFlag("CDB_GLOBALTAG", "ProdA_2023");
0129 rc->set_uint64Flag("TIMESTAMP", runNum);
0130
0131
0132 for (size_t iInput = 0; iInput < inputs.size(); ++iInput) {
0133 Fun4AllDstInputManager* inManager = new Fun4AllDstInputManager("InputManager" + std::to_string(iInput));
0134 inManager->AddListFile(inputs[iInput], 1);
0135 se->registerInputManager(inManager);
0136 }
0137
0138
0139
0140
0141 Global_Reco();
0142 if (!HIJETS::is_pp) {
0143 Centrality();
0144 }
0145
0146
0147 HIJetReco();
0148 DoRhoCalculation();
0149
0150
0151
0152 Jet_QA();
0153
0154
0155
0156
0157 se->run(nEvts);
0158 se->skip(nSkip);
0159 se->End();
0160
0161
0162 std::string qaFileName = qaBase;
0163 qaFileName += "-" + std::to_string(runNum);
0164 qaFileName += "-" + std::to_string(segNum);
0165 qaFileName += ".root";
0166
0167
0168 QAHistManagerDef::saveQARootFile(qaFileName);
0169 delete se;
0170
0171
0172 std::cout << "\n -------- UwU -- Finished Jet QA Macro -- UwU -------- \n " << std::endl;
0173 gSystem->Exit(0);
0174 return;
0175
0176 }
0177
0178 #endif
0179
0180