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 <TFile.h>
0027 #include <TH2.h>
0028 #include <TString.h>
0029 #include <TSystem.h>
0030
0031 R__LOAD_LIBRARY(libfun4all.so)
0032 R__LOAD_LIBRARY(libffamodules.so)
0033 R__LOAD_LIBRARY(libtpc.so)
0034 R__LOAD_LIBRARY(libcentralmembranestripematching.so)
0035
0036 void Fun4All_CentralMembraneReferenceHistograms(
0037 const int nEvents = -1,
0038 const std::string filelist = "stripelists_reference/run75073.list",
0039 const std::string outputfile = "referencestripes/run75073.root")
0040 {
0041 auto se = Fun4AllServer::instance();
0042 se->Verbosity(0);
0043
0044 TRACKING::tpc_zero_supp = true;
0045 G4TPC::ENABLE_CENTRAL_MEMBRANE_CLUSTERING = true;
0046 Enable::MVTX_APPLYMISALIGNMENT = true;
0047 ACTSGEOM::mvtx_applymisalignment = Enable::MVTX_APPLYMISALIGNMENT;
0048
0049 auto rc = recoConsts::instance();
0050 Enable::CDB = true;
0051 rc->set_StringFlag("CDB_GLOBALTAG", "newcdbtag");
0052
0053 std::ifstream inputList(filelist);
0054 std::string firstInputFile;
0055 std::getline(inputList, firstInputFile);
0056 if (firstInputFile.empty())
0057 {
0058 std::cout << "Fun4All_CentralMembraneReferenceHistograms - empty input file list: " << filelist << std::endl;
0059 gSystem->Exit(1);
0060 }
0061
0062 const auto runSegment = Fun4AllUtils::GetRunSegment(firstInputFile);
0063 const int runnumber = runSegment.first;
0064 rc->set_IntFlag("RUNNUMBER", runnumber);
0065 rc->set_uint64Flag("TIMESTAMP", runnumber);
0066
0067 auto hitsin = new Fun4AllDstInputManager("InputManager");
0068 hitsin->AddListFile(filelist);
0069 se->registerInputManager(hitsin);
0070
0071 const std::string geofile = CDBInterface::instance()->getUrl("Tracking_Geometry");
0072 auto ingeo = new Fun4AllRunNodeInputManager("GeoIn");
0073 ingeo->AddFile(geofile);
0074 se->registerInputManager(ingeo);
0075
0076 G4TPC::ENABLE_MODULE_EDGE_CORRECTIONS = true;
0077 G4TPC::ENABLE_STATIC_CORRECTIONS = false;
0078 G4TPC::static_correction_filename = "/sphenix/user/dloomis/Distortions/DistortionMaps_Static/static_only_inverted_10-new_hugoupdate.root";
0079 G4TPC::USE_PHI_AS_RAD_STATIC_CORRECTIONS = false;
0080 G4TPC::ENABLE_AVERAGE_CORRECTIONS = false;
0081 G4TPC::laser_adc_threshold = 100;
0082
0083 TrackingInit();
0084 ACTSGEOM::ActsGeomInit();
0085
0086 auto matcher = new TpcCentralMembraneStripeMatching("TpcCentralMembraneReferenceHistograms");
0087 matcher->setFillReferenceHistogramsOnly();
0088 se->registerSubsystem(matcher);
0089
0090 se->run(nEvents);
0091 se->End();
0092
0093 auto *hSouth = matcher->cloneReferenceHistogram(0, "hPetal_South");
0094 auto *hNorth = matcher->cloneReferenceHistogram(1, "hPetal_North");
0095 if (!hSouth || !hNorth)
0096 {
0097 std::cout << "Fun4All_CentralMembraneReferenceHistograms - failed to generate reference histograms" << std::endl;
0098 gSystem->Exit(1);
0099 }
0100
0101 TFile *outfile = new TFile(outputfile.c_str(), "RECREATE");
0102 outfile->cd();
0103 hSouth->Write("", TObject::kOverwrite);
0104 hNorth->Write("", TObject::kOverwrite);
0105 outfile->Close();
0106
0107 se->PrintTimer();
0108
0109 delete hSouth;
0110 delete hNorth;
0111 delete se;
0112 std::cout << "Finished reference histogram file: " << outputfile << std::endl;
0113 gSystem->Exit(0);
0114 }