Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:20:28

0001 #ifndef FUN4ALL_JETSKIMMEDPRODUCTIONYEAR2_C
0002 #define FUN4ALL_JETSKIMMEDPRODUCTIONYEAR2_C
0003 
0004 #include <QA.C>
0005 #include <Calo_Calib.C>
0006 #include <HIJetReco.C>
0007 #include <Jet_QA.C>
0008 //copying from the JetProductionYear2.C, but isn't it wierd to use macro with G4 prefix here?
0009 #include <G4_Global.C>
0010 #include <G4_Centrality.C>
0011 
0012 #include <mbd/MbdReco.h>
0013 
0014 #include <globalvertex/GlobalVertexReco.h>
0015 
0016 #include <ffamodules/CDBInterface.h>
0017 #include <ffamodules/FlagHandler.h>
0018 #include <ffamodules/HeadReco.h>
0019 #include <ffamodules/SyncReco.h>
0020 
0021 #include <fun4allraw/Fun4AllPrdfInputManager.h>
0022 
0023 #include <fun4all/Fun4AllDstInputManager.h>
0024 #include <fun4all/Fun4AllDstOutputManager.h>
0025 #include <fun4all/Fun4AllInputManager.h>
0026 #include <fun4all/Fun4AllRunNodeInputManager.h>
0027 #include <fun4all/Fun4AllServer.h>
0028 #include <fun4all/Fun4AllUtils.h>
0029 #include <fun4all/SubsysReco.h>
0030 
0031 #include <phool/recoConsts.h>
0032 
0033 #include <centrality/CentralityReco.h>
0034 #include <calotrigger/MinimumBiasClassifier.h>
0035 
0036 #include <calovalid/CaloValid.h>
0037 
0038 #include <jetdstskimmer/JetDSTSkimmer.h>
0039 
0040 
0041 R__LOAD_LIBRARY(libfun4all.so)
0042 R__LOAD_LIBRARY(libfun4allraw.so)
0043 R__LOAD_LIBRARY(libcalo_reco.so)
0044 R__LOAD_LIBRARY(libcalotrigger.so)
0045 R__LOAD_LIBRARY(libcentrality.so)
0046 R__LOAD_LIBRARY(libffamodules.so)
0047 R__LOAD_LIBRARY(libmbd.so)
0048 R__LOAD_LIBRARY(libglobalvertex.so)
0049 R__LOAD_LIBRARY(libcalovalid.so)
0050 R__LOAD_LIBRARY(libJetDSTSkimmer.so)
0051 
0052 void Fun4All_JetSkimmedProductionYear2(int nEvents=1000,
0053                         const std::string &fname = "DST_CALOFITTING_run2pp_ana446_2024p007-00052661-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_tree= "TREE_CALOQA-00000000-000000.root",
0057                         const std::string& dbtag= "ProdA_2024"
0058   )
0059 {
0060 
0061   Fun4AllServer *se = Fun4AllServer::instance();
0062   se->Verbosity(1);
0063 
0064   recoConsts *rc = recoConsts::instance();
0065 
0066   pair<int, int> runseg = Fun4AllUtils::GetRunSegment(fname);
0067   int runnumber = runseg.first;
0068 
0069   // conditions DB flags and timestamp
0070   rc->set_StringFlag("CDB_GLOBALTAG", dbtag);
0071   rc->set_uint64Flag("TIMESTAMP", runnumber);
0072   CDBInterface::instance()->Verbosity(1);
0073 
0074   FlagHandler *flag = new FlagHandler();
0075   se->registerSubsystem(flag);
0076 
0077   // MBD/BBC Reconstruction
0078   MbdReco *mbdreco = new MbdReco();
0079   se->registerSubsystem(mbdreco);
0080 
0081   // Official vertex storage
0082   GlobalVertexReco *gvertex = new GlobalVertexReco();
0083   se->registerSubsystem(gvertex);
0084 
0085   /////////////////////////////////////////////////////
0086   // Set status of CALO towers, Calibrate towers,  Cluster
0087   Process_Calo_Calib();
0088 
0089   ///////////////////////////////////
0090   // Validation maybe no need to run for the skimmed production?
0091   /*
0092   CaloValid *ca = new CaloValid("CaloValid");
0093   ca->set_timing_cut_width(200);
0094   se->registerSubsystem(ca);
0095   */
0096 
0097   // Jet reco related flags
0098   Enable::QA = true;
0099 
0100   // turn on pp mode
0101   HIJETS::is_pp = true;
0102 
0103   // qa options
0104   JetQA::HasTracks = false;
0105   JetQA::DoInclusive = true;
0106   JetQA::DoTriggered = true;
0107   JetQA::RestrictPtToTrig = false;
0108   JetQA::RestrictEtaByR = true;
0109 
0110   if (!HIJETS::is_pp)
0111   {
0112     Centrality();
0113   }
0114 
0115   // do jet reconstruction & rho calculation
0116   HIJetReco();
0117 
0118   // do unsubtracted jet reconstruction
0119   std::string jetreco_input_prefix = "TOWERINFO_CALIB";
0120   JetReco *_jetRecoUnsub = new JetReco();
0121   _jetRecoUnsub->add_input(new TowerJetInput(Jet::CEMC_TOWERINFO_RETOWER, jetreco_input_prefix));
0122   _jetRecoUnsub->add_input(new TowerJetInput(Jet::HCALIN_TOWERINFO, jetreco_input_prefix));
0123   _jetRecoUnsub->add_input(new TowerJetInput(Jet::HCALOUT_TOWERINFO, jetreco_input_prefix));
0124   _jetRecoUnsub->add_algo(new FastJetAlgoSub(Jet::ANTIKT, 0.2), "AntiKt_unsubtracted_r02");
0125   _jetRecoUnsub->add_algo(new FastJetAlgoSub(Jet::ANTIKT, 0.3), "AntiKt_unsubtracted_r03");
0126   _jetRecoUnsub->add_algo(new FastJetAlgoSub(Jet::ANTIKT, 0.4), "AntiKt_unsubtracted_r04");
0127   _jetRecoUnsub->add_algo(new FastJetAlgoSub(Jet::ANTIKT, 0.5), "AntiKt_unsubtracted_r05");
0128   _jetRecoUnsub->set_algo_node("ANTIKT");
0129   _jetRecoUnsub->set_input_node("TOWER");
0130   se->registerSubsystem(_jetRecoUnsub);
0131 
0132   JetDSTSkimmer *jetDSTSkimmer = new JetDSTSkimmer();
0133   //these are all default values
0134   jetDSTSkimmer->SetMinJetPt(7);
0135   jetDSTSkimmer->SetMinClusterPt(5);
0136   jetDSTSkimmer->SetJetNodeName("AntiKt_unsubtracted_r04");
0137   jetDSTSkimmer->SetClusterNodeName("CLUSTERINFO_CEMC");
0138   se->registerSubsystem(jetDSTSkimmer);
0139 
0140   // register modules necessary for QA
0141   if (Enable::QA)
0142   {
0143     DoRhoCalculation();
0144     Jet_QA();
0145   }
0146 
0147   Fun4AllInputManager *In = new Fun4AllDstInputManager("in");
0148   In->AddFile(fname);
0149   se->registerInputManager(In);
0150 
0151   Fun4AllDstOutputManager *outlower = new Fun4AllDstOutputManager("DSTOUTLOW", outfile_low);
0152   outlower->AddNode("Sync");
0153   outlower->AddNode("EventHeader");
0154   outlower->AddNode("GL1Packet");
0155   //outlower->AddNode("TOWERINFO_CALIB_HCALIN");
0156   outlower->AddNode("TOWERS_HCALIN");
0157   //outlower->AddNode("TOWERINFO_CALIB_HCALOUT");
0158   outlower->AddNode("TOWERS_HCALOUT");
0159   //outlower->AddNode("TOWERINFO_CALIB_CEMC");
0160   outlower->AddNode("TOWERS_CEMC");
0161   outlower->AddNode("TOWERS_SEPD");
0162   //outlower->AddNode("TOWERINFO_CALIB_ZDC");
0163   outlower->AddNode("TOWERS_ZDC");
0164   outlower->AddNode("MbdOut");
0165   outlower->AddNode("MbdPmtContainer");
0166   outlower->AddNode("MBDPackets");
0167   outlower->AddNode("TriggerRunInfo");
0168   se->registerOutputManager(outlower);
0169 
0170   Fun4AllDstOutputManager *outhigher = new Fun4AllDstOutputManager("DSTOUTHIGH", outfile_high);
0171   outhigher->StripNode("TOWERINFO_CALIB_HCALIN");
0172   outhigher->StripNode("TOWERS_HCALIN");
0173   outhigher->StripNode("TOWERINFO_CALIB_HCALOUT");
0174   outhigher->StripNode("TOWERS_HCALOUT");
0175   outhigher->StripNode("TOWERINFO_CALIB_CEMC");
0176   outhigher->StripNode("TOWERS_CEMC");
0177   outhigher->StripNode("TOWERS_SEPD");
0178   outhigher->StripNode("TOWERINFO_CALIB_ZDC");
0179   outhigher->StripNode("TOWERS_ZDC");
0180   outhigher->StripNode("MBDPackets");
0181   outhigher->StripNode("MbdOut");
0182   outhigher->StripNode("MbdPmtContainer");
0183   se->registerOutputManager(outhigher);
0184 
0185   se->run(nEvents);
0186   se->End();
0187 
0188   if (Enable::QA)
0189   {
0190     QAHistManagerDef::saveQARootFile(outfile_hist);
0191   }
0192 
0193   CDBInterface::instance()->Print();  // print used DB files
0194   se->PrintTimer();
0195   delete se;
0196   std::cout << "All done!" << std::endl;
0197   gSystem->Exit(0);
0198 }
0199 
0200 #endif