File indexing completed on 2025-08-03 08:20:28
0001 #ifndef FUN4ALL_JETPRODUCTIONYEAR2_AUAU_C
0002 #define FUN4ALL_JETPRODUCTIONYEAR2_AUAU_C
0003
0004 #include <GlobalVariables.C>
0005
0006 #include <G4_ActsGeom.C>
0007 #include <G4_Centrality.C>
0008 #include <G4_Global.C>
0009 #include <G4_Magnet.C>
0010 #include <HIJetReco.C>
0011 #include <Jet_QA.C>
0012 #include <QA.C>
0013 #include <Trkr_Reco.C>
0014 #include <Trkr_RecoInit.C>
0015 #include <Trkr_TpcReadoutInit.C>
0016
0017 #include <ffamodules/CDBInterface.h>
0018 #include <ffamodules/FlagHandler.h>
0019 #include <fun4all/Fun4AllDstInputManager.h>
0020 #include <fun4all/Fun4AllDstOutputManager.h>
0021 #include <fun4all/Fun4AllInputManager.h>
0022 #include <fun4all/Fun4AllRunNodeInputManager.h>
0023 #include <fun4all/Fun4AllServer.h>
0024 #include <fun4all/Fun4AllUtils.h>
0025 #include <g4centrality/PHG4CentralityReco.h>
0026 #include <globalvertex/GlobalVertexReco.h>
0027 #include <jetbackground/BeamBackgroundFilterAndQA.h>
0028 #include <mbd/MbdReco.h>
0029 #include <phool/recoConsts.h>
0030 #include <qautils/QAHistManagerDef.h>
0031 #include <zdcinfo/ZdcReco.h>
0032
0033 #include <fstream>
0034 #include <iostream>
0035 #include <optional>
0036 #include <string>
0037 #include <utility>
0038 #include <vector>
0039
0040
0041 R__LOAD_LIBRARY(libcentrality.so)
0042 R__LOAD_LIBRARY(libg4centrality.so)
0043 R__LOAD_LIBRARY(libglobalvertex.so)
0044 R__LOAD_LIBRARY(libfun4all.so)
0045 R__LOAD_LIBRARY(libffamodules.so)
0046 R__LOAD_LIBRARY(libjetbackground.so)
0047 R__LOAD_LIBRARY(libjetqa.so)
0048 R__LOAD_LIBRARY(libmbd.so)
0049 R__LOAD_LIBRARY(libqautils.so)
0050 R__LOAD_LIBRARY(libzdcinfo.so)
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069 void Fun4All_JetProductionYear2_AuAu(
0070 const int nEvents = 0,
0071 const bool useTwrs = true,
0072 const bool useTrks = false,
0073 const bool useFlow = false,
0074 const std::vector<std::string>& inlists = {
0075 "./input/dsts_calo_run2pp-00053877.goldenTrkCaloRun_allSeg.list",
0076 "./input/dsts_clust_run2pp-00053877.goldenTrkCaloRun_allSeg.list",
0077 "./input/dsts_track_run2pp-00053877.goldenTrkCaloRun_allSeg.list"
0078 },
0079 const std::string& outfile = "DST_JET-00053877-0000.root",
0080 const std::string& outfile_hist = "HIST_JETQA-00053877-0000.year2aa_tracktest.root",
0081 const std::string& dbtag = "ProdA_2024"
0082 ) {
0083
0084
0085
0086
0087 Enable::DSTOUT = false;
0088 Enable::QA = true;
0089 Enable::HIJETS_VERBOSITY = 0;
0090 Enable::JETQA_VERBOSITY = std::max(Enable::VERBOSITY, Enable::HIJETS_VERBOSITY);
0091
0092
0093 Enable::HIJETS = true;
0094 Enable::HIJETS_TOWER = useTwrs;
0095 Enable::HIJETS_TRACK = useTrks;
0096 Enable::HIJETS_PFLOW = useFlow;
0097 HIJETS::is_pp = false;
0098 HIJETS::do_vertex_type = true;
0099 HIJETS::vertex_type = Enable::HIJETS_TRACK ? GlobalVertex::SVTX : GlobalVertex::MBD;
0100
0101
0102 JetQA::DoInclusive = true;
0103 JetQA::DoTriggered = true;
0104 JetQA::DoPP = HIJETS::is_pp;
0105 JetQA::UseBkgdSub = true;
0106 JetQA::RestrictPtToTrig = false;
0107 JetQA::RestrictEtaByR = true;
0108 JetQA::HasTracks = Enable::HIJETS_TRACK || Enable::HIJETS_PFLOW;
0109 JetQA::HasCalos = Enable::HIJETS_TOWER || Enable::HIJETS_PFLOW;
0110
0111
0112 G4TPC::ENABLE_MODULE_EDGE_CORRECTIONS = true;
0113 Enable::MVTX_APPLYMISALIGNMENT = true;
0114 ACTSGEOM::mvtx_applymisalignment = Enable::MVTX_APPLYMISALIGNMENT;
0115 TRACKING::pp_mode = HIJETS::is_pp;
0116
0117
0118
0119
0120 Fun4AllServer* se = Fun4AllServer::instance();
0121 se -> Verbosity(1);
0122
0123
0124 ifstream files(inlists.front());
0125 std::string first("");
0126 std::getline(files, first);
0127
0128
0129 pair<int, int> runseg = Fun4AllUtils::GetRunSegment(first);
0130 int runnumber = runseg.first;
0131
0132
0133 recoConsts* rc = recoConsts::instance();
0134 rc -> set_StringFlag("CDB_GLOBALTAG", dbtag);
0135 rc -> set_uint64Flag("TIMESTAMP", runnumber);
0136
0137
0138 CDBInterface* cdb = CDBInterface::instance();
0139 cdb -> Verbosity(1);
0140
0141
0142 FlagHandler* flag = new FlagHandler();
0143 se -> registerSubsystem(flag);
0144
0145
0146 for (std::size_t iin = 0; iin < inlists.size(); ++iin)
0147 {
0148 Fun4AllInputManager* indst = new Fun4AllDstInputManager("indst" + std::to_string(iin));
0149 indst -> AddListFile(inlists[iin]);
0150 se -> registerInputManager(indst);
0151 }
0152
0153
0154 if (JetQA::HasTracks)
0155 {
0156
0157 Fun4AllRunNodeInputManager* ingeom = new Fun4AllRunNodeInputManager("ingeom");
0158 ingeom -> AddFile(cdb -> getUrl("Tracking_Geometry"));
0159 se -> registerInputManager(ingeom);
0160
0161
0162 TpcReadoutInit(runnumber);
0163 TrackingInit();
0164 }
0165
0166
0167
0168
0169 Global_Reco();
0170 if (!HIJETS::is_pp)
0171 {
0172 Centrality();
0173 }
0174
0175
0176
0177 BeamBackgroundFilterAndQA* filter = new BeamBackgroundFilterAndQA("BeamBackgroundFilterAndQA");
0178 filter -> Verbosity(std::max(Enable::QA_VERBOSITY, Enable::JETQA_VERBOSITY));
0179 filter -> SetConfig(
0180 {
0181 .debug = false,
0182 .doQA = Enable::QA,
0183 .doEvtAbort = false,
0184 .filtersToApply = {"StreakSideband"}
0185 }
0186 );
0187 se -> registerSubsystem(filter);
0188
0189
0190 HIJetReco();
0191
0192
0193 if (Enable::QA)
0194 {
0195 DoRhoCalculation();
0196 Jet_QA();
0197 }
0198
0199
0200 if (Enable::DSTOUT)
0201 {
0202 Fun4AllDstOutputManager* out = new Fun4AllDstOutputManager("DSTOUT", outfile);
0203 out -> StripNode("CEMCPackets");
0204 out -> StripNode("HCALPackets");
0205 out -> StripNode("ZDCPackets");
0206 out -> StripNode("SEPDPackets");
0207 out -> StripNode("MBDPackets");
0208 se -> registerOutputManager(out);
0209 }
0210
0211
0212
0213
0214 se -> run(nEvents);
0215 se -> End();
0216
0217
0218 if (Enable::QA)
0219 {
0220 QAHistManagerDef::saveQARootFile(outfile_hist);
0221 }
0222
0223
0224 cdb -> Print();
0225 se -> PrintTimer();
0226 delete se;
0227
0228
0229 std::cout << "Jets are done!" << std::endl;
0230 gSystem -> Exit(0);
0231
0232 }
0233
0234 #endif
0235
0236