File indexing completed on 2025-08-03 08:20:27
0001 #ifndef MACRO_TRKRCLUS_C
0002 #define MACRO_TRKRCLUS_C
0003
0004 #include <GlobalVariables.C>
0005
0006 #include <G4_ActsGeom.C>
0007 #include <G4_TrkrVariables.C>
0008
0009 #include <intt/InttCombinedRawDataDecoder.h>
0010 #include <intt/InttOdbcQuery.h>
0011 #include <micromegas/MicromegasCombinedDataDecoder.h>
0012 #include <mvtx/MvtxCombinedRawDataDecoder.h>
0013 #include <tpc/TpcCombinedRawDataUnpacker.h>
0014 #include <tpc/LaserEventIdentifier.h>
0015
0016 #include <intt/InttClusterizer.h>
0017 #include <mvtx/MvtxClusterizer.h>
0018 #include <mvtx/MvtxClusterPruner.h>
0019
0020 #pragma GCC diagnostic push
0021 #pragma GCC diagnostic ignored "-Wundefined-internal"
0022 #include <tpc/TpcClusterizer.h>
0023 #pragma GCC diagnostic pop
0024
0025 #include <tpc/TpcClusterCleaner.h>
0026
0027 #include <micromegas/MicromegasClusterizer.h>
0028
0029 #include <fun4all/Fun4AllServer.h>
0030 #include <phool/recoConsts.h>
0031
0032 R__LOAD_LIBRARY(libmvtx.so)
0033 R__LOAD_LIBRARY(libintt.so)
0034 R__LOAD_LIBRARY(libtpc.so)
0035 R__LOAD_LIBRARY(libmicromegas.so)
0036 R__LOAD_LIBRARY(libtrack_reco.so)
0037 R__LOAD_LIBRARY(libphool.so)
0038
0039 void ClusteringInit()
0040 {
0041 ACTSGEOM::ActsGeomInit();
0042 }
0043
0044 void Mvtx_HitUnpacking(const std::string& felix="")
0045 {
0046 int verbosity = std::max(Enable::VERBOSITY, Enable::MVTX_VERBOSITY);
0047 Fun4AllServer* se = Fun4AllServer::instance();
0048
0049 auto mvtxunpacker = new MvtxCombinedRawDataDecoder("MvtxCombinedRawDataDecoder"+felix);
0050 mvtxunpacker->Verbosity(verbosity);
0051 if(felix.length() > 0)
0052 {
0053 mvtxunpacker->useRawHitNodeName("MVTXRAWHIT_" + felix);
0054 mvtxunpacker->useRawEvtHeaderNodeName("MVTXRAWEVTHEADER_" + felix);
0055 }
0056 se->registerSubsystem(mvtxunpacker);
0057 }
0058
0059 void Mvtx_Clustering()
0060 {
0061 int verbosity = std::max(Enable::VERBOSITY, Enable::MVTX_VERBOSITY);
0062 auto se = Fun4AllServer::instance();
0063
0064
0065 auto mvtxclusterizer = new MvtxClusterizer;
0066 mvtxclusterizer->Verbosity(verbosity);
0067 se->registerSubsystem(mvtxclusterizer);
0068
0069
0070 auto mvtxClusterPruner = new MvtxClusterPruner;
0071 mvtxClusterPruner->set_use_strict_matching(true);
0072 se->registerSubsystem(mvtxClusterPruner);
0073 }
0074
0075 void Intt_HitUnpacking(const std::string& server="")
0076 {
0077 int verbosity = std::max(Enable::VERBOSITY, Enable::INTT_VERBOSITY);
0078 Fun4AllServer* se = Fun4AllServer::instance();
0079 auto rc = recoConsts::instance();
0080 int runnumber = rc->get_IntFlag("RUNNUMBER");
0081 InttOdbcQuery query;
0082 bool isStreaming = true;
0083 if(runnumber != 0)
0084 {
0085 query.Query(runnumber);
0086 isStreaming = query.IsStreaming();
0087 }
0088 auto inttunpacker = new InttCombinedRawDataDecoder("InttCombinedRawDataDecoder"+server);
0089 inttunpacker->Verbosity(verbosity);
0090
0091 inttunpacker->LoadBadChannelMap("INTT_HotMap");
0092 inttunpacker->set_triggeredMode(!isStreaming);
0093 if(server.length() > 0)
0094 {
0095 inttunpacker->useRawHitNodeName("INTTRAWHIT_" + server);
0096 }
0097 se->registerSubsystem(inttunpacker);
0098 }
0099 void Intt_Clustering()
0100 {
0101 int verbosity = std::max(Enable::VERBOSITY, Enable::INTT_VERBOSITY);
0102 Fun4AllServer* se = Fun4AllServer::instance();
0103
0104 InttClusterizer* inttclusterizer = new InttClusterizer("InttClusterizer", G4MVTX::n_maps_layer, G4MVTX::n_maps_layer + G4INTT::n_intt_layer - 1);
0105 inttclusterizer->Verbosity(verbosity);
0106
0107
0108
0109 for (int i = G4MVTX::n_maps_layer; i < G4MVTX::n_maps_layer + G4INTT::n_intt_layer; i++)
0110 {
0111 if (G4INTT::laddertype[i - G4MVTX::n_maps_layer] == PHG4InttDefs::SEGMENTATION_PHI)
0112 {
0113 inttclusterizer->set_z_clustering(i, false);
0114 }
0115 }
0116 se->registerSubsystem(inttclusterizer);
0117 }
0118
0119 void Tpc_HitUnpacking(const std::string& ebdc="")
0120 {
0121 int verbosity = std::max(Enable::VERBOSITY, Enable::TPC_VERBOSITY);
0122 Fun4AllServer* se = Fun4AllServer::instance();
0123 std::string name = "TpcCombinedRawDataUnpacker"+ebdc;
0124 auto tpcunpacker = new TpcCombinedRawDataUnpacker("TpcCombinedRawDataUnpacker"+ebdc);
0125 tpcunpacker->set_presampleShift(TRACKING::reco_tpc_time_presample);
0126 tpcunpacker->set_t0(TRACKING::reco_t0);
0127 if(ebdc.length() > 0)
0128 {
0129 tpcunpacker->useRawHitNodeName("TPCRAWHIT_" + ebdc);
0130 }
0131 if(TRACKING::tpc_zero_supp)
0132 {
0133 tpcunpacker->ReadZeroSuppressedData();
0134 }
0135 tpcunpacker->doBaselineCorr(TRACKING::tpc_baseline_corr);
0136 tpcunpacker->Verbosity(verbosity);
0137 se->registerSubsystem(tpcunpacker);
0138 }
0139
0140 void Tpc_LaserEventIdentifying()
0141 {
0142 int verbosity = std::max(Enable::VERBOSITY, Enable::TPC_VERBOSITY);
0143 Fun4AllServer* se = Fun4AllServer::instance();
0144
0145 auto laserEventIdentifier = new LaserEventIdentifier;
0146 if(G4TPC::laser_event_debug_filename != "")
0147 {
0148 laserEventIdentifier->set_debug(true);
0149 laserEventIdentifier->set_debug_name(G4TPC::laser_event_debug_filename);
0150 }
0151 laserEventIdentifier->set_max_time_samples(TRACKING::reco_tpc_maxtime_sample);
0152 se->registerSubsystem(laserEventIdentifier);
0153 }
0154
0155 void TPC_Clustering()
0156 {
0157 int verbosity = std::max(Enable::VERBOSITY, Enable::TPC_VERBOSITY);
0158 ACTSGEOM::ActsGeomInit();
0159 Fun4AllServer* se = Fun4AllServer::instance();
0160
0161
0162
0163
0164
0165
0166
0167
0168 auto tpcclusterizer = new TpcClusterizer;
0169 tpcclusterizer->Verbosity(verbosity);
0170 tpcclusterizer->set_do_hit_association(G4TPC::DO_HIT_ASSOCIATION);
0171 se->registerSubsystem(tpcclusterizer);
0172
0173 auto tpcclustercleaner = new TpcClusterCleaner;
0174 tpcclustercleaner->Verbosity(verbosity);
0175 se->registerSubsystem(tpcclustercleaner);
0176 }
0177
0178 void Micromegas_HitUnpacking()
0179 {
0180 int verbosity = std::max(Enable::VERBOSITY, Enable::MICROMEGAS_VERBOSITY);
0181 Fun4AllServer* se = Fun4AllServer::instance();
0182
0183 auto tpotunpacker = new MicromegasCombinedDataDecoder;
0184 std::string calibrationFile = CDBInterface::instance()->getUrl("TPOT_Pedestal");
0185 tpotunpacker->set_calibration_file(calibrationFile);
0186 tpotunpacker->set_sample_max(1024);
0187 se->registerSubsystem(tpotunpacker);
0188 }
0189
0190 void Micromegas_Clustering()
0191 {
0192 auto se = Fun4AllServer::instance();
0193 auto mm_clus = new MicromegasClusterizer;
0194 const auto calibrationFile = CDBInterface::instance()->getUrl("TPOT_Pedestal");
0195 mm_clus->set_calibration_file(calibrationFile);
0196 se->registerSubsystem(mm_clus);
0197 }
0198
0199 #endif