File indexing completed on 2025-12-17 09:24:08
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #include <GlobalVariables.C>
0011
0012 #include <G4_ActsGeom.C>
0013 #include <G4_Global.C>
0014 #include <G4_Magnet.C>
0015 #include <QA.C>
0016 #include <Trkr_Clustering.C>
0017 #include <Trkr_Reco.C>
0018 #include <Trkr_RecoInit.C>
0019 #include <Trkr_TpcReadoutInit.C>
0020
0021 #include <tpccalib/PHTpcResiduals.h>
0022
0023 #include <trackingqa/SiliconSeedsQA.h>
0024 #include <trackingqa/TpcSeedsQA.h>
0025 #include <trackingqa/TpcSiliconQA.h>
0026
0027 #include <trackingdiagnostics/TrackResiduals.h>
0028 #include <trackingdiagnostics/TrkrNtuplizer.h>
0029
0030 #include <ffamodules/CDBInterface.h>
0031
0032 #include <fun4all/Fun4AllDstInputManager.h>
0033 #include <fun4all/Fun4AllDstOutputManager.h>
0034 #include <fun4all/Fun4AllInputManager.h>
0035 #include <fun4all/Fun4AllOutputManager.h>
0036 #include <fun4all/Fun4AllRunNodeInputManager.h>
0037 #include <fun4all/Fun4AllServer.h>
0038 #include <fun4all/Fun4AllUtils.h>
0039
0040 #include <phool/recoConsts.h>
0041
0042 R__LOAD_LIBRARY(libfun4all.so)
0043 R__LOAD_LIBRARY(libffamodules.so)
0044 R__LOAD_LIBRARY(libphool.so)
0045 R__LOAD_LIBRARY(libcdbobjects.so)
0046 R__LOAD_LIBRARY(libTrackingDiagnostics.so)
0047 R__LOAD_LIBRARY(libtrackingqa.so)
0048
0049 void Fun4All_TrackAnalyzer(
0050 const int nEvents = 10,
0051 const std::string &outfilename = "clusters_seeds",
0052 const std::string &trackfilename = "/sphenix/lustre01/sphnxpro/production/run2pp/physics/ana506_2024p023_v001/DST_TRKR_TRACKS/run_00053800_00053900/dst/DST_TRKR_TRACKS_run2pp_ana506_2024p023_v001-00053877-00606.root",
0053 const std::string &seedfilename = "/sphenix/lustre01/sphnxpro/production/run2pp/physics/ana506_2024p023_v001/DST_TRKR_SEED/run_00053800_00053900/dst/DST_TRKR_SEED_run2pp_ana506_2024p023_v001-00053877-00606.root",
0054 const std::string &clusterfilename = "/sphenix/lustre01/sphnxpro/production/run2pp/physics/ana505_2024p023_v001/DST_TRKR_CLUSTER/run_00053800_00053900/dst/DST_TRKR_CLUSTER_run2pp_ana505_2024p023_v001-00053877-00606.root")
0055 {
0056 std::pair<int, int> runseg = Fun4AllUtils::GetRunSegment(seedfilename);
0057 int runnumber = runseg.first;
0058 int segment = runseg.second;
0059
0060 std::cout << " run: " << runnumber
0061 << " samples: " << TRACKING::reco_tpc_maxtime_sample
0062 << " pre: " << TRACKING::reco_tpc_time_presample
0063 << " vdrift: " << G4TPC::tpc_drift_velocity_reco
0064 << std::endl;
0065
0066
0067
0068
0069
0070
0071 G4TRACKING::SC_CALIBMODE = false;
0072 Enable::MVTX_APPLYMISALIGNMENT = true;
0073 ACTSGEOM::mvtx_applymisalignment = Enable::MVTX_APPLYMISALIGNMENT;
0074 TRACKING::pp_mode = true;
0075
0076 std::string theOutfile = outfilename + "_" + std::to_string(runnumber) + "-" + std::to_string(segment) + ".root";
0077
0078 auto *se = Fun4AllServer::instance();
0079 se->Verbosity(1);
0080
0081 auto *rc = recoConsts::instance();
0082 rc->set_IntFlag("RUNNUMBER", runnumber);
0083
0084 Enable::CDB = true;
0085 rc->set_StringFlag("CDB_GLOBALTAG", "newcdbtag");
0086 rc->set_uint64Flag("TIMESTAMP", runnumber);
0087 std::string geofile = CDBInterface::instance()->getUrl("Tracking_Geometry");
0088
0089 Fun4AllRunNodeInputManager *ingeo = new Fun4AllRunNodeInputManager("GeoIn");
0090 ingeo->AddFile(geofile);
0091 se->registerInputManager(ingeo);
0092
0093 TpcReadoutInit(runnumber);
0094
0095
0096
0097
0098
0099 G4TPC::ENABLE_MODULE_EDGE_CORRECTIONS = true;
0100
0101
0102 G4TPC::ENABLE_STATIC_CORRECTIONS = true;
0103 G4TPC::USE_PHI_AS_RAD_STATIC_CORRECTIONS = false;
0104
0105
0106
0107 G4TPC::ENABLE_AVERAGE_CORRECTIONS = true;
0108 G4TPC::USE_PHI_AS_RAD_AVERAGE_CORRECTIONS = false;
0109
0110 G4TPC::average_correction_filename = CDBInterface::instance()->getUrl("TPC_LAMINATION_FIT_CORRECTION");
0111 G4MAGNET::magfield_rescale = 1;
0112 TrackingInit();
0113
0114 auto *hitsinseed = new Fun4AllDstInputManager("SeedInputManager");
0115 hitsinseed->fileopen(seedfilename);
0116 se->registerInputManager(hitsinseed);
0117
0118 auto *hitsinclus = new Fun4AllDstInputManager("ClusterInputManager");
0119 hitsinclus->fileopen(clusterfilename);
0120 se->registerInputManager(hitsinclus);
0121
0122 auto *hitsintrack = new Fun4AllDstInputManager("TrackInputManager");
0123 hitsintrack->fileopen(trackfilename);
0124 se->registerInputManager(hitsintrack);
0125
0126 std::string residstring = theOutfile + "_resid.root";
0127
0128 auto *resid = new TrackResiduals("TrackResiduals");
0129 resid->outfileName(residstring);
0130 resid->alignment(false);
0131
0132
0133 if (G4TRACKING::SC_CALIBMODE && !G4TRACKING::convert_seeds_to_svtxtracks)
0134 {
0135 resid->trackmapName("SvtxSiliconMMTrackMap");
0136 if (G4TRACKING::SC_USE_MICROMEGAS)
0137 {
0138 resid->set_doMicromegasOnly(true);
0139 }
0140 }
0141
0142 resid->clusterTree();
0143 resid->convertSeeds(G4TRACKING::convert_seeds_to_svtxtracks);
0144 resid->Verbosity(0);
0145 se->registerSubsystem(resid);
0146
0147 if (Enable::QA)
0148 {
0149 se->registerSubsystem(new SiliconSeedsQA);
0150 se->registerSubsystem(new TpcSeedsQA);
0151 se->registerSubsystem(new TpcSiliconQA);
0152 }
0153 se->run(nEvents);
0154 se->End();
0155 se->PrintTimer();
0156
0157 std::cout << "CDB Files used:" << std::endl;
0158 CDBInterface::instance()->Print();
0159
0160 if (Enable::QA)
0161 {
0162 std::string qaOutputFileName = theOutfile + "_qa.root";
0163 QAHistManagerDef::saveQARootFile(qaOutputFileName);
0164 }
0165
0166 delete se;
0167 std::cout << "Finished" << std::endl;
0168 gSystem->Exit(0);
0169 }