File indexing completed on 2025-08-03 08:20:30
0001
0002
0003
0004
0005
0006
0007 #include <fun4all/Fun4AllUtils.h>
0008 #include <G4_ActsGeom.C>
0009
0010 #include <G4_Magnet.C>
0011 #include <GlobalVariables.C>
0012 #include <QA.C>
0013 #include <Trkr_Clustering.C>
0014 #include <Trkr_Reco.C>
0015 #include <Trkr_RecoInit.C>
0016 #include <Trkr_TpcReadoutInit.C>
0017
0018 #include <ffamodules/CDBInterface.h>
0019 #include <globalvertex/GlobalVertexReco.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 <kfparticle_sphenix/KFParticle_sPHENIX.h>
0042
0043 #include <stdio.h>
0044
0045 R__LOAD_LIBRARY(libkfparticle_sphenix.so)
0046 R__LOAD_LIBRARY(libcalotrigger.so)
0047
0048 R__LOAD_LIBRARY(libfun4all.so)
0049 R__LOAD_LIBRARY(libffamodules.so)
0050 R__LOAD_LIBRARY(libphool.so)
0051 R__LOAD_LIBRARY(libcdbobjects.so)
0052 R__LOAD_LIBRARY(libTrackingDiagnostics.so)
0053 R__LOAD_LIBRARY(libtrackingqa.so)
0054
0055
0056
0057 void Fun4All_KShortReco(
0058 const int nEvents = 10000,
0059 const std::string inputDST = "DST_TRKR_TRACKS_run2pp_ana475_2024p018_v001-00053877-00000.root",
0060 const std::string inputDir = "/sphenix/lustre01/sphnxpro/production/run2pp/physics/ana475_2024p018_v001/DST_TRKR_TRACKS/run_00053800_00053900/dst/",
0061 const int nSkip = 0)
0062 {
0063 std::string inputSeedFile = inputDir + inputDST;
0064
0065 std::pair<int, int> runseg = Fun4AllUtils::GetRunSegment(inputDST);
0066 int runnumber = runseg.first;
0067 std::stringstream nice_runnumber;
0068 nice_runnumber << std::setw(8) << std::setfill('0') << to_string(runnumber);
0069
0070 int rounded_up = 100*(std::ceil((float) runnumber/100));
0071 std::stringstream nice_rounded_up;
0072 nice_rounded_up << std::setw(8) << std::setfill('0') << to_string(rounded_up);
0073
0074 int rounded_down = 100*(std::floor((float) runnumber/100));
0075 std::stringstream nice_rounded_down;
0076 nice_rounded_down << std::setw(8) << std::setfill('0') << to_string(rounded_down);
0077
0078 int segment = runseg.second;
0079 std::stringstream nice_segment;
0080 nice_segment << std::setw(5) << std::setfill('0') << to_string(segment);
0081
0082 std::stringstream nice_skip;
0083 nice_skip << std::setw(5) << std::setfill('0') << to_string(nSkip);
0084
0085 auto rc = recoConsts::instance();
0086 rc->set_IntFlag("RUNNUMBER", runnumber);
0087
0088 Enable::CDB = true;
0089 rc->set_StringFlag("CDB_GLOBALTAG", "ProdA_2024");
0090 rc->set_uint64Flag("TIMESTAMP", runnumber);
0091 std::string geofile = CDBInterface::instance()->getUrl("Tracking_Geometry");
0092
0093 TpcReadoutInit(runnumber);
0094 std::cout << " run: " << runnumber
0095 << " samples: " << TRACKING::reco_tpc_maxtime_sample
0096 << " pre: " << TRACKING::reco_tpc_time_presample
0097 << " vdrift: " << G4TPC::tpc_drift_velocity_reco
0098 << std::endl;
0099
0100 std::string output_dir = "./";
0101 std::string kfp_header = "outputKFParticle_";
0102 std::string processing_folder = "inReconstruction/";
0103 std::string trailer = "_" + nice_runnumber.str() + "_" + nice_segment.str() + "_" + nice_skip.str() + ".root";
0104 std::string pipi_reconstruction_name = "pipi_reco";
0105
0106
0107 std::string output_file_name = kfp_header + pipi_reconstruction_name + trailer;
0108 std::string pipi_output_dir = output_dir + pipi_reconstruction_name + "/";
0109 std::string output_reco_dir = pipi_output_dir + processing_folder;
0110 std::string pipi_output_reco_file = output_reco_dir + output_file_name;
0111
0112 std::string makeDirectory = "mkdir -p " + output_reco_dir;
0113 system(makeDirectory.c_str());
0114
0115
0116
0117
0118
0119
0120
0121 G4TRACKING::SC_CALIBMODE = false;
0122 Enable::MVTX_APPLYMISALIGNMENT = true;
0123 ACTSGEOM::mvtx_applymisalignment = Enable::MVTX_APPLYMISALIGNMENT;
0124 TRACKING::pp_mode = true;
0125
0126
0127 auto se = Fun4AllServer::instance();
0128 se->Verbosity(1);
0129
0130 Fun4AllRunNodeInputManager *ingeo = new Fun4AllRunNodeInputManager("GeoIn");
0131 ingeo->AddFile(geofile);
0132 se->registerInputManager(ingeo);
0133
0134 TrackingInit();
0135
0136 auto tracks = new Fun4AllDstInputManager("TrackInputManager");
0137 tracks->fileopen(inputSeedFile);
0138 se->registerInputManager(tracks);
0139
0140
0141 GlobalVertexReco* gblvertex = new GlobalVertexReco();
0142 gblvertex->Verbosity(0);
0143 se->registerSubsystem(gblvertex);
0144
0145
0146 KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX("pipi_reco");
0147 kfparticle->Verbosity(0);
0148
0149 kfparticle->setDecayDescriptor("K_S0 -> pi^+ pi^-");
0150
0151 kfparticle->usePID(false);
0152
0153 kfparticle->dontUseGlobalVertex(true);
0154 kfparticle->requireTrackVertexBunchCrossingMatch(true);
0155 kfparticle->getAllPVInfo(true);
0156 kfparticle->allowZeroMassTracks();
0157 kfparticle->use2Dmatching(false);
0158 kfparticle->getTriggerInfo(false);
0159 kfparticle->getDetectorInfo(false);
0160 kfparticle->saveDST(false);
0161 kfparticle->setContainerName("pipi_reco");
0162 kfparticle->magFieldFile("FIELDMAP_TRACKING");
0163
0164
0165 kfparticle->constrainToPrimaryVertex(true);
0166 kfparticle->setMotherIPchi2(100);
0167 kfparticle->setFlightDistancechi2(-1.);
0168 kfparticle->setMinDIRA(0.999);
0169 kfparticle->setDecayLengthRange(0.1, FLT_MAX);
0170
0171
0172 kfparticle->setMinimumTrackPT(0.0);
0173 kfparticle->setMinimumTrackIPchi2(-1.);
0174 kfparticle->setMinimumTrackIP(-1.);
0175 kfparticle->setMaximumTrackchi2nDOF(100.);
0176 kfparticle->setMinTPChits(25);
0177
0178
0179 kfparticle->setMaximumVertexchi2nDOF(20);
0180 kfparticle->setMaximumDaughterDCA(0.5);
0181
0182
0183 kfparticle->setMinMVTXhits(0);
0184 kfparticle->setMinINTThits(0);
0185 kfparticle->setMinTPChits(20);
0186
0187
0188 kfparticle->setMotherPT(0);
0189 kfparticle->setMinimumMass(0.40);
0190 kfparticle->setMaximumMass(0.60);
0191 kfparticle->setMaximumMotherVertexVolume(0.1);
0192
0193 kfparticle->setOutputName(pipi_output_reco_file);
0194
0195 se->registerSubsystem(kfparticle);
0196
0197 se->skip(nSkip);
0198 se->run(nEvents);
0199 se->End();
0200 se->PrintTimer();
0201
0202
0203 ifstream file(pipi_output_reco_file.c_str());
0204 if (file.good())
0205 {
0206 string moveOutput = "mv " + pipi_output_reco_file + " " + pipi_output_dir;
0207 system(moveOutput.c_str());
0208 }
0209
0210
0211 delete se;
0212
0213 std::cout << "Finished" << std::endl;
0214 gSystem->Exit(0);
0215 }
0216