File indexing completed on 2026-08-30 08:24:56
0001
0002
0003
0004
0005
0006
0007
0008 #include <fun4all/Fun4AllUtils.h>
0009 #include <GlobalVariables.C>
0010 #include <G4_ActsGeom.C>
0011 #include <G4_Global.C>
0012 #include <G4_Magnet.C>
0013 #include <G4_Mbd.C>
0014 #include <Trkr_Clustering.C>
0015 #include <Trkr_LaserClustering.C>
0016 #include <Trkr_RecoInit.C>
0017 #include <Trkr_TpcReadoutInit.C>
0018
0019 #include <ffamodules/CDBInterface.h>
0020 #include <fun4all/Fun4AllDstInputManager.h>
0021 #include <fun4all/Fun4AllDstOutputManager.h>
0022 #include <fun4all/Fun4AllInputManager.h>
0023 #include <fun4all/Fun4AllOutputManager.h>
0024 #include <fun4all/Fun4AllRunNodeInputManager.h>
0025 #include <fun4all/Fun4AllServer.h>
0026
0027 #include <phool/recoConsts.h>
0028
0029
0030
0031 #include <tpccalib/TpcLaminationFitting.h>
0032
0033 #include <format>
0034 #include <fstream>
0035 #include <cstdio>
0036 R__LOAD_LIBRARY(libfun4all.so)
0037 R__LOAD_LIBRARY(libffamodules.so)
0038 R__LOAD_LIBRARY(libtpc.so)
0039 R__LOAD_LIBRARY(libtpccalib.so)
0040 void Fun4All_LaminationFitting(
0041 const int nEvents = 10,
0042 const std::string& filelist = "/sphenix/lustre01/sphnxpro/commissioning/slurp/tpcbeam/run_00041900_00042000/",
0043 const std::string& outdir = "/sphenig/tg/tg01/jets/bkimelman/",
0044 const std::string& prod = "ana441_2024p007",
0045 const std::string& type = "run2pp")
0046
0047 {
0048
0049 auto *se = Fun4AllServer::instance();
0050 se->Verbosity(2);
0051
0052
0053 TRACKING::tpc_zero_supp = true;
0054 G4TPC::ENABLE_CENTRAL_MEMBRANE_CLUSTERING = true;
0055 Enable::MVTX_APPLYMISALIGNMENT = true;
0056 ACTSGEOM::mvtx_applymisalignment = Enable::MVTX_APPLYMISALIGNMENT;
0057
0058 std::ifstream ifs(filelist);
0059 std::string filepath;
0060
0061 auto *rc = recoConsts::instance();
0062
0063 Enable::CDB = true;
0064 rc->set_StringFlag("CDB_GLOBALTAG", "newcdbtag");
0065
0066 int i=0;
0067 int runnumber = 0;
0068 int segment = 0;
0069 while(std::getline(ifs,filepath))
0070 {
0071 std::cout << "Adding DST with filepath: " << filepath << std::endl;
0072 if(i==0)
0073 {
0074 std::pair<int, int> runseg = Fun4AllUtils::GetRunSegment(filepath);
0075 runnumber = runseg.first;
0076 segment = runseg.second;
0077 rc->set_IntFlag("RUNNUMBER",runnumber);
0078 rc->set_uint64Flag("TIMESTAMP",runnumber);
0079 rc->set_IntFlag("RUNSEGMENT",segment);
0080 }
0081
0082
0083
0084
0085
0086
0087 i++;
0088 }
0089
0090 auto *hitsin = new Fun4AllDstInputManager("InputManager");
0091 hitsin->AddListFile(filelist);
0092 se->registerInputManager(hitsin);
0093
0094
0095 std::string geofile = CDBInterface::instance()->getUrl("Tracking_Geometry");
0096 Fun4AllRunNodeInputManager *ingeo = new Fun4AllRunNodeInputManager("GeoIn");
0097 ingeo->AddFile(geofile);
0098 se->registerInputManager(ingeo);
0099
0100
0101 G4TPC::ENABLE_MODULE_EDGE_CORRECTIONS = true;
0102
0103 G4TPC::ENABLE_STATIC_CORRECTIONS = true;
0104
0105 if(runnumber == 53098 || (runnumber >= 75103 && runnumber <= 75114) || (runnumber >= 75555 && runnumber <= 75574))
0106 {
0107 G4TPC::ENABLE_STATIC_CORRECTIONS = false;
0108 }
0109
0110 G4TPC::USE_PHI_AS_RAD_STATIC_CORRECTIONS=false;
0111
0112
0113 G4TPC::ENABLE_AVERAGE_CORRECTIONS = false;
0114
0115
0116
0117
0118
0119
0120
0121
0122 G4TPC::laser_adc_threshold = 100;
0123
0124
0125 if(type.find("pp") != std::string::npos) TRACKING::streaming_mode = true;
0126 else TRACKING::streaming_mode = false;
0127
0128
0129
0130 TrackingInit();
0131
0132 G4TPC::LaminationOutputName =
0133 std::format("{}/Laminations_{}_{}-{:08d}.root",
0134 outdir, type, prod, runnumber);
0135
0136 G4TPC::LaminationQAName =
0137 std::format("{}/LaminationQA_{}_{}-{:08d}.pdf",
0138 outdir, type, prod, runnumber);
0139
0140 TPC_LaminationFitting();
0141
0142 se->run(nEvents);
0143
0144 se->End();
0145 se->PrintTimer();
0146
0147 delete se;
0148 std::cout << "Finished" << std::endl;
0149 gSystem->Exit(0);
0150 }