Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-14 08:14:26

0001 /*
0002  * This macro shows a minimum working example of running the tracking
0003  * hit unpackers with some basic seeding algorithms to try to put together
0004  * tracks. There are some analysis modules run at the end which package
0005  * hits, clusters, and clusters on tracks into trees for analysis.
0006  */
0007 
0008 #include <fun4all/Fun4AllUtils.h>
0009 #include <GlobalVariables.C>
0010 #include <G4_ActsGeom.C>
0011 #include <G4_Global.C>
0012 #include <G4_Magnet.C>
0013 #include <G4_Mbd.C>
0014 #include <Trkr_Clustering.C>
0015 #include <Trkr_LaserClustering.C>
0016 #include <Trkr_RecoInit.C>
0017 #include <Trkr_TpcReadoutInit.C>
0018 
0019 #include <ffamodules/CDBInterface.h>
0020 #include <fun4all/Fun4AllDstInputManager.h>
0021 #include <fun4all/Fun4AllDstOutputManager.h>
0022 #include <fun4all/Fun4AllInputManager.h>
0023 #include <fun4all/Fun4AllOutputManager.h>
0024 #include <fun4all/Fun4AllRunNodeInputManager.h>
0025 #include <fun4all/Fun4AllServer.h>
0026 
0027 #include <phool/recoConsts.h>
0028 
0029 //#include <tpc/LaserEventIdentifier.h>
0030 
0031 #include <laserclusterqa/laminationClusterQA.h>
0032 
0033 #include <stdio.h>
0034 R__LOAD_LIBRARY(libfun4all.so)
0035 R__LOAD_LIBRARY(libffamodules.so)
0036 R__LOAD_LIBRARY(libtpc.so)
0037 R__LOAD_LIBRARY(libtpccalib.so)
0038 R__LOAD_LIBRARY(libLaserClusterQA.so)
0039 void Fun4All_laminationClusterQA(
0040     const int nEvents = 10,
0041     const std::string filelist = "/sphenix/lustre01/sphnxpro/commissioning/slurp/tpcbeam/run_00041900_00042000/",
0042     const std::string outdir = "/sphenig/tg/tg01/jets/bkimelman/",
0043     const std::string prod = "ana441_2024p007",
0044     const std::string type = "run2pp")
0045 
0046 {
0047 
0048   auto se = Fun4AllServer::instance();
0049   se->Verbosity(2);
0050 
0051   
0052   std::ifstream ifs(filelist);
0053   std::string filepath;
0054 
0055   auto rc = recoConsts::instance();
0056 
0057   Enable::CDB = true;
0058   rc->set_StringFlag("CDB_GLOBALTAG", "ProdA_2024");
0059 
0060   int i=0;
0061   int runnumber = 0;
0062   int segment = 0;
0063   while(std::getline(ifs,filepath))
0064   {
0065     std::cout << "Adding DST with filepath: " << filepath << std::endl;
0066     if(i==0)
0067     {
0068       std::pair<int, int> runseg = Fun4AllUtils::GetRunSegment(filepath);
0069       runnumber = runseg.first;
0070       segment = runseg.second;
0071       rc->set_IntFlag("RUNNUMBER",runnumber);
0072       rc->set_uint64Flag("TIMESTAMP",runnumber);
0073     }
0074 
0075     //std::string inputname = "InputManager" + std::to_string(i);
0076     //auto hitsin = new Fun4AllDstInputManager(inputname);
0077     //hitsin->fileopen(filepath);
0078     //hitsin->AddFile(filepath);
0079     //se->registerInputManager(hitsin);
0080     i++;
0081   }
0082 
0083   auto hitsin = new Fun4AllDstInputManager("InputManager");
0084   hitsin->AddListFile(filelist);
0085   se->registerInputManager(hitsin);
0086 
0087 
0088   std::string geofile = CDBInterface::instance()->getUrl("Tracking_Geometry");
0089   Fun4AllRunNodeInputManager *ingeo = new Fun4AllRunNodeInputManager("GeoIn");
0090   ingeo->AddFile(geofile);
0091   se->registerInputManager(ingeo);
0092 
0093   //  G4TPC::tpc_drift_velocity_reco = (8.0 / 1000) * 107.0 / 105.0;
0094   G4TPC::ENABLE_MODULE_EDGE_CORRECTIONS = true;
0095   //to turn on the default static corrections, enable the two lines below
0096   G4TPC::ENABLE_STATIC_CORRECTIONS = true;
0097 
0098   if(runnumber == 53098)
0099   {
0100     G4TPC::ENABLE_STATIC_CORRECTIONS = false;
0101   }
0102   
0103   G4TPC::USE_PHI_AS_RAD_STATIC_CORRECTIONS=false;
0104 
0105 
0106   G4TPC::ENABLE_AVERAGE_CORRECTIONS = false;
0107   //G4TPC::average_correction_filename = std::string(Form("/sphenix/tg/tg01/jets/bkimelman/BenProduction/Feb25_2025/Laminations_run2pp_ana466_2024p012_v001-%08d.root",runnumber));
0108   //G4TPC::USE_PHI_AS_RAD_AVERAGE_CORRECTIONS=false;
0109   //G4TPC::average_correction_interpolate = false;
0110   
0111   //G4TPC::DISTORTIONS_USE_PHI_AS_RADIANS = false;
0112   G4TPC::ENABLE_CENTRAL_MEMBRANE_CLUSTERING = true;
0113 
0114   //TRACKING::reco_tpc_maxtime_sample = 1023;
0115   TRACKING::tpc_zero_supp = true;
0116 
0117   TrackingInit();
0118 
0119 
0120   laminationClusterQA *lcQA = new laminationClusterQA("laminationClusterQA");
0121   lcQA->setOutfile(Form("%s/laminationHitQA_%s_%s-%08d.root",outdir.c_str(),type.c_str(),prod.c_str(),runnumber));
0122   se->registerSubsystem(lcQA);
0123 
0124   se->run(nEvents);
0125   //se->run(-1);
0126   se->End();
0127   se->PrintTimer();
0128 
0129   delete se;
0130   std::cout << "Finished" << std::endl;
0131   gSystem->Exit(0);
0132 }