File indexing completed on 2025-08-05 08:13:09
0001 #ifndef MACRO_FUN4ALL_JETSPECTRUMSIM_C
0002 #define MACRO_FUN4ALL_JETSPECTRUMSIM_C
0003
0004 #include <mbd/MbdReco.h>
0005 #include <GlobalVariables.C>
0006 #include <G4_Global.C>
0007 #include <globalvertex/GlobalVertexReco.h>
0008
0009 #include <ffamodules/CDBInterface.h>
0010 #include <ffamodules/FlagHandler.h>
0011 #include <ffamodules/HeadReco.h>
0012 #include <ffamodules/SyncReco.h>
0013
0014 #include <fun4all/Fun4AllInputManager.h>
0015 #include <fun4all/Fun4AllOutputManager.h>
0016 #include <fun4all/Fun4AllDstInputManager.h>
0017 #include <fun4all/Fun4AllDstOutputManager.h>
0018 #include <fun4all/Fun4AllRunNodeInputManager.h>
0019 #include <fun4all/Fun4AllServer.h>
0020 #include <fun4all/SubsysReco.h>
0021
0022 #include <phool/recoConsts.h>
0023 #include <phool/PHRandomSeed.h>
0024 #include <phool/recoConsts.h>
0025 #include <G4_Input.C>
0026 #include <GlobalVariables.C>
0027
0028 #include <caloreco/RawClusterCNNClassifier.h>
0029 #include <clusteriso/ClusterIso.h>
0030
0031 #include <jetbase/FastJetAlgo.h>
0032 #include <jetbase/JetReco.h>
0033 #include <jetbase/TowerJetInput.h>
0034 #include <g4jets/TruthJetInput.h>
0035
0036 #include <jetbackground/CopyAndSubtractJets.h>
0037 #include <jetbackground/DetermineTowerBackground.h>
0038 #include <jetbackground/FastJetAlgoSub.h>
0039 #include <jetbackground/RetowerCEMC.h>
0040 #include <jetbackground/SubtractTowers.h>
0041 #include <jetbackground/SubtractTowersCS.h>
0042
0043 #include <globalvertex/GlobalVertex.h>
0044
0045 #include <calotrigger/CaloTriggerEmulator.h>
0046
0047 #include <JESMCTreeGen/JESMCTreeGen.h>
0048 #include </sphenix/user/hanpuj/JES_MC_Calibration/macro/Calo_Calib.C>
0049
0050 R__LOAD_LIBRARY(libfun4all.so)
0051 R__LOAD_LIBRARY(libfun4allraw.so)
0052 R__LOAD_LIBRARY(libclusteriso.so)
0053 R__LOAD_LIBRARY(libcalo_reco.so)
0054 R__LOAD_LIBRARY(libffamodules.so)
0055 R__LOAD_LIBRARY(libffarawobjects.so)
0056 R__LOAD_LIBRARY(libJESMCTreeGen.so)
0057 R__LOAD_LIBRARY(libjetbase.so)
0058 R__LOAD_LIBRARY(libg4jets.so)
0059 R__LOAD_LIBRARY(libmbd.so)
0060 R__LOAD_LIBRARY(libjetbackground.so)
0061 R__LOAD_LIBRARY(libglobalvertex.so)
0062
0063 void Fun4All_JetSpectrumSim(
0064 const int nEvents = 0,
0065 const string &inputFile0 = "example_list/g4hits.list",
0066 const string &inputFile1 = "example_list/dst_calo_cluster.list",
0067 const string &inputFile2 = "example_list/dst_truth_jet.list",
0068 const string &inputFile3 = "example_list/dst_mbd_epd.list",
0069 const string &outputFile = "output_sim.root")
0070 {
0071
0072 int verbosity = 0;
0073
0074 GlobalVertex::VTXTYPE vertex_type = GlobalVertex::MBD;
0075
0076
0077 Fun4AllServer *se = Fun4AllServer::instance();
0078 se->Verbosity(verbosity);
0079 recoConsts *rc = recoConsts::instance();
0080
0081 Enable::CDB = true;
0082 rc->set_StringFlag("CDB_GLOBALTAG", "MDC2");
0083 rc->set_uint64Flag("TIMESTAMP", 21);
0084 CDBInterface::instance()->Verbosity(1);
0085
0086 FlagHandler *flag = new FlagHandler();
0087 se->registerSubsystem(flag);
0088
0089
0090 Process_Calo_Calib();
0091
0092 MbdReco *mbdreco = new MbdReco();
0093 se->registerSubsystem(mbdreco);
0094
0095 GlobalVertexReco *gvertex = new GlobalVertexReco();
0096 se->registerSubsystem(gvertex);
0097
0098
0099
0100 std::string jetreco_input_prefix = "TOWERINFO_CALIB";
0101 RetowerCEMC *_retowerCEMC;
0102 _retowerCEMC = new RetowerCEMC();
0103 _retowerCEMC->Verbosity(verbosity);
0104 _retowerCEMC->set_towerinfo(true);
0105 _retowerCEMC->set_frac_cut(0.5);
0106 _retowerCEMC->set_towerNodePrefix(jetreco_input_prefix);
0107 se->registerSubsystem(_retowerCEMC);
0108
0109 JetReco *_jetRecoUnsub;
0110 _jetRecoUnsub = new JetReco();
0111 TowerJetInput *incemc3 = new TowerJetInput(Jet::CEMC_TOWERINFO_RETOWER, jetreco_input_prefix);
0112 TowerJetInput *inihcal3 = new TowerJetInput(Jet::HCALIN_TOWERINFO, jetreco_input_prefix);
0113 TowerJetInput *inohcal3 = new TowerJetInput(Jet::HCALOUT_TOWERINFO, jetreco_input_prefix);
0114 incemc3->set_GlobalVertexType(vertex_type);
0115 inihcal3->set_GlobalVertexType(vertex_type);
0116 inohcal3->set_GlobalVertexType(vertex_type);
0117 _jetRecoUnsub->add_input(incemc3);
0118 _jetRecoUnsub->add_input(inihcal3);
0119 _jetRecoUnsub->add_input(inohcal3);
0120 _jetRecoUnsub->add_algo(new FastJetAlgoSub(Jet::ANTIKT, 0.4), "AntiKt_unsubtracted_r04");
0121 _jetRecoUnsub->set_algo_node("ANTIKT");
0122 _jetRecoUnsub->set_input_node("TOWER");
0123 _jetRecoUnsub->Verbosity(verbosity);
0124 se->registerSubsystem(_jetRecoUnsub);
0125
0126
0127 Fun4AllInputManager *in0 = new Fun4AllDstInputManager("in0");
0128 in0->AddListFile(inputFile0,1);
0129 se->registerInputManager(in0);
0130
0131 Fun4AllInputManager *in1 = new Fun4AllDstInputManager("in1");
0132 in1->AddListFile(inputFile1,1);
0133 se->registerInputManager(in1);
0134
0135 Fun4AllInputManager *in2 = new Fun4AllDstInputManager("in2");
0136 in2->AddListFile(inputFile2,1);
0137 se->registerInputManager(in2);
0138
0139 Fun4AllInputManager *in3 = new Fun4AllDstInputManager("in3");
0140 in3->AddListFile(inputFile3,1);
0141 se->registerInputManager(in3);
0142
0143
0144 JESMCTreeGen *_JESMCTreeGen = new JESMCTreeGen("JESMCTreeGen",outputFile);
0145 _JESMCTreeGen->SetVerbosity(verbosity);
0146 se->registerSubsystem(_JESMCTreeGen);
0147
0148 se->run(nEvents);
0149 CDBInterface::instance()->Print();
0150 se->End();
0151 cout << "JOB COMPLETE." <<endl;
0152 se->PrintTimer();
0153 gSystem->Exit(0);
0154 }
0155 #endif