File indexing completed on 2026-08-31 08:14:15
0001 #include <fun4all/Fun4AllUtils.h>
0002 #include <fun4all/Fun4AllServer.h>
0003 #include <GlobalVariables.C>
0004 #include <G4_ActsGeom.C>
0005 #include <G4_Global.C>
0006 #include <G4_Magnet.C>
0007 #include <G4_Mbd.C>
0008 #include <Trkr_Clustering.C>
0009 #include <Trkr_LaserClustering.C>
0010 #include <Trkr_RecoInit.C>
0011 #include <Trkr_TpcReadoutInit.C>
0012
0013 #include <ffamodules/CDBInterface.h>
0014 #include <fun4all/Fun4AllDstInputManager.h>
0015 #include <fun4all/Fun4AllRunNodeInputManager.h>
0016 #include <fun4all/Fun4AllServer.h>
0017
0018 #include <phool/recoConsts.h>
0019
0020 #include <centralmembranestripematching/TpcCentralMembraneStripeMatching.h>
0021
0022 #include <fstream>
0023 #include <iostream>
0024 #include <string>
0025
0026 #include <TString.h>
0027 #include <TSystem.h>
0028
0029 R__LOAD_LIBRARY(libfun4all.so)
0030 R__LOAD_LIBRARY(libffamodules.so)
0031 R__LOAD_LIBRARY(libtpc.so)
0032 R__LOAD_LIBRARY(libcentralmembranestripematching.so)
0033
0034 void Fun4All_CentralMembraneStripeMatching(
0035 const int nEvents = -1,
0036 const std::string filelist = "stripelists_measured/run79516.list",
0037 const std::string outdir = "output/",
0038 const std::string referenceStripeFile = "referencestripes/run83319.root")
0039 {
0040 auto se = Fun4AllServer::instance();
0041 se->Verbosity(0);
0042
0043 TRACKING::tpc_zero_supp = true;
0044 G4TPC::ENABLE_CENTRAL_MEMBRANE_CLUSTERING = true;
0045 Enable::MVTX_APPLYMISALIGNMENT = true;
0046 ACTSGEOM::mvtx_applymisalignment = Enable::MVTX_APPLYMISALIGNMENT;
0047
0048 auto rc = recoConsts::instance();
0049 Enable::CDB = true;
0050 rc->set_StringFlag("CDB_GLOBALTAG", "newcdbtag");
0051
0052 std::ifstream inputList(filelist);
0053 std::string firstInputFile;
0054 std::getline(inputList, firstInputFile);
0055 if (firstInputFile.empty())
0056 {
0057 std::cout << "Fun4All_CentralMembraneStripeMatching - empty input file list: " << filelist << std::endl;
0058 gSystem->Exit(1);
0059 }
0060
0061 const auto runSegment = Fun4AllUtils::GetRunSegment(firstInputFile);
0062 const int runnumber = runSegment.first;
0063 rc->set_IntFlag("RUNNUMBER", runnumber);
0064 rc->set_uint64Flag("TIMESTAMP", runnumber);
0065
0066 auto hitsin = new Fun4AllDstInputManager("InputManager");
0067 hitsin->AddListFile(filelist);
0068 se->registerInputManager(hitsin);
0069
0070 const std::string geofile = CDBInterface::instance()->getUrl("Tracking_Geometry");
0071 auto ingeo = new Fun4AllRunNodeInputManager("GeoIn");
0072 ingeo->AddFile(geofile);
0073 se->registerInputManager(ingeo);
0074
0075 const std::string staticCorrectionFile = "/sphenix/user/dloomis/Distortions/DistortionMaps_Static/static_only_inverted_10-new_hugoupdate.root";
0076
0077 G4TPC::ENABLE_MODULE_EDGE_CORRECTIONS = true;
0078 G4TPC::ENABLE_STATIC_CORRECTIONS = true;
0079 G4TPC::static_correction_filename = staticCorrectionFile;
0080 G4TPC::USE_PHI_AS_RAD_STATIC_CORRECTIONS = false;
0081 G4TPC::ENABLE_AVERAGE_CORRECTIONS = false;
0082 G4TPC::laser_adc_threshold = 100;
0083
0084 TrackingInit();
0085 ACTSGEOM::ActsGeomInit();
0086
0087 auto matcher = new TpcCentralMembraneStripeMatching;
0088 matcher->setReferenceStripeFile(referenceStripeFile);
0089 matcher->setStaticCorrectionFile(staticCorrectionFile);
0090 matcher->setOutputfile(Form("%s/CMDistortionCorrections-%08d_reference83319.root", outdir.c_str(), runnumber));
0091 se->registerSubsystem(matcher);
0092
0093 se->run(nEvents);
0094 se->End();
0095 se->PrintTimer();
0096
0097 delete se;
0098 std::cout << "Finished" << std::endl;
0099 gSystem->Exit(0);
0100 }