Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:18:01

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 
0009 #include <Trkr_Reco.C>
0010 
0011 
0012 
0013 #include <ffamodules/FlagHandler.h>
0014 #include <ffamodules/HeadReco.h>
0015 #include <ffamodules/SyncReco.h>
0016 #include <ffamodules/CDBInterface.h>
0017 
0018 #include <fun4all/Fun4AllServer.h>
0019 #include <fun4all/Fun4AllDstInputManager.h>
0020 #include <fun4all/Fun4AllRunNodeInputManager.h>
0021 #include <fun4all/Fun4AllDstOutputManager.h>
0022 #include <fun4all/Fun4AllOutputManager.h>
0023 
0024 #include <phool/recoConsts.h>
0025 
0026 
0027 #include <sys/stat.h>
0028 #include <limits.h>     // PATH_MAX
0029 #include <unistd.h>
0030 
0031 
0032 #include <siliconseedsana/SiliconSeedsAna.h>
0033 
0034 #pragma GCC diagnostic push
0035 
0036 #pragma GCC diagnostic ignored "-Wundefined-internal"
0037 
0038 #pragma GCC diagnostic pop
0039 
0040 //--R__LOAD_LIBRARY(libkfparticle_sphenix.so)
0041 R__LOAD_LIBRARY(libphool.so)
0042 R__LOAD_LIBRARY(libfun4all.so)
0043 R__LOAD_LIBRARY(libfun4allraw.so)
0044 //--R__LOAD_LIBRARY(libffamodules.so)
0045 //--R__LOAD_LIBRARY(libcdbobjects.so)
0046 //--R__LOAD_LIBRARY(libmvtx.so)
0047 //--R__LOAD_LIBRARY(libintt.so)
0048 //--R__LOAD_LIBRARY(libtpc.so)
0049 //--R__LOAD_LIBRARY(libmicromegas.so)
0050 //R__LOAD_LIBRARY(libTrackingDiagnostics.so)
0051 //R__LOAD_LIBRARY(libtrackingqa.so)
0052 //R__LOAD_LIBRARY(libtpcqa.so)
0053 //R__LOAD_LIBRARY(libtrack_to_calo.so)
0054 //--R__LOAD_LIBRARY(libtrack_reco.so)
0055 //--R__LOAD_LIBRARY(libcalo_reco.so)
0056 R__LOAD_LIBRARY(libcalotrigger.so)
0057 //R__LOAD_LIBRARY(libcentrality.so)
0058 R__LOAD_LIBRARY(libmbd.so)
0059 R__LOAD_LIBRARY(libepd.so)
0060 R__LOAD_LIBRARY(libzdcinfo.so)
0061 
0062 R__LOAD_LIBRARY(libsiliconseedsana.so)
0063 
0064 
0065 bool useTopologicalCluster = false;
0066 
0067 int Fun4All_DataDST_SiliconSeedAna(
0068     const int nEvents = 2000
0069   , const string inlst_dst_clus = "run53879_clus_0.list"
0070 //  , const string inlst_dst_strk = "run53879_strk_0.list"
0071   , const string inlst_dst_strk = "run53879_seed_0.list"
0072   , const string inlst_dst_calo = "run53879_calo_0.list"
0073   , const string out_root = "test_ana.root"
0074   , const int startnumber = 0
0075 )
0076 {
0077 
0078   std::cout << "inlst_dst_clus : "<<inlst_dst_clus<<endl;
0079   std::cout << "inlst_dst_trk  : "<<inlst_dst_strk<<endl;
0080   std::cout << "inlst_dst_calo : "<<inlst_dst_calo<<endl;
0081   //std::cout << "std::cout << "Input DST: " << in_dst      <<std::endl;
0082   //std::cout << "out  ROOT: " << out_root    <<std::endl;
0083   std::cout << "Nevent   : " << nEvents     <<std::endl;
0084   std::cout << "#start   : " << startnumber <<std::endl;
0085 
0086   //gSystem->ListLibraries();
0087 
0088   G4TRACKING::SC_CALIBMODE = false;
0089   Enable::MVTX_APPLYMISALIGNMENT = true;
0090   ACTSGEOM::mvtx_applymisalignment = Enable::MVTX_APPLYMISALIGNMENT;
0091   TRACKING::pp_mode = true;
0092 
0093 
0094   Fun4AllServer *se = Fun4AllServer::instance();
0095   //se->Verbosity(10);
0096 
0097 
0098   recoConsts *rc = recoConsts::instance();
0099   Input::VERBOSITY = 0;
0100 
0101   int runnum = 53879;
0102   // Tracking setup
0103   Enable::CDB = true;
0104   //rc->set_StringFlag("CDB_GLOBALTAG", "Prod_2024A");
0105   rc->set_StringFlag("CDB_GLOBALTAG", "newcdbtag");
0106   rc->set_uint64Flag("TIMESTAMP", runnum);
0107 
0108   std::string geofile = CDBInterface::instance()->getUrl("Tracking_Geometry");
0109   Fun4AllRunNodeInputManager *ingeo = new Fun4AllRunNodeInputManager("GeoIn");
0110   ingeo->AddFile(geofile);
0111   se->registerInputManager(ingeo);
0112 
0113 
0114   // this assume Geometory data is in the DST
0115   ACTSGEOM::ActsGeomInit();
0116 
0117 
0118   //--input
0119   Fun4AllInputManager *in_calo = new Fun4AllDstInputManager("DSTCalo");
0120   in_calo->AddListFile(inlst_dst_calo.c_str());
0121   //in->Verbosity(2);
0122   se->registerInputManager(in_calo);
0123 
0124   Fun4AllInputManager *in_clus = new Fun4AllDstInputManager("DSTTrkrClus");
0125   in_clus->AddListFile(inlst_dst_clus.c_str());
0126   //in->Verbosity(2);
0127   se->registerInputManager(in_clus);
0128 
0129   Fun4AllInputManager *in_strk = new Fun4AllDstInputManager("DSTTrkrTrack");
0130   in_strk->AddListFile(inlst_dst_strk.c_str());
0131   //in->Verbosity(2);
0132   se->registerInputManager(in_strk);
0133 
0134 
0135   auto converter = new TrackSeedTrackMapConverter;
0136   //SiliconTrackSeedContainer or TpcTrackSeedContainer
0137   converter->setTrackSeedName("SiliconTrackSeedContainer");
0138   converter->setFieldMap(G4MAGNET::magfield_tracking);
0139   //converter->Verbosity(10);
0140   se->registerSubsystem(converter);
0141 
0142   PHSimpleVertexFinder *finder = new PHSimpleVertexFinder;
0143   finder->Verbosity(0);
0144   finder->setDcaCut(0.1);
0145   finder->setTrackPtCut(0.);
0146   finder->setBeamLineCut(1);
0147   finder->setTrackQualityCut(20);
0148   finder->setNmvtxRequired(3);
0149   finder->setOutlierPairCut(0.1);
0150   se->registerSubsystem(finder);
0151 
0152 
0153   auto projection = new PHActsTrackProjection("CaloProjection");
0154   se->registerSubsystem(projection);
0155   
0156   
0157 
0158   auto siana = new SiliconSeedsAna("SiliconSeedsAna");
0159   //siana->setMC(true);
0160   siana->setVtxSkip(true);
0161   siana->setEMCalClusterContainerName("CLUSTERINFO_CEMC");
0162   siana->setTopoCluster(useTopologicalCluster);
0163   siana->setOutputFileName(out_root.c_str());
0164 
0165   siana->setStartEventNumber(startnumber);
0166 
0167   se->registerSubsystem(siana);
0168 
0169   se->run(nEvents);
0170 
0171 
0172   //-----
0173   // Exit
0174   //-----
0175 
0176   //  CDBInterface::instance()->Print(); // print used DB files
0177   se->End();
0178   std::cout << "All done" << std::endl;
0179   delete se;
0180 
0181   gSystem->Exit(0);
0182   return 0;
0183 }
0184 #endif