Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:21:36

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 <phool/PHRandomSeed.h>
0017 #include <phool/recoConsts.h>
0018 
0019 #include <calohistgen/caloHistGen.h>
0020 
0021 #include <Calo_Calib.C>
0022 
0023 R__LOAD_LIBRARY(libfun4all.so)
0024 R__LOAD_LIBRARY(libffarawobjects.so)
0025 R__LOAD_LIBRARY(libcaloHistGen.so)
0026 
0027 
0028 void Fun4All_CaloHistGen(const int nEvents = 10000, const std::string &fnameCalib = "/direct/sphenix+lustre01/sphnxpro/production/run3auau/physics/caloy2calib/new_newcdbtag_v005/run_00068100_00068200/DST_CALO_run3auau_new_newcdbtag_v005-00068152-00000.root", const std::string &fnameRaw = "/direct/sphenix+lustre01/sphnxpro/production/run3auau/physics/caloy2fitting/new_newcdbtag_v005/run_00068100_00068200/DST_CALOFITTING_run3auau_new_newcdbtag_v005-00068152-00000.root",const std::string &outName = "commissioning.root", const std::string &dbtag = "ProdA_2024")//Constructor for Run 25 Au+Au
0029 //void Fun4All_CaloHistGen(const int nEvents = 0, const std::string &fnameCalib = "/direct/sphenix+lustre01/sphnxpro/production/run2pp/physics/ana468_2024p012_v001/DST_CALO/run_00052000_00052100/dst/DST_CALO_run2pp_ana468_2024p012_v001-00052032-00000.root", const std::string &fnameRaw = "/direct/sphenix+lustre01/sphnxpro/production/run2pp/physics/ana468_2024p012_v001/DST_CALOFITTING/run_00052000_00052100/dst/DST_CALOFITTING_run2pp_ana468_2024p012_v001-00052032-00000.root",const std::string &outName = "commissioning.root", const std::string &dbtag = "ProdA_2024")//Constructor for Run 24 p+p
0030 {
0031   Fun4AllServer *se = Fun4AllServer::instance();
0032   se->Verbosity(0);
0033   recoConsts *rc = recoConsts::instance();
0034   
0035   pair<int, int> runseg = Fun4AllUtils::GetRunSegment(fnameCalib);
0036   int runnumber = runseg.first;
0037 
0038   bool isAuAu = false;
0039   if(fnameCalib.find("auau") != std::string::npos)
0040     {
0041       std::cout << "This is Au+Au, setting flags and cuts" << std::endl;
0042       isAuAu = true;
0043     }
0044   else
0045     {
0046       std::cout << "This is p+p, Au+Au flags will not be set" << std::endl;
0047     }
0048 
0049   
0050   rc -> set_StringFlag("CDB_GLOBALTAG",dbtag);
0051   rc -> set_uint64Flag("TIMESTAMP",runnumber);
0052   CDBInterface::instance() -> Verbosity(1);
0053 
0054   gSystem->Load("libg4dst");
0055   
0056   Fun4AllInputManager *inRaw = new Fun4AllDstInputManager("DSTRaw");
0057   inRaw->AddFile(fnameRaw);
0058   se->registerInputManager(inRaw);
0059 
0060   Fun4AllInputManager *inCalib = new Fun4AllDstInputManager("DSTCalib");
0061   inCalib->AddFile(fnameCalib);
0062   se->registerInputManager(inCalib);
0063 
0064   //you need this call to calibrate the data!
0065   Process_Calo_Calib();
0066 
0067   
0068   caloHistGen *calo = new caloHistGen(outName);
0069 
0070   // Let the subsys reco know what we're looking at
0071   calo->setIsAuAu(isAuAu);
0072 
0073   // What subsystems do you want?
0074   calo->doEMCal(1, "TOWERINFO_CALIB_CEMC");
0075   // Store EMCal clusters?
0076   calo->doClusters(1, "CLUSTERINFO_CEMC");
0077 
0078   // Store HCal information?
0079   calo->doHCals(1, "TOWERINFO_CALIB_HCALOUT", "TOWERINFO_CALIB_HCALIN");
0080 
0081   // Store ZDC information?
0082   calo->doZDC(1, "TOWERS_ZDC");
0083 
0084   // Store GL1 Information?
0085   //calo->doTrig(0, "GL1Packet");//Uncomment for p+p 2024
0086   calo->doTrig(0, "14001");//Temporary for Au+Au 2025
0087 
0088   //reconstruct diphoton pairs?
0089   calo->setPi0Reco(1);
0090   calo->setMaxAlpha(0.6);
0091   if(isAuAu)
0092     {
0093       calo->setCluster1EMin(1.3);
0094       calo->setCluster2EMin(0.7);
0095       calo->peripheralOnlyPi0(true);//only do reco in peripheral bins where S/B ratio is better.
0096       calo->setCaloFrac(0.2);
0097     }
0098   else
0099     {
0100       calo->setCluster1EMin(0.5);
0101       calo->setCluster2EMin(0.5);
0102     }
0103 
0104   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.
0105     {
0106       calo->setTrig("jet");
0107       calo->setTrig("photon");
0108     }
0109   
0110   se->registerSubsystem(calo);
0111 
0112   se->run(nEvents);
0113   se->End();
0114   se->PrintTimer();
0115   std::cout << "All done!" << std::endl;
0116 
0117   gSystem->Exit(0);
0118 }
0119 
0120 #endif