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