Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:24:10

0001 /*
0002  * This macro is run in our daily CI and is intended as a minimum working
0003  * example showing how to unpack the raw hits into the offline tracker hit
0004  * format. No other reconstruction or analysis is performed
0005  */
0006 // leave the GlobalVariables.C at the beginning, an empty line afterwards
0007 // protects its position against reshuffling by clang-format
0008 #include <GlobalVariables.C>
0009 
0010 #include <Trkr_Clustering.C>
0011 #include <Trkr_TpcReadoutInit.C>
0012 
0013 #include <ffamodules/CDBInterface.h>
0014 
0015 #include <fun4all/Fun4AllDstInputManager.h>
0016 #include <fun4all/Fun4AllDstOutputManager.h>
0017 #include <fun4all/Fun4AllInputManager.h>
0018 #include <fun4all/Fun4AllOutputManager.h>
0019 #include <fun4all/Fun4AllRunNodeInputManager.h>
0020 #include <fun4all/Fun4AllServer.h>
0021 
0022 #include <phool/recoConsts.h>
0023 
0024 #include <format>
0025 
0026 R__LOAD_LIBRARY(libfun4all.so)
0027 R__LOAD_LIBRARY(libffamodules.so)
0028 R__LOAD_LIBRARY(libmvtx.so)
0029 R__LOAD_LIBRARY(libintt.so)
0030 R__LOAD_LIBRARY(libtpc.so)
0031 R__LOAD_LIBRARY(libmicromegas.so)
0032 void Fun4All_TrkrHitSet_Unpacker(
0033     const int nEvents = 2,
0034     const int runnumber = 26048,
0035     const std::string& outfilename = "cosmics",
0036     const std::string& dir = "/sphenix/lustre01/sphnxpro/commissioning/aligned_streaming_all_4/",
0037     const std::string& file = "cosmics-")
0038 {
0039   gSystem->Load("libg4dst.so");
0040   std::string inputRawHitFile = dir + file;
0041   std::string filename = std::format("{}{:08}-0000.root",inputRawHitFile,runnumber);
0042 
0043   auto *se = Fun4AllServer::instance();
0044   se->Verbosity(1);
0045   auto *rc = recoConsts::instance();
0046   std::cout<< " run: " << runnumber
0047        << " samples: " << TRACKING::reco_tpc_maxtime_sample
0048        << " pre: " << TRACKING::reco_tpc_time_presample
0049        << " vdrift: " << G4TPC::tpc_drift_velocity_reco
0050        << std::endl;
0051 
0052   rc->set_IntFlag("RUNNUMBER", runnumber);
0053 
0054   Enable::CDB = true;
0055   rc->set_StringFlag("CDB_GLOBALTAG", "ProdA_2024");
0056   rc->set_uint64Flag("TIMESTAMP", runnumber);
0057   
0058   TpcReadoutInit( runnumber );
0059   std::string geofile = CDBInterface::instance()->getUrl("Tracking_Geometry");
0060   Fun4AllRunNodeInputManager *ingeo = new Fun4AllRunNodeInputManager("GeoIn");
0061   ingeo->AddFile(geofile);
0062   se->registerInputManager(ingeo);
0063 
0064   auto *hitsin = new Fun4AllDstInputManager("InputManager");
0065   hitsin->fileopen(filename);
0066   se->registerInputManager(hitsin);
0067 
0068   Mvtx_HitUnpacking();
0069   Intt_HitUnpacking();
0070   Tpc_HitUnpacking();
0071   Micromegas_HitUnpacking();
0072 
0073   Fun4AllOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", outfilename);
0074   out->StripNode("MVTXRAWHIT");
0075   out->StripNode("INTTRAWHIT");
0076   out->StripNode("MICROMEGASRAWHIT");
0077   out->StripNode("TPCRAWHIT");
0078   out->StripNode("GL1RAWHIT");
0079 
0080   se->registerOutputManager(out);
0081 
0082   se->run(nEvents);
0083   se->End();
0084   se->PrintTimer();
0085 
0086   delete se;
0087   std::cout << "Finished" << std::endl;
0088   gSystem->Exit(0);
0089 }