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