File indexing completed on 2025-12-17 09:24:05
0001 #ifndef FUN4ALL_JETSKIMMEDPRODUCTIONYEAR3_C
0002 #define FUN4ALL_JETSKIMMEDPRODUCTIONYEAR3_C
0003
0004 #include <QA.C>
0005 #include <Calo_Calib.C>
0006 #include <HIJetReco.C>
0007 #include <Jet_QA.C>
0008 #include <G4_Global.C>
0009 #include <G4_Centrality.C>
0010
0011 #include <mbd/MbdReco.h>
0012 #include <globalvertex/GlobalVertexReco.h>
0013 #include <jetbackground/BeamBackgroundFilterAndQA.h>
0014 #include <centrality/CentralityReco.h>
0015 #include <calotrigger/MinimumBiasClassifier.h>
0016 #include <calovalid/CaloValid.h>
0017 #include <jetdstskimmer/JetDSTSkimmer.h>
0018
0019 #include <ffamodules/CDBInterface.h>
0020 #include <ffamodules/FlagHandler.h>
0021 #include <ffamodules/HeadReco.h>
0022 #include <ffamodules/SyncReco.h>
0023
0024 #include <fun4allraw/Fun4AllPrdfInputManager.h>
0025 #include <fun4all/Fun4AllDstInputManager.h>
0026 #include <fun4all/Fun4AllDstOutputManager.h>
0027 #include <fun4all/Fun4AllInputManager.h>
0028 #include <fun4all/Fun4AllRunNodeInputManager.h>
0029 #include <fun4all/Fun4AllServer.h>
0030 #include <fun4all/Fun4AllUtils.h>
0031 #include <fun4all/SubsysReco.h>
0032
0033 #include <phool/recoConsts.h>
0034
0035 #include <iostream>
0036 #include <map>
0037
0038 R__LOAD_LIBRARY(libfun4all.so)
0039 R__LOAD_LIBRARY(libfun4allraw.so)
0040 R__LOAD_LIBRARY(libcalo_reco.so)
0041 R__LOAD_LIBRARY(libcalotrigger.so)
0042 R__LOAD_LIBRARY(libcentrality.so)
0043 R__LOAD_LIBRARY(libffamodules.so)
0044 R__LOAD_LIBRARY(libmbd.so)
0045 R__LOAD_LIBRARY(libglobalvertex.so)
0046 R__LOAD_LIBRARY(libcalovalid.so)
0047 R__LOAD_LIBRARY(libjetbackground.so)
0048 R__LOAD_LIBRARY(libJetDSTSkimmer.so)
0049
0050 void Fun4All_JetSkimmedProductionYear3(
0051 int nEvents = 1000,
0052 const std::string &fname =
0053 "DST_CALOFITTING_run3auau_new_newcdbtag_v008-00075142-00000.root",
0054 const std::string &outfile_low = "DST_JETCALO-00000000-000000.root",
0055 const std::string &outfile_high = "DST_Jet-00000000-000000.root",
0056 const std::string &outfile_hist = "HIST_JETQA-00000000-000000.root",
0057 const std::string &dbtag = "newcdbtag")
0058 {
0059 Fun4AllServer *se = Fun4AllServer::instance();
0060 recoConsts::instance()->set_IntFlag("PHOOL_VERBOSITY", 0);
0061 se->Verbosity(0);
0062
0063 recoConsts *rc = recoConsts::instance();
0064
0065 std::pair<int, int> runseg = Fun4AllUtils::GetRunSegment(fname);
0066 int runnumber = runseg.first;
0067
0068
0069 rc->set_StringFlag("CDB_GLOBALTAG", dbtag);
0070 rc->set_uint64Flag("TIMESTAMP", runnumber);
0071 CDBInterface::instance()->Verbosity(0);
0072
0073 FlagHandler *flag = new FlagHandler();
0074 se->registerSubsystem(flag);
0075
0076
0077 MbdReco *mbdreco = new MbdReco();
0078 se->registerSubsystem(mbdreco);
0079
0080
0081 GlobalVertexReco *gvertex = new GlobalVertexReco();
0082 se->registerSubsystem(gvertex);
0083
0084
0085
0086 std::cout << ">>> Processing Calo Calibration" << std::endl;
0087 Process_Calo_Calib();
0088
0089
0090 Enable::QA = true;
0091
0092
0093 HIJETS::is_pp = false;
0094
0095
0096 JetQA::HasTracks = false;
0097 JetQA::DoInclusive = true;
0098 JetQA::DoTriggered = true;
0099 JetQA::RestrictPtToTrig = false;
0100 JetQA::RestrictEtaByR = true;
0101 JetQA::DoPP = HIJETS::is_pp;
0102 JetQA::UseBkgdSub = true;
0103 JetQA::HasCalos = true;
0104
0105 if (!HIJETS::is_pp)
0106 {
0107 std::cout << ">>> Running Centrality()" << std::endl;
0108 Centrality();
0109 }
0110
0111
0112 std::cout << ">>> Running HIJetReco()" << std::endl;
0113 HIJetReco();
0114
0115
0116 std::cout << ">>> Configuring JetDSTSkimmer" << std::endl;
0117 JetDSTSkimmer *jetDSTSkimmer = new JetDSTSkimmer();
0118
0119
0120 std::map<std::string, float> jetNodePts;
0121
0122 jetNodePts["AntiKt_Tower_r04_Sub1"] = 7.0F;
0123 jetDSTSkimmer->SetJetNodeThresholds(jetNodePts);
0124
0125
0126 std::map<std::string, float> clusterNodePts;
0127 clusterNodePts["CLUSTERINFO_CEMC"] = 5.0F;
0128 jetDSTSkimmer->SetClusterNodeThresholds(clusterNodePts);
0129
0130 jetDSTSkimmer->Verbosity(0);
0131 se->registerSubsystem(jetDSTSkimmer);
0132 std::cout << ">>> JetDSTSkimmer registered" << std::endl;
0133
0134
0135 BeamBackgroundFilterAndQA *filter =
0136 new BeamBackgroundFilterAndQA("BeamBackgroundFilterAndQA");
0137 filter->Verbosity(std::max(Enable::QA_VERBOSITY, Enable::JETQA_VERBOSITY));
0138 filter->SetConfig(
0139 {
0140 .debug = false,
0141 .doQA = Enable::QA,
0142 .doEvtAbort = false,
0143 .filtersToApply = {"StreakSideband"}
0144 });
0145 se->registerSubsystem(filter);
0146
0147
0148 if (Enable::QA)
0149 {
0150 std::cout << ">>> Enabling QA: DoRhoCalculation + Jet_QA" << std::endl;
0151 DoRhoCalculation();
0152 Jet_QA();
0153 }
0154
0155 std::cout << ">>> Setting up input and output managers" << std::endl;
0156
0157 Fun4AllInputManager *In = new Fun4AllDstInputManager("in");
0158 In->Verbosity(1);
0159 In->AddFile(fname);
0160 se->registerInputManager(In);
0161
0162 Fun4AllDstOutputManager *outlower =
0163 new Fun4AllDstOutputManager("DSTOUTLOW", outfile_low);
0164 outlower->AddNode("Sync");
0165 outlower->AddNode("EventHeader");
0166 outlower->AddNode("GL1Packet");
0167 outlower->AddNode("TOWERS_HCALIN");
0168 outlower->AddNode("TOWERS_HCALOUT");
0169 outlower->AddNode("TOWERS_SEPD");
0170 outlower->AddNode("TOWERS_ZDC");
0171 outlower->AddNode("MbdOut");
0172 outlower->AddNode("MbdPmtContainer");
0173 outlower->AddNode("MBDPackets");
0174 outlower->AddNode("TriggerRunInfo");
0175 se->registerOutputManager(outlower);
0176
0177 Fun4AllDstOutputManager *outhigher =
0178 new Fun4AllDstOutputManager("DSTOUTHIGH", outfile_high);
0179 outhigher->StripNode("TOWERINFO_CALIB_HCALIN");
0180 outhigher->StripNode("TOWERS_HCALIN");
0181 outhigher->StripNode("TOWERINFO_CALIB_HCALOUT");
0182 outhigher->StripNode("TOWERS_HCALOUT");
0183 outhigher->StripNode("TOWERINFO_CALIB_CEMC");
0184 outhigher->StripNode("TOWERS_CEMC");
0185 outhigher->StripNode("TOWERS_SEPD");
0186 outhigher->StripNode("TOWERINFO_CALIB_ZDC");
0187 outhigher->StripNode("TOWERS_ZDC");
0188 outhigher->StripNode("MBDPackets");
0189 outhigher->StripNode("MbdOut");
0190 outhigher->StripNode("MbdPmtContainer");
0191 se->registerOutputManager(outhigher);
0192
0193 se->run(nEvents);
0194 se->End();
0195
0196 if (Enable::QA)
0197 {
0198 std::cout << ">>> Saving QA histograms to " << outfile_hist << std::endl;
0199 QAHistManagerDef::saveQARootFile(outfile_hist);
0200 }
0201
0202 CDBInterface::instance()->Print();
0203 se->PrintTimer();
0204 delete se;
0205 std::cout << "All done!" << std::endl;
0206 gSystem->Exit(0);
0207 }
0208
0209 #endif