File indexing completed on 2026-07-16 08:12:44
0001 #ifndef MACRO_FUN4ALLG4SPHENIX_C
0002 #define MACRO_FUN4ALLG4SPHENIX_C
0003
0004 #include <GlobalVariables.C>
0005 #include <G4_Input.C> // global variable "Input"
0006 #include <G4_TrkrVariables.C> // global variable "Input"
0007 #include <G4_ActsGeom.C> // global variable "ACTSGEOM"
0008 #include <G4_Global.C>
0009 #include <Trkr_Reco.C>
0010
0011 #include <ffamodules/FlagHandler.h>
0012 #include <ffamodules/HeadReco.h>
0013 #include <ffamodules/SyncReco.h>
0014 #include <ffamodules/CDBInterface.h>
0015
0016 #include <fun4all/Fun4AllServer.h>
0017 #include <fun4all/Fun4AllDstInputManager.h>
0018 #include <fun4all/Fun4AllRunNodeInputManager.h>
0019 #include <fun4all/Fun4AllDstOutputManager.h>
0020 #include <fun4all/Fun4AllOutputManager.h>
0021 #include <fun4all/Fun4AllUtils.h>
0022
0023 #include <siliconseedsana/SiliconCaloMatching.h>
0024 #include <siliconseedsana/SiliconSeedsAna.h>
0025 #include <siliconseedsana/ChargeRecalc.h>
0026
0027 #include <calotrigger/TriggerRunInfoReco.h>
0028 #include <mbd/MbdReco.h>
0029 #include <caloreco/RawClusterBuilderTopo.h>
0030
0031 #include <phool/recoConsts.h>
0032
0033 #include <sys/stat.h>
0034 #include <limits.h> // PATH_MAX
0035 #include <unistd.h>
0036
0037 #include "Calo_Calib.C"
0038
0039 #pragma GCC diagnostic push
0040
0041 #pragma GCC diagnostic ignored "-Wundefined-internal"
0042
0043 #pragma GCC diagnostic pop
0044
0045
0046 R__LOAD_LIBRARY(libphool.so)
0047 R__LOAD_LIBRARY(libfun4all.so)
0048 R__LOAD_LIBRARY(libfun4allraw.so)
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061 R__LOAD_LIBRARY(libcalotrigger.so)
0062
0063 R__LOAD_LIBRARY(libmbd.so)
0064 R__LOAD_LIBRARY(libepd.so)
0065 R__LOAD_LIBRARY(libzdcinfo.so)
0066
0067 R__LOAD_LIBRARY(libsiliconseedsana.so)
0068
0069 bool useTopologicalCluster = false;
0070
0071 int Fun4All_DataDST_SiliconSeedAna_run3pp(
0072 const int nEvents = 1000
0073 , const string inlst_dst_strk = "list/test/run53879_seed_0.list"
0074 , const string inlst_dst_calo = "list/test/run53879_calo_0.list"
0075 , const string out_root = "/sphenix/tg/tg01/commissioning/INTT/work/mahiro/SIliconCalo/run24pp/ana/newgeo/calocalib/recalc_charge/ana_53879_1000evt.root"
0076 , const int startnumber = 0)
0077 {
0078
0079 std::cout << "inlst_dst_trk : " << inlst_dst_strk << endl;
0080 std::cout << "inlst_dst_calo : " << inlst_dst_calo << endl;
0081
0082
0083 std::cout << "Nevent : " << nEvents << std::endl;
0084 std::cout << "#start : " << startnumber << std::endl;
0085
0086
0087
0088
0089 std::ifstream fin(inlst_dst_strk.c_str());
0090 std::string filename;
0091 fin>>filename;
0092 std::cout<<"Filename : "<<filename<<std::endl;
0093 fin.close();
0094
0095 std::pair<int, int> runseg = Fun4AllUtils::GetRunSegment(filename);
0096 int runnumber = runseg.first;
0097 int segment = runseg.second;
0098
0099
0100
0101
0102 G4TRACKING::SC_CALIBMODE = false;
0103
0104
0105
0106
0107 TRACKING::pp_mode = true;
0108
0109 Fun4AllServer *se = Fun4AllServer::instance();
0110
0111
0112 recoConsts *rc = recoConsts::instance();
0113 Input::VERBOSITY = 0;
0114
0115
0116 std::cout<<"Run : "<<runnumber<<std::endl;
0117
0118 Enable::CDB = true;
0119 rc->set_StringFlag("CDB_GLOBALTAG", "newcdbtag");
0120 rc->set_uint64Flag("TIMESTAMP", runnumber);
0121
0122 std::string geofile = CDBInterface::instance()->getUrl("Tracking_Geometry");
0123 Fun4AllRunNodeInputManager *ingeo = new Fun4AllRunNodeInputManager("GeoIn");
0124 ingeo->AddFile(geofile);
0125 se->registerInputManager(ingeo);
0126
0127
0128 ACTSGEOM::ActsGeomInit();
0129
0130
0131 Fun4AllInputManager *in_calo = new Fun4AllDstInputManager("DSTCalo");
0132 in_calo->AddListFile(inlst_dst_calo.c_str());
0133
0134 se->registerInputManager(in_calo);
0135
0136
0137
0138
0139
0140
0141 Fun4AllInputManager *in_strk = new Fun4AllDstInputManager("DSTTrkrTrack");
0142 in_strk->AddListFile(inlst_dst_strk.c_str());
0143
0144 se->registerInputManager(in_strk);
0145
0146
0147 TriggerRunInfoReco *triggerruninforeco = new TriggerRunInfoReco();
0148 se->registerSubsystem(triggerruninforeco);
0149
0150
0151 MbdReco *mbdreco = new MbdReco();
0152 se->registerSubsystem(mbdreco);
0153
0154
0155
0156
0157 Process_Calo_Calib();
0158
0159
0160
0161
0162 RawClusterBuilderTopo* ClusterBuilder2 = new RawClusterBuilderTopo("SiHCalRawClusterBuilderTopo");
0163
0164 ClusterBuilder2->set_nodename("TOPOCLUSTER_ALLCALO");
0165 ClusterBuilder2->set_enable_HCal(true);
0166 ClusterBuilder2->set_enable_EMCal(true);
0167
0168
0169 ClusterBuilder2->set_noise(0.002, 0.01, 0.03);
0170
0171
0172 ClusterBuilder2->set_significance(4.0, 2.0, 1.0);
0173 ClusterBuilder2->allow_corner_neighbor(true);
0174 ClusterBuilder2->set_do_split(true);
0175 ClusterBuilder2->set_minE_local_max(1.0, 2.0, 0.5);
0176 ClusterBuilder2->set_R_shower(0.025);
0177
0178 se->registerSubsystem(ClusterBuilder2);
0179
0180
0181
0182
0183 auto converter = new TrackSeedTrackMapConverter;
0184
0185 converter->setTrackSeedName("SiliconTrackSeedContainer");
0186 converter->setClusterMapName("TRKR_CLUSTER_SEED");
0187 converter->setFieldMap(G4MAGNET::magfield_tracking);
0188
0189 se->registerSubsystem(converter);
0190
0191 PHSimpleVertexFinder *finder = new PHSimpleVertexFinder;
0192 finder->Verbosity(0);
0193 finder->setTrkrClusterContainerName("TRKR_CLUSTER_SEED");
0194 finder->setDcaCut(0.1);
0195 finder->setTrackPtCut(0.);
0196 finder->setBeamLineCut(1);
0197 finder->setTrackQualityCut(20);
0198 finder->setNmvtxRequired(3);
0199 finder->setOutlierPairCut(0.1);
0200 se->registerSubsystem(finder);
0201
0202 Global_Reco();
0203
0204
0205 auto chrecalc = new ChargeRecalc("ChargeRecalc");
0206 chrecalc->setVerbosity(0);
0207 chrecalc->setClusterContainerName("TRKR_CLUSTER_SEED");
0208 se->registerSubsystem(chrecalc);
0209
0210
0211 auto projection = new PHActsTrackProjection("CaloProjection");
0212
0213
0214 se->registerSubsystem(projection);
0215
0216
0217
0218
0219 SiliconCaloMatching* sicalomatch = new SiliconCaloMatching();
0220
0221 sicalomatch->setClusterContainerName("TRKR_CLUSTER_SEED");
0222 sicalomatch->setEMCalClusterContainerName("CLUSTERINFO_CEMC");
0223 sicalomatch->setEmcalLowEcut(0.2);
0224 sicalomatch->setTrackLowpTcut(0.2);
0225 se->registerSubsystem(sicalomatch);
0226
0227 auto siana = new SiliconSeedsAna("SiliconSeedsAna");
0228
0229 siana->setVtxSkip(true);
0230 siana->setClusterContainerName("TRKR_CLUSTER_SEED");
0231 siana->setEMCalClusterContainerName("CLUSTERINFO_CEMC");
0232 siana->setTopoCluster(useTopologicalCluster);
0233
0234 siana->setOutputFileName(out_root.c_str());
0235
0236 siana->setStartEventNumber(startnumber);
0237
0238 se->registerSubsystem(siana);
0239
0240 se->run(nEvents);
0241
0242
0243
0244
0245
0246
0247 se->End();
0248 std::cout << "All done" << std::endl;
0249 delete se;
0250
0251 gSystem->Exit(0);
0252 return 0;
0253 }
0254 #endif