Back to home page

sPhenix code displayed by LXR

 
 

    


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

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 #include <GlobalVariables.C>
0007 #include <Trkr_Clustering.C>
0008 #include <Trkr_TpcReadoutInit.C>
0009 
0010 #include <fun4all/Fun4AllDstInputManager.h>
0011 #include <fun4all/Fun4AllDstOutputManager.h>
0012 #include <fun4all/Fun4AllInputManager.h>
0013 #include <fun4all/Fun4AllOutputManager.h>
0014 #include <fun4all/Fun4AllRunNodeInputManager.h>
0015 #include <fun4all/Fun4AllServer.h>
0016 
0017 #include <ffamodules/CDBInterface.h>
0018 
0019 #include <phool/recoConsts.h>
0020 
0021 #include <stdio.h>
0022 
0023 R__LOAD_LIBRARY(libfun4all.so)
0024 R__LOAD_LIBRARY(libffamodules.so)
0025 R__LOAD_LIBRARY(libmvtx.so)
0026 R__LOAD_LIBRARY(libintt.so)
0027 R__LOAD_LIBRARY(libtpc.so)
0028 R__LOAD_LIBRARY(libmicromegas.so)
0029 void Fun4All_TrkrHitSet_Unpacker(
0030     const int nEvents = 2,
0031     const int runnumber = 26048,
0032     const std::string outfilename = "cosmics",
0033     const std::string dir = "/sphenix/lustre01/sphnxpro/commissioning/aligned_streaming_all_4/",
0034     const std::string file = "cosmics-")
0035 {
0036   gSystem->Load("libg4dst.so");
0037   std::string inputRawHitFile = dir + file;
0038   char filename[500];
0039   sprintf(filename, "%s%08d-0000.root", inputRawHitFile.c_str(), runnumber);
0040 
0041   auto se = Fun4AllServer::instance();
0042   se->Verbosity(1);
0043   auto rc = recoConsts::instance();
0044   std::cout<< " run: " << runnumber
0045        << " samples: " << TRACKING::reco_tpc_maxtime_sample
0046        << " pre: " << TRACKING::reco_tpc_time_presample
0047        << " vdrift: " << G4TPC::tpc_drift_velocity_reco
0048        << std::endl;
0049 
0050   rc->set_IntFlag("RUNNUMBER", runnumber);
0051 
0052   Enable::CDB = true;
0053   rc->set_StringFlag("CDB_GLOBALTAG", "ProdA_2024");
0054   rc->set_uint64Flag("TIMESTAMP", runnumber);
0055   
0056   TpcReadoutInit( runnumber );
0057   std::string geofile = CDBInterface::instance()->getUrl("Tracking_Geometry");
0058   Fun4AllRunNodeInputManager *ingeo = new Fun4AllRunNodeInputManager("GeoIn");
0059   ingeo->AddFile(geofile);
0060   se->registerInputManager(ingeo);
0061 
0062   auto hitsin = new Fun4AllDstInputManager("InputManager");
0063   hitsin->fileopen(filename);
0064   se->registerInputManager(hitsin);
0065 
0066   Mvtx_HitUnpacking();
0067   Intt_HitUnpacking();
0068   Tpc_HitUnpacking();
0069   Micromegas_HitUnpacking();
0070 
0071   Fun4AllOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", outfilename);
0072   out->StripNode("MVTXRAWHIT");
0073   out->StripNode("INTTRAWHIT");
0074   out->StripNode("MICROMEGASRAWHIT");
0075   out->StripNode("TPCRAWHIT");
0076   out->StripNode("GL1RAWHIT");
0077 
0078   se->registerOutputManager(out);
0079 
0080   se->run(nEvents);
0081   se->End();
0082   se->PrintTimer();
0083 
0084   delete se;
0085   std::cout << "Finished" << std::endl;
0086   gSystem->Exit(0);
0087 }