Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2026-08-30 08:24:55

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 // leave the GlobalVariables.C at the beginning, an empty line afterwards
0009 // protects its position against reshuffling by clang-format
0010 #include <GlobalVariables.C>
0011 
0012 #include <G4_ActsGeom.C>
0013 #include <G4_Global.C>
0014 #include <G4_Magnet.C>
0015 #include <G4_Mbd.C>
0016 #include <QA.C>
0017 #include <Trkr_Clustering.C>
0018 #include <Trkr_LaserClustering.C>
0019 #include <Trkr_Reco.C>
0020 #include <Trkr_RecoInit.C>
0021 #include <Trkr_TpcReadoutInit.C>
0022 
0023 #include <cdbobjects/CDBTTree.h>
0024 
0025 #include <ffamodules/CDBInterface.h>
0026 #include <ffamodules/FlagHandler.h>
0027 
0028 #include <fun4all/Fun4AllDstInputManager.h>
0029 #include <fun4all/Fun4AllDstOutputManager.h>
0030 #include <fun4all/Fun4AllInputManager.h>
0031 #include <fun4all/Fun4AllOutputManager.h>
0032 #include <fun4all/Fun4AllRunNodeInputManager.h>
0033 #include <fun4all/Fun4AllServer.h>
0034 #include <fun4all/Fun4AllUtils.h>
0035 
0036 #include <fun4all/SubsysReco.h>
0037 #include <fun4all/Fun4AllReturnCodes.h>
0038 
0039 #include <phool/recoConsts.h>
0040 
0041 #include <tpctrackreco/Tpc_ModuleTrackReco.h>
0042 #include <tpctrackreco/Tpc_AssembledTrackReco.h>
0043 #include <tpctrackreco/Tpc_PolyTrackReco.h>
0044 #include <tpctrackreco/Tpc_PolyTrackVertexer.h>
0045 #include <tpctrackreco/Tpc_PolyClusterizer.h>
0046 
0047 #include <trackingdiagnostics/Tpc_ModuleTrackDisplay.h>
0048 #include <trackingdiagnostics/Tpc_AssembledTrackDisplay.h>
0049 #include <trackingdiagnostics/Tpc_PolyClusterDisplay.h>
0050 #include <trackingdiagnostics/Tpc_PolyClusterResiduals.h>
0051 
0052 
0053 
0054 R__LOAD_LIBRARY(libfun4all.so)
0055 R__LOAD_LIBRARY(libffamodules.so)
0056 R__LOAD_LIBRARY(libphool.so)
0057 R__LOAD_LIBRARY(libcdbobjects.so)
0058 R__LOAD_LIBRARY(libmvtx.so)
0059 R__LOAD_LIBRARY(libintt.so)
0060 R__LOAD_LIBRARY(libtpc.so)
0061 R__LOAD_LIBRARY(libmicromegas.so)
0062 R__LOAD_LIBRARY(libtpctrackreco.so)
0063 R__LOAD_LIBRARY(libTrackingDiagnostics.so)
0064 
0065 
0066 
0067 void Fun4All_TPC_Analysis(
0068     const int nEvents = 2,
0069     const int runnumber = 79513,
0070     const int segment = 0,
0071     const std::string&  /*outdir*/ = ".",
0072     const std::string& indir = ".",
0073     const int  /*nSkip*/ = 0,
0074     const std::string& collision = "run3pp",
0075     const std::string& production = "ana532_nocdbtag_v001",
0076     const std::string& outfilename = "HITS_ppFieldOn")
0077 {
0078   auto *se = Fun4AllServer::instance();
0079   se->Verbosity(1);
0080   auto *rc = recoConsts::instance();
0081 
0082 
0083   const std::string dsttype = "TPC";
0084   std::string filename = indir+"/DST_"+dsttype+"_"+collision+"_"+production+"-"+std::to_string(runnumber)+"-"+std::to_string(segment)+".root";
0085 
0086   auto *hitsinclus = new Fun4AllDstInputManager("TpcInputManager");
0087   hitsinclus->fileopen(filename);
0088   se->registerInputManager(hitsinclus);
0089 
0090   rc->set_IntFlag("RUNNUMBER", runnumber);
0091   rc->set_IntFlag("RUNSEGMENT", segment);
0092 
0093   Enable::QA = false;
0094   Enable::CDB = true;
0095   rc->set_StringFlag("CDB_GLOBALTAG", "newcdbtag");
0096   rc->set_uint64Flag("TIMESTAMP", runnumber);
0097 
0098 
0099 
0100   TRACKING::streaming_mode = true;
0101 
0102   FlagHandler *flag = new FlagHandler();
0103   se->registerSubsystem(flag);
0104 
0105   std::string geofile = CDBInterface::instance()->getUrl("Tracking_Geometry");
0106 
0107   Fun4AllRunNodeInputManager *ingeo = new Fun4AllRunNodeInputManager("GeoIn");
0108   ingeo->AddFile(geofile);
0109   se->registerInputManager(ingeo);
0110 
0111 
0112 
0113   TpcReadoutInit(runnumber);
0114 
0115 
0116   //For the module tracks display uncomment following line
0117   se->registerSubsystem(new Tpc_ModuleTrackDisplay("Tpc_ModuleTrackDisplay", "tpc_moduletrack_display_" + outfilename + "_" + std::to_string(runnumber) + ".root"));
0118   
0119   //For the assembled tracks display uncomment following line
0120   //se->registerSubsystem(new Tpc_AssembledTrackDisplay("Tpc_AssembledTrackDisplay", "tpc_assembledtrack_display_" + outfilename + "_" + to_string(runnumber) + ".root"));
0121   
0122   //For the  cluster and TPC SA tracks display uncomment following line
0123   //se->registerSubsystem(new Tpc_PolyClusterDisplay("Tpc_PolyClusterDisplay", "tpc_poly_cluster_display_" + outfilename + "_" + to_string(runnumber) + ".root"));
0124   
0125   //For the  residual tree output uncomment following block (options to put cuts on minimum pT and minimum number of clusters in TPC SA are available)
0126   /*auto resid = new Tpc_PolyClusterResiduals("Tpc_PolyClusterResiduals",
0127                                         outdir + "/tpc_poly_track_residuals"+ outfilename + "_" + to_string(runnumber) + to_string(segment) + ".root" );
0128   resid->setMinPt(0);
0129   resid->setMinTpcClusters(20);
0130   se->registerSubsystem(resid);
0131   */
0132 
0133   se->run(nEvents);
0134   se->Print("NODETREE");
0135   se->End();
0136   se->PrintTimer();
0137 
0138 
0139   CDBInterface::instance()->Print();
0140   delete se;
0141   std::cout << "Finished" << std::endl;
0142   gSystem->Exit(0);
0143 }