File indexing completed on 2026-04-04 08:10:22
0001 #ifndef MACRO_FUN4ALLG4SPHENIX_C
0002 #define MACRO_FUN4ALLG4SPHENIX_C
0003
0004 #include "G4_Input.C"
0005 #include <G4_Global.C>
0006 #include <G4Setup_sPHENIX.C>
0007
0008 #include <Trkr_RecoInit.C>
0009 #include <Trkr_Clustering.C>
0010 #include <Trkr_TruthTables.C>
0011 #include <Trkr_Reco.C>
0012
0013 #include <phpythia8/PHPy8ParticleTrigger.h>
0014
0015 #include <decayfinder/DecayFinder.h>
0016 #include <hftrackefficiency/HFTrackEfficiency.h>
0017 #include <kfparticle_sphenix/KFParticle_sPHENIX.h>
0018
0019 #include <ffamodules/FlagHandler.h>
0020 #include <ffamodules/HeadReco.h>
0021 #include <ffamodules/SyncReco.h>
0022 #include <ffamodules/CDBInterface.h>
0023 #include <phool/PHRandomSeed.h>
0024 #include <phool/recoConsts.h>
0025
0026 #include <fun4all/Fun4AllRunNodeInputManager.h>
0027 #include <fun4all/Fun4AllDstOutputManager.h>
0028 #include <fun4all/Fun4AllOutputManager.h>
0029 #include <fun4all/Fun4AllServer.h>
0030
0031 #include <simqa_modules/QAG4SimulationTracking.h>
0032 #include <qautils/QAHistManagerDef.h>
0033
0034 #include "HF_selections.C"
0035
0036 R__LOAD_LIBRARY(libfun4all.so)
0037 R__LOAD_LIBRARY(libffamodules.so)
0038 R__LOAD_LIBRARY(libdecayfinder.so)
0039 R__LOAD_LIBRARY(libhftrackefficiency.so)
0040 R__LOAD_LIBRARY(libsimqa_modules.so)
0041
0042 int Fun4All_HFG(std::string processID = "0", std::string channel = "Kshort2pipi")
0043 {
0044 int nEvents = 0;
0045 std::string outDir = "./" + channel + "_20260324/";
0046
0047 string makeDirectory = "mkdir -p " + outDir + "hfEff";
0048 system(makeDirectory.c_str());
0049
0050
0051 Fun4AllServer *se = Fun4AllServer::instance();
0052 se->Verbosity(1);
0053
0054 Fun4AllInputManager *infile = new Fun4AllDstInputManager("DSTin");
0055 string fileName = "lists/g4hits_" + processID + ".list";
0056 infile->AddListFile(fileName.c_str());
0057 se->registerInputManager(infile);
0058
0059 PHRandomSeed::Verbosity(1);
0060 recoConsts *rc = recoConsts::instance();
0061
0062 int particleID = 421;
0063 if (channel == "Kshort2pipi")
0064 {
0065 run_pipi_reco = true;
0066 particleID = 310;
0067 }
0068 else if (channel == "Lambda2ppi")
0069 {
0070 run_ppi_reco = true;
0071 particleID = 3122;
0072 }
0073 else if (channel == "minBias")
0074 {
0075 std::cout << "Min bias simulations" << std::endl;
0076 }
0077 else
0078 {
0079 std::cout << "Your decay channel " << channel << " is not known" << std::endl;
0080 exit(1);
0081 }
0082
0083
0084
0085
0086
0087
0088 Enable::CDB = true;
0089 rc->set_StringFlag("CDB_GLOBALTAG","ProdA_2024");
0090 rc->set_uint64Flag("TIMESTAMP",1);
0091 rc->set_IntFlag("RUNNUMBER",1);
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123 float abs_eta = 1.2;
0124 DecayFinder *myFinder = new DecayFinder("myFinder");
0125 myFinder->Verbosity(INT_MAX);
0126 if (channel == "Kshort2pipi") myFinder->setDecayDescriptor("K_S0 -> pi^- pi^+");
0127 else myFinder->setDecayDescriptor("[Lambda0 -> proton^+ pi^-]cc");
0128 myFinder->saveDST(1);
0129 myFinder->allowPi0(1);
0130 myFinder->allowPhotons(1);
0131 myFinder->triggerOnDecay(1);
0132 myFinder->setPTmin(0.);
0133 myFinder->setEtaRange(-1*abs_eta, abs_eta);
0134 myFinder->useDecaySpecificEtaRange(false);
0135 if (channel != "minBias") se->registerSubsystem(myFinder);
0136
0137 Mbd_Reco();
0138 Mvtx_Cells();
0139 Intt_Cells();
0140 TPC_Cells();
0141 Micromegas_Cells();
0142
0143 TrackingInit();
0144
0145 Mvtx_Clustering();
0146 Intt_Clustering();
0147 TPC_Clustering();
0148 Micromegas_Clustering();
0149
0150 Tracking_Reco();
0151
0152 auto vtxfinder = new PHSimpleVertexFinder;
0153 vtxfinder->Verbosity(0);
0154 vtxfinder->setDcaCut(0.5);
0155 vtxfinder->setTrackPtCut(-99999.);
0156 vtxfinder->setBeamLineCut(1);
0157 vtxfinder->setTrackQualityCut(1000000000);
0158 vtxfinder->setNmvtxRequired(2);
0159 vtxfinder->setOutlierPairCut(0.1);
0160 se->registerSubsystem(vtxfinder);
0161
0162 Global_Reco();
0163
0164 build_truthreco_tables();
0165
0166 HFTrackEfficiency *myTrackEff = new HFTrackEfficiency("myTrackEff");
0167 myTrackEff->Verbosity(INT_MAX);
0168 myTrackEff->setDFNodeName("myFinder");
0169 myTrackEff->triggerOnDecay(1);
0170 myTrackEff->writeSelectedTrackMap(true);
0171 myTrackEff->writeOutputFile(true);
0172 std::string outputHFEffFile = outDir + "/hfEff/outputHFTrackEff_" + channel + "_" + processID + ".root";
0173 myTrackEff->setOutputFileName(outputHFEffFile);
0174 if (channel != "minBias") se->registerSubsystem(myTrackEff);
0175
0176 output_dir = outDir;
0177
0178 if (run_pipi_reco) create_hf_directories(pipi_reconstruction_name, pipi_output_dir, pipi_output_reco_file);
0179 if (run_ppi_reco) create_hf_directories(ppi_reconstruction_name, ppi_output_dir, ppi_output_reco_file);
0180
0181
0182 if (run_pipi_reco) reconstruct_pipi_mass();
0183 if (run_ppi_reco) reconstruct_ppi_mass();
0184
0185 se->run(nEvents);
0186
0187 se->End();
0188
0189 if (run_pipi_reco) end_kfparticle(pipi_output_reco_file, pipi_output_dir);
0190 if (run_ppi_reco) end_kfparticle(ppi_output_reco_file, ppi_output_dir);
0191
0192 gSystem->Exit(0);
0193
0194 return 0;
0195 }
0196
0197 #endif