File indexing completed on 2025-08-05 08:14:33
0001 #ifndef MACRO_G4HIJETRECO_C
0002 #define MACRO_G4HIJETRECO_C
0003
0004 #include <GlobalVariables.C>
0005 #include <G4_Global.C>
0006
0007 #include <mbd/MbdReco.h>
0008
0009 #include <fstream>
0010 #include <limits>
0011 #include <iostream>
0012
0013 #include <globalvertex/GlobalVertexReco.h>
0014
0015 #include <fun4all/Fun4AllServer.h>
0016 #include <fun4all/SubsysReco.h>
0017 #include <fun4all/Fun4AllInputManager.h>
0018 #include <fun4all/Fun4AllRunNodeInputManager.h>
0019 #include <fun4all/Fun4AllDstInputManager.h>
0020 #include <fun4all/Fun4AllDstOutputManager.h>
0021 #include <fun4all/Fun4AllOutputManager.h>
0022 #include <fun4all/Fun4AllUtils.h>
0023
0024 #include <phool/PHRandomSeed.h>
0025 #include <phool/recoConsts.h>
0026
0027 #include <ana_ppg09_mod/Ana_PPG09_Mod.h>
0028
0029 #include <jetbase/FastJetAlgo.h>
0030 #include <jetbase/JetReco.h>
0031 #include <jetbase/TowerJetInput.h>
0032
0033 #include <jetbackground/CopyAndSubtractJets.h>
0034 #include <jetbackground/DetermineTowerBackground.h>
0035 #include <jetbackground/FastJetAlgoSub.h>
0036 #include <jetbackground/RetowerCEMC.h>
0037 #include <jetbackground/SubtractTowers.h>
0038 #include <jetbackground/SubtractTowersCS.h>
0039
0040 #include <beambackgroundfilterandqa/BeamBackgroundFilterAndQA.h>
0041 #include <beambackgroundfilterandqa/NullFilter.h>
0042 #include <beambackgroundfilterandqa/StreakSidebandFilter.h>
0043 #include <beambackgroundfilterandqa/TestPHFlags.h>
0044
0045
0046 #include <ffamodules/CDBInterface.h>
0047 #include <ffamodules/FlagHandler.h>
0048 #include <ffamodules/HeadReco.h>
0049 #include <ffamodules/SyncReco.h>
0050
0051 #include <calotreegen/caloTreeGen.h>
0052 #include <Calo_Calib.C>
0053 #include <calovalid/CaloValid.h>
0054 #include <calotrigger/TriggerRunInfoReco.h>
0055 #include <calotrigger/TriggerRunInfov1.h>
0056 #include <globalqa/GlobalQA.h>
0057 #include <jetbackgroundcut/jetBackgroundCut.h>
0058
0059 R__LOAD_LIBRARY(libglobalQA.so)
0060 R__LOAD_LIBRARY(libmbd.so)
0061 R__LOAD_LIBRARY(libffarawobjects.so)
0062 R__LOAD_LIBRARY(libfun4all.so)
0063 R__LOAD_LIBRARY(libcalotrigger.so)
0064 R__LOAD_LIBRARY(libglobalvertex.so)
0065 R__LOAD_LIBRARY(libAna_PPG09_Mod.so)
0066 R__LOAD_LIBRARY(libjetbackgroundcut.so)
0067 R__LOAD_LIBRARY(libjetbase.so)
0068 R__LOAD_LIBRARY(libjetbackground.so)
0069 R__LOAD_LIBRARY(libg4jets.so)
0070 R__LOAD_LIBRARY(libbeambackgroundfilterandqa.so)
0071
0072 namespace HIJETS
0073 {
0074 bool do_flow = false;
0075 bool do_CS = false;
0076 bool is_pp = true;
0077 std::string tower_prefix = "TOWERINFO_CALIB";
0078 bool do_vertex_type = true;
0079 GlobalVertex::VTXTYPE vertex_type = GlobalVertex::MBD;
0080 }
0081
0082 void Fun4All_Ana_PPG09_Mod_Skim(
0083 const char *filelistcalo = "Skim_Calo_Test.list",
0084 const char *filelistjet = "Skim_Jet_Test.list",
0085 const string &outname = "Test",
0086 int n_skip = 0,
0087 int n_event = 100
0088 )
0089 {
0090 gSystem->Load("libg4dst");
0091 gSystem->Load("libAna_PPG09_Mod");
0092
0093 int verbosity = 0;
0094
0095
0096
0097
0098
0099 Fun4AllServer *se = Fun4AllServer::instance();
0100 se->Verbosity(verbosity);
0101
0102 string inputFile;
0103 string inputFile2;
0104 string run_num;
0105
0106 if(outname == "Test"){
0107 run_num = "47289";
0108 inputFile = "DST_JETCALO_run2pp_ana462_2024p010_v001-000"+run_num+"-00000.root";
0109 inputFile2 = "DST_JET_run2pp_ana462_2024p010_v001-000"+run_num+"-00000.root";
0110 }
0111 else{
0112 int d = stoi(outname);
0113 int Counter = 0;
0114 string filePath = "listRun.txt";
0115 ifstream file(filePath);
0116 string line;
0117 cout << d << endl;
0118 while (getline(file, line)){
0119 if(Counter == d){
0120 cout << line << endl;
0121 run_num = line;
0122 cout << run_num << endl;
0123 }
0124 Counter += 1;
0125 }
0126 file.close();
0127 inputFile = "DST_JETCALO_run2pp_ana462_2024p10_v001-000"+run_num+"-00000.root";
0128 inputFile2 = "DST_JET_run2pp_ana462_2024p010_v001-000"+run_num+"-00000.root";
0129 }
0130
0131
0132 recoConsts *rc = recoConsts::instance();
0133
0134 pair<int, int> runseg = Fun4AllUtils::GetRunSegment(inputFile);
0135 int runnumber = runseg.first;
0136 int segment = runseg.second;
0137
0138 rc->set_StringFlag("CDB_GLOBALTAG","ProdA_2024");
0139 rc->set_uint64Flag("TIMESTAMP",runnumber);
0140 CDBInterface::instance()->Verbosity(0);
0141
0142 Fun4AllInputManager *in = new Fun4AllDstInputManager("DSTCalo");
0143 in->AddListFile(filelistcalo,1);
0144 se->registerInputManager(in);
0145
0146 Fun4AllInputManager *in2 = new Fun4AllDstInputManager("DSTjets");
0147 in2->AddListFile(filelistjet,1);
0148 se->registerInputManager(in2);
0149
0150
0151
0152
0153
0154
0155
0156
0157
0158 NullFilter::Config cfg_null {
0159 .verbosity = verbosity,
0160 .debug = false
0161 };
0162
0163 StreakSidebandFilter::Config cfg_sideband {
0164 .verbosity = verbosity,
0165 .debug = false,
0166 .minStreakTwrEne = 0.6,
0167 .maxAdjacentTwrEne = 0.06,
0168 .minNumTwrsInStreak = 5
0169 };
0170
0171 BeamBackgroundFilterAndQA::Config cfg_filter {
0172 .debug = false,
0173 .doQA = true,
0174 .doEvtAbort = true,
0175 .sideband = cfg_sideband
0176 };
0177
0178 Process_Calo_Calib();
0179
0180
0181
0182
0183
0184
0185
0186
0187
0188
0189
0190
0191
0192
0193
0194
0195
0196
0197
0198
0199
0200 jetBackgroundCut *jocl = new jetBackgroundCut("AntiKt_unsubtracted_r04","JOCL", 0, true);
0201 se->registerSubsystem(jocl);
0202
0203
0204
0205
0206
0207 BeamBackgroundFilterAndQA* filter = new BeamBackgroundFilterAndQA("BeamBackgroundFilterAndQA");
0208 filter->SetConfig(cfg_filter);
0209 filter->Verbosity(verbosity);
0210 se->registerSubsystem(filter);
0211
0212 Ana_PPG09_Mod *APM9 = new Ana_PPG09_Mod("AntiKt_unsubtracted_r04", "output/R04_Jets_PPG09_v7_Skimmest_Run" + run_num +"_" + outname + ".root");
0213 APM9 -> setRunnumber(runnumber);
0214 se->registerSubsystem(APM9);
0215
0216 se->run(-1);
0217
0218
0219 se->End();
0220 std::cout << "All done!" << std::endl;
0221 gSystem->Exit(0);
0222 }
0223 #endif