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 <G4_Mbd.C>
0013 #include <GlobalVariables.C>
0014 #include <QA.C>
0015 #include <Trkr_RecoInit.C>
0016 #include <Trkr_Clustering.C>
0017 #include <Trkr_Reco.C>
0018 #include <Trkr_TpcReadoutInit.C>
0019
0020 #include <ffamodules/CDBInterface.h>
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 <eventdisplay/TrackerEventDisplay.h>
0029 #include <phool/recoConsts.h>
0030 #include <trackingqa/InttClusterQA.h>
0031
0032 #include <cdbobjects/CDBTTree.h>
0033
0034 #include <trackingqa/MicromegasClusterQA.h>
0035
0036 #include <trackingqa/MvtxClusterQA.h>
0037
0038 #include <trackingdiagnostics/TrackResiduals.h>
0039 #include <trackingdiagnostics/TrkrNtuplizer.h>
0040 #include <trackingqa/TpcClusterQA.h>
0041 #include <trackreco/AzimuthalSeeder.h>
0042
0043 #include <stdio.h>
0044
0045 R__LOAD_LIBRARY(libfun4all.so)
0046 R__LOAD_LIBRARY(libffamodules.so)
0047 R__LOAD_LIBRARY(libphool.so)
0048 R__LOAD_LIBRARY(libcdbobjects.so)
0049 R__LOAD_LIBRARY(libmvtx.so)
0050 R__LOAD_LIBRARY(libintt.so)
0051 R__LOAD_LIBRARY(libtpc.so)
0052 R__LOAD_LIBRARY(libmicromegas.so)
0053 R__LOAD_LIBRARY(libTrackingDiagnostics.so)
0054 R__LOAD_LIBRARY(libtrackingqa.so)
0055 R__LOAD_LIBRARY(libEventDisplay.so)
0056 void Fun4All_ZFAllTrackers(
0057 const int nEvents = 0,
0058 const std::string tpcfilename = "DST_TRKR_CLUSTER_run2pp_ana466_2024p012_v001-00052077-00000.root",
0059 const std::string tpcdir = "/sphenix/lustre01/sphnxpro/production/run2pp/physics/ana466_2024p012_v001/DST_TRKR_CLUSTER/run_00052000_00052100/dst/",
0060 const std::string outfilename = "clusters_seeds",
0061 const bool convertSeeds = true)
0062 {
0063 std::string inputtpcRawHitFile = tpcdir + tpcfilename;
0064
0065 G4TRACKING::convert_seeds_to_svtxtracks = convertSeeds;
0066 std::cout << "Converting to seeds : " << G4TRACKING::convert_seeds_to_svtxtracks << std::endl;
0067 std::pair<int, int>
0068 runseg = Fun4AllUtils::GetRunSegment(tpcfilename);
0069 int runnumber = runseg.first;
0070 int segment = runseg.second;
0071
0072 G4TRACKING::SC_CALIBMODE = false;
0073 Enable::MVTX_APPLYMISALIGNMENT = true;
0074 ACTSGEOM::mvtx_applymisalignment = Enable::MVTX_APPLYMISALIGNMENT;
0075 TRACKING::pp_mode = true;
0076
0077 auto rc = recoConsts::instance();
0078 rc->set_IntFlag("RUNNUMBER", runnumber);
0079 Enable::CDB = true;
0080 rc->set_StringFlag("CDB_GLOBALTAG", "ProdA_2024");
0081 rc->set_uint64Flag("TIMESTAMP", runnumber);
0082 std::string geofile = CDBInterface::instance()->getUrl("Tracking_Geometry");
0083
0084 TpcReadoutInit( runnumber );
0085 std::cout<< " run: " << runnumber
0086 << " samples: " << TRACKING::reco_tpc_maxtime_sample
0087 << " pre: " << TRACKING::reco_tpc_time_presample
0088 << " vdrift: " << G4TPC::tpc_drift_velocity_reco
0089 << std::endl;
0090
0091
0092 TString outfile = outfilename + "_" + runnumber + "-" + segment + ".root";
0093 std::string theOutfile = outfile.Data();
0094 auto se = Fun4AllServer::instance();
0095 se->Verbosity(1);
0096
0097 Fun4AllRunNodeInputManager *ingeo = new Fun4AllRunNodeInputManager("GeoIn");
0098 ingeo->AddFile(geofile);
0099 se->registerInputManager(ingeo);
0100
0101 G4MAGNET::magfield = "0.01";
0102 G4MAGNET::magfield_tracking = G4MAGNET::magfield;
0103 G4MAGNET::magfield_rescale = 1;
0104 TrackingInit();
0105
0106 auto hitsin = new Fun4AllDstInputManager("InputManager");
0107 hitsin->fileopen(inputtpcRawHitFile);
0108
0109 se->registerInputManager(hitsin);
0110
0111 TRACKING::tpc_zero_supp = true;
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131 Tracking_Reco_TrackSeed_ZeroField();
0132
0133 auto silicon_match = new PHSiliconTpcTrackMatching;
0134 silicon_match->Verbosity(0);
0135
0136
0137
0138
0139 silicon_match->window_dx.set_QoverpT_maxabs({2.6,0,0});
0140 silicon_match->window_dy.set_QoverpT_maxabs({2.3,0,0});
0141 silicon_match->window_dz.set_QoverpT_range({-2.9,0,0},{4.2,0,0});
0142 silicon_match->window_deta.set_QoverpT_maxabs({0.06,0,0});
0143 silicon_match->window_dphi.set_QoverpT_maxabs({0.11,0,0});
0144 silicon_match->set_test_windows_printout(false);
0145 silicon_match->set_pp_mode(TRACKING::pp_mode);
0146 silicon_match->zeroField(true);
0147 se->registerSubsystem(silicon_match);
0148
0149 auto mm_match = new PHMicromegasTpcTrackMatching;
0150 mm_match->Verbosity(0);
0151 mm_match->set_pp_mode(TRACKING::pp_mode);
0152
0153 mm_match->set_rphi_search_window_lyr1(3.);
0154 mm_match->set_rphi_search_window_lyr2(15.0);
0155 mm_match->set_z_search_window_lyr1(30.0);
0156 mm_match->set_z_search_window_lyr2(3.);
0157
0158 mm_match->set_min_tpc_layer(38);
0159 mm_match->set_test_windows_printout(true);
0160 mm_match->zeroField(true);
0161 se->registerSubsystem(mm_match);
0162
0163 if (G4TRACKING::convert_seeds_to_svtxtracks)
0164 {
0165
0166 auto converter = new TrackSeedTrackMapConverter;
0167
0168
0169 converter->setTrackSeedName("SvtxTrackSeedContainer");
0170 converter->setFieldMap(G4MAGNET::magfield_tracking);
0171 converter->Verbosity(0);
0172 converter->constField();
0173 se->registerSubsystem(converter);
0174 }
0175 else
0176 {
0177 auto deltazcorr = new PHTpcDeltaZCorrection;
0178 deltazcorr->Verbosity(0);
0179 se->registerSubsystem(deltazcorr);
0180
0181
0182 auto actsFit = new PHActsTrkFitter;
0183 actsFit->Verbosity(0);
0184 actsFit->commissioning(G4TRACKING::use_alignment);
0185
0186 actsFit->fitSiliconMMs(G4TRACKING::SC_CALIBMODE);
0187 actsFit->setUseMicromegas(G4TRACKING::SC_USE_MICROMEGAS);
0188 actsFit->set_pp_mode(TRACKING::pp_mode);
0189 actsFit->set_use_clustermover(true);
0190 actsFit->useActsEvaluator(false);
0191 actsFit->useOutlierFinder(false);
0192 actsFit->setFieldMap(G4MAGNET::magfield_tracking);
0193 se->registerSubsystem(actsFit);
0194 }
0195
0196
0197
0198 PHSimpleVertexFinder *finder = new PHSimpleVertexFinder;
0199 finder->zeroField(true);
0200 finder->Verbosity(0);
0201 finder->setDcaCut(0.5);
0202 finder->setTrackPtCut(-99999.);
0203 finder->setBeamLineCut(1);
0204 finder->setTrackQualityCut(1000000000);
0205 finder->setNmvtxRequired(3);
0206 finder->setOutlierPairCut(0.1);
0207 se->registerSubsystem(finder);
0208
0209 TString residoutfile = theOutfile + "_resid.root";
0210 std::string residstring(residoutfile.Data());
0211
0212 auto resid = new TrackResiduals("TrackResiduals");
0213 resid->outfileName(residstring);
0214 resid->alignment(false);
0215 resid->clusterTree();
0216 resid->hitTree();
0217 resid->zeroField();
0218 resid->convertSeeds(G4TRACKING::convert_seeds_to_svtxtracks);
0219 resid->Verbosity(0);
0220 se->registerSubsystem(resid);
0221
0222
0223
0224 if (Enable::QA)
0225 {
0226 se->registerSubsystem(new MvtxClusterQA);
0227 se->registerSubsystem(new InttClusterQA);
0228 se->registerSubsystem(new TpcClusterQA);
0229 se->registerSubsystem(new MicromegasClusterQA);
0230 }
0231 se->run(nEvents);
0232 se->End();
0233 se->PrintTimer();
0234
0235 if (Enable::QA)
0236 {
0237 TString qaname = theOutfile + "_qa.root";
0238 std::string qaOutputFileName(qaname.Data());
0239 QAHistManagerDef::saveQARootFile(qaOutputFileName);
0240 }
0241
0242 delete se;
0243 std::cout << "Finished" << std::endl;
0244 gSystem->Exit(0);
0245 }