Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-18 09:24:12

0001 #ifndef MACRO_FUN4ALL_CALOTREEGEN_C
0002 #define MACRO_FUN4ALL_CALOTREEGEN_C
0003 
0004 #include <ffamodules/CDBInterface.h>
0005 #include <fun4all/Fun4AllUtils.h>
0006 
0007 #include <fun4all/Fun4AllDstInputManager.h>
0008 #include <fun4all/Fun4AllInputManager.h>
0009 #include <fun4all/Fun4AllServer.h>
0010 #include <fun4all/SubsysReco.h>
0011 
0012 #include <fun4all/Fun4AllDstOutputManager.h>
0013 #include <fun4all/Fun4AllOutputManager.h>
0014 #include <fun4all/Fun4AllServer.h>
0015 
0016 #include <mbd/MbdReco.h>
0017 
0018 #include <phool/PHRandomSeed.h>
0019 #include <phool/recoConsts.h>
0020 #include <globalvertex/GlobalVertexReco.h>
0021 
0022 #include <calohistgen/caloHistGen.h>
0023 
0024 #include <Calo_Calib.C>
0025 
0026 R__LOAD_LIBRARY(libfun4all.so)
0027 R__LOAD_LIBRARY(libffarawobjects.so)
0028 R__LOAD_LIBRARY(libcaloHistGen.so)
0029 
0030 
0031 void Fun4All_CaloHistGen(const int nEvents = 1000, const std::string &fnameCalo = "DST_CALOFITTING_run3auau_new_newcdbtag_v008-00066484-00000.root", const std::string &outName = "commissioning.root", const std::string &dbtag = "ProdA_2024")//Constructor for Run 25 Au+Au
0032 //void Fun4All_CaloHistGen(const int nEvents = 1000, const std::string &fnameCalo = "DST_CALOFITTING_run2pp_ana509_2024p022_v001-00047334-00022.root", const std::string &outName = "commissioning.root", const std::string &dbtag = "ProdA_2024")//Constructor for Run 24 p+p
0033 {
0034   Fun4AllServer *se = Fun4AllServer::instance();
0035   se->Verbosity(0);
0036   recoConsts *rc = recoConsts::instance();
0037   
0038   pair<int, int> runseg = Fun4AllUtils::GetRunSegment(fnameCalo);
0039   int runnumber = runseg.first;
0040 
0041   bool isAuAu = false;
0042   if(fnameCalo.find("auau") != std::string::npos)
0043     {
0044       std::cout << "This is Au+Au, setting flags and cuts" << std::endl;
0045       isAuAu = true;
0046     }
0047   else
0048     {
0049       std::cout << "This is p+p, Au+Au flags will not be set" << std::endl;
0050     }
0051 
0052   
0053   rc -> set_StringFlag("CDB_GLOBALTAG",dbtag);
0054   rc -> set_uint64Flag("TIMESTAMP",runnumber);
0055   CDBInterface::instance() -> Verbosity(1);
0056 
0057   gSystem->Load("libg4dst");
0058   
0059   Fun4AllInputManager *inputManager = new Fun4AllDstInputManager("DSTRaw");
0060   inputManager->AddFile(fnameCalo);
0061   se->registerInputManager(inputManager);
0062 
0063   //you need this call to calibrate the data!
0064   Process_Calo_Calib();
0065 
0066   //MBD Reconstruction
0067   MbdReco *mbdreco = new MbdReco();
0068   se->registerSubsystem(mbdreco);
0069 
0070   GlobalVertexReco *gvertex = new GlobalVertexReco();
0071   gvertex->Verbosity(Fun4AllBase::VERBOSITY_QUIET);
0072   se->registerSubsystem(gvertex);
0073 
0074   caloHistGen *calo = new caloHistGen(outName);
0075 
0076   // Let the subsys reco know what we're looking at
0077   calo->setIsAuAu(isAuAu);
0078 
0079   // What subsystems do you want?
0080   calo->doEMCal(1, "TOWERINFO_CALIB_CEMC");
0081   // Store EMCal clusters?
0082   calo->doClusters(1, "CLUSTERINFO_CEMC");
0083 
0084   // Store HCal information?
0085   calo->doHCals(1, "TOWERINFO_CALIB_HCALOUT", "TOWERINFO_CALIB_HCALIN");
0086 
0087   // Store ZDC information?
0088   calo->doZDC(1, "TOWERS_ZDC");
0089 
0090   // Store GL1 Information?
0091   //calo->doTrig(0, "GL1Packet");//Uncomment for p+p 2024
0092   calo->doTrig(0, "14001");//Temporary for Au+Au 2025
0093 
0094   //reconstruct diphoton pairs?
0095   calo->setPi0Reco(1);
0096   calo->setMaxAlpha(0.6);
0097   if(isAuAu)
0098     {
0099       calo->setCluster1EMin(1.3);
0100       calo->setCluster2EMin(0.7);
0101       calo->peripheralOnlyPi0(true);//only do reco in peripheral bins where S/B ratio is better.
0102       calo->setCaloFrac(0.2);
0103     }
0104   else
0105     {
0106       calo->setCluster1EMin(0.5);
0107       calo->setCluster2EMin(0.5);
0108     }
0109 
0110   if(!isAuAu)//as of 06/24/25 we're just booting up the photon triggers and need the right trigger map, leaving out for now.
0111     {
0112       calo->setTrig("jet");
0113       calo->setTrig("photon");
0114     }
0115   
0116   se->registerSubsystem(calo);
0117 
0118   se->run(nEvents);
0119   se->End();
0120   se->PrintTimer();
0121   std::cout << "All done!" << std::endl;
0122 
0123   gSystem->Exit(0);
0124 }
0125 
0126 #endif