Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:13:17

0001 /// ---------------------------------------------------------------------------
0002 /*! \file   Fun4All_RunJetTreeMakerOnHIJetReco.C
0003  *  \author Derek Anderson
0004  *  \date   08.26.2024
0005  *
0006  *  A F4A macro to run the correlator jet tree maker module over the
0007  *  output of HIJetReco.C. Initially derived from code by Cameron Dean
0008  *  and Antonio Silva.
0009  */
0010 /// ---------------------------------------------------------------------------
0011 
0012 #ifndef FUN4ALL_RUNJETTREEMAKERONHIJETRECO_C
0013 #define FUN4ALL_RUNJETTREEMAKERONHIJETRECO_C
0014 
0015 // c++ utilities
0016 #include <vector>
0017 #include <string>
0018 #include <cstdlib>
0019 #include <utility>
0020 // f4a/sphenix utilities
0021 #include <FROG.h>
0022 #include <fun4all/Fun4AllDstInputManager.h>
0023 #include <g4main/Fun4AllDstPileupInputManager.h>
0024 // tracking utilities
0025 #include <g4eval/SvtxEvaluator.h>
0026 #include <g4eval/SvtxTruthRecoTableEval.h>
0027 // calo/pf/jet libraries
0028 #include <jetbackground/RetowerCEMC.h>
0029 #include <caloreco/RawClusterBuilderTopo.h>
0030 #include <particleflowreco/ParticleFlowReco.h>
0031 // module definition
0032 #include <scorrelatorjettreemaker/SCorrelatorJetTreeMaker.h>
0033 // macro options
0034 #include "JetTreeMakerOptions.h"
0035 
0036 // sphenix macros
0037 #include <G4_Magnet.C>
0038 #include <G4_TrkrSimulation.C>
0039 #include <HIJetReco.C>
0040 #include <Trkr_QA.C>
0041 #include <Trkr_Reco.C>
0042 #include <Trkr_Eval.C>
0043 #include <Trkr_RecoInit.C>
0044 #include <Trkr_Clustering.C>
0045 #include <Trkr_Diagnostics.C>
0046 
0047 // make common namespaces implicit
0048 using namespace std;
0049 using namespace SColdQcdCorrelatorAnalysis;
0050 
0051 // load libraries
0052 R__LOAD_LIBRARY(libg4eval.so)
0053 R__LOAD_LIBRARY(libfun4all.so)
0054 R__LOAD_LIBRARY(libcalo_reco.so)
0055 R__LOAD_LIBRARY(libparticleflow.so)
0056 R__LOAD_LIBRARY(libjetbackground.so)
0057 R__LOAD_LIBRARY(libscorrelatorutilities.so)
0058 R__LOAD_LIBRARY(libscorrelatorjettreemaker.so)
0059 
0060 // default input/output
0061 static const vector<string> VecInFilesDefault = {
0062   "DST_GLOBAL_pythia8_Jet10_2MHz-0000000015-000006.root",
0063   "DST_TRKR_G4HIT_pythia8_Jet10_2MHz-0000000015-000006.root",
0064   "DST_TRACKSEEDS_pythia8_Jet10_2MHz-0000000015-000006.root",
0065   "DST_TRKR_CLUSTER_pythia8_Jet10_2MHz-0000000015-000006.root",
0066   "DST_TRACKS_pythia8_Jet10_2MHz-0000000015-000006.root",
0067   "DST_CALO_G4HIT_pythia8_Jet10_2MHz-0000000015-000006.root",
0068   "DST_CALO_CLUSTER_pythia8_Jet10_2MHz-0000000015-000006.root",
0069   "DST_TRUTH_G4HIT_pythia8_Jet10_2MHz-0000000015-000006.root",
0070   "DST_TRUTH_pythia8_Jet10_2MHz-0000000015-000006.root"
0071 };
0072 static const string OutFileDefault = "test.root";
0073 
0074 // other default arguments
0075 static const int    NEvtDefault = 10;
0076 static const int    VerbDefault = 10;
0077 static const size_t NTopoClusts = 2;
0078 static const size_t NTopoPar    = 3;
0079 
0080 
0081 
0082 // macro body -----------------------------------------------------------------
0083 
0084 void Fun4All_RunJetTreeMakerOnHIJetReco(
0085   const vector<string>& vecInFiles = VecInFilesDefault,
0086   const string outFile = OutFileDefault,
0087   const int nEvents = NEvtDefault,
0088   const int verbosity = VerbDefault
0089 ) {
0090 
0091   // options ------------------------------------------------------------------
0092 
0093   // tracking/pf/tower options
0094   const bool   runTracking(false);
0095   const bool   runParticleFlow(false);
0096   const bool   doTruthTableReco(false);
0097   const bool   doEMCalRetower(true);
0098   const double nSigma(1.5);
0099 
0100   // adjust verbosity
0101   Enable::VERBOSITY = verbosity;
0102 
0103   // get jet tree maker configuration
0104   SCorrelatorJetTreeMakerConfig cfg_jetTree = JetTreeMakerOptions::GetConfig(
0105     verbosity,
0106     0.4,
0107     "AntiKt_Tower_r04_Sub1",
0108     "AntiKt_Truth_r04",
0109     outFile
0110   );
0111 
0112   // initialize f4a -----------------------------------------------------------
0113 
0114   // load libraries and create f4a server
0115   gSystem -> Load("libg4dst.so");
0116   gSystem -> Load("libFROG.so");
0117 
0118   FROG*          frog      = new FROG();
0119   Fun4AllServer* ffaServer = Fun4AllServer::instance();
0120   ffaServer -> Verbosity(verbosity);
0121 
0122   // add input files 
0123   for (size_t iInput = 0; iInput < vecInFiles.size(); iInput++) {
0124     Fun4AllDstInputManager* inManager = new Fun4AllDstInputManager("InputDstManager" + to_string(iInput));
0125     inManager -> AddFile(vecInFiles.at(iInput));
0126     ffaServer -> registerInputManager(inManager);
0127   }
0128 
0129   // do jet reconstruction ----------------------------------------------------
0130 
0131   // set options and run jet reco
0132   HIJETS::is_pp = true;
0133   if (cfg_jetTree.isSimulation) {
0134     Enable::HIJETS_MC    = true;
0135     Enable::HIJETS_TRUTH = true;
0136   } else {
0137     Enable::HIJETS_MC    = false;
0138     Enable::HIJETS_TRUTH = false;
0139   }
0140   HIJetReco();
0141 
0142   // register jet tree maker --------------------------------------------------
0143 
0144   // create correlator jet tree
0145   SCorrelatorJetTreeMaker* jetTreeMaker = new SCorrelatorJetTreeMaker(cfg_jetTree);
0146   ffaServer  -> registerSubsystem(jetTreeMaker);
0147 
0148   // run and close f4a --------------------------------------------------------
0149 
0150   // run reconstruction & close f4a
0151   ffaServer -> run(nEvents);
0152   ffaServer -> End();
0153   delete ffaServer;
0154 
0155   // announce end & exit
0156   gSystem -> Exit(0);
0157   return;
0158 
0159 }
0160 
0161 #endif
0162 
0163 // end ------------------------------------------------------------------------