Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2026-04-03 08:08:52

0001 #include <ffamodules/FlagHandler.h>
0002 #include <ffamodules/HeadReco.h>
0003 #include <ffamodules/SyncReco.h>
0004 
0005 #include <fun4all/Fun4AllDstInputManager.h>
0006 #include <fun4all/Fun4AllDstOutputManager.h>
0007 #include <fun4all/Fun4AllInputManager.h>
0008 #include <fun4all/Fun4AllRunNodeInputManager.h>
0009 #include <fun4all/Fun4AllServer.h>
0010 #include <fun4all/Fun4AllUtils.h>
0011 #include <fun4all/SubsysReco.h>
0012 
0013 #include <phool/recoConsts.h>
0014 
0015 #include <ffamodules/CDBInterface.h>
0016 #include <GlobalVariables.C>
0017 
0018 #include <ctime>
0019 #include <iostream>
0020 
0021 R__LOAD_LIBRARY(libfun4all.so)
0022 
0023 #include <triggerbitselection/DstPhotonSelection.h>
0024 R__LOAD_LIBRARY(libtriggerbitselection.so.so)
0025 
0026 void Fun4All_DstPhotonSelection(int nevents = 1, const std::string &dst_triggered_name = "DST_CALOFITTING.root")
0027 {
0028 
0029   // Print the date
0030   std::time_t t = std::time(0); // get time now
0031   std::tm* now = std::localtime(&t);
0032   std::cout << "date = " << (now->tm_year + 1900) << "-" << (now->tm_mon + 1) << "-" << now->tm_mday << std::endl;
0033 
0034   Fun4AllServer *se = Fun4AllServer::instance();
0035   se->Verbosity(0);
0036 
0037   // se->Verbosity(verbosity);
0038   recoConsts *rc = recoConsts::instance();
0039   //===============
0040   // conditions DB flags
0041   //===============
0042   pair<int, int> runseg = Fun4AllUtils::GetRunSegment(dst_triggered_name);
0043   int runnumber = runseg.first;
0044   //cout << "run number = " << runnumber << endl;
0045 
0046   // global tag
0047   // cf gmattson, apply the tower mask from the CDB
0048   rc->set_StringFlag("CDB_GLOBALTAG", "ProdA_2024");
0049   // // 64 bit timestamp
0050   rc->set_uint64Flag("TIMESTAMP", runnumber);
0051   rc->set_IntFlag("RUNNUMBER", runnumber);
0052   
0053   Fun4AllInputManager *in = new Fun4AllDstInputManager("DST_TRIGGER");
0054   in->AddFile(dst_triggered_name);
0055   se->registerInputManager(in);
0056 
0057   std::string dstname = std::regex_replace(dst_triggered_name, std::regex("DST_CALOFITTING"), "DST_PHOTON_TRIGGER_LIST");
0058   std::cout << "dstname = " << dstname << std::endl;
0059   Fun4AllOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", dstname);
0060   // Only keep DST#Sync in the output node
0061   out->StripNode("14001");
0062   out->StripRunNode("TriggerRunInfo");
0063   out->StripRunNode("RunHeader");
0064   out->StripRunNode("CdbUrl");
0065   out->StripRunNode("Flags");
0066   out->SplitLevel(99);
0067   se->registerOutputManager(out);
0068 
0069   ///////////////////
0070   // analysis modules
0071   // foldername = ".";
0072   DstPhotonSelection *selection = new DstPhotonSelection("photonmodulename", runnumber);
0073   se->registerSubsystem(selection);
0074 
0075 
0076   // Only keep the relevant nodes: Event number + GL1 info (must be done before fileopen)
0077   se->BranchSelect("*",0);
0078   se->BranchSelect("DST#Sync", 1);
0079   se->BranchSelect("DST#PacketsKeep#14001", 1);
0080   se->run(nevents);
0081   se->End();
0082   se->PrintTimer();
0083   delete se;
0084 
0085   TFile* f_done_signal = new TFile("DONE.root","recreate");
0086   std::cout << "All done!" << std::endl;
0087   gSystem->Exit(0);
0088 }
0089