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