Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:24:08

0001 /*
0002  * This macro shows a minimum working example of running the tracking
0003  * hit unpackers with some basic seeding algorithms to try to put together
0004  * tracks. There are some analysis modules run at the end which package
0005  * hits, clusters, and clusters on tracks into trees for analysis.
0006  */
0007 
0008 // leave the GlobalVariables.C at the beginning, an empty line afterwards
0009 // protects its position against reshuffling by clang-format
0010 #include <GlobalVariables.C>
0011 
0012 #include <G4_ActsGeom.C>
0013 #include <G4_Magnet.C>
0014 #include <Trkr_Clustering.C>
0015 #include <Trkr_RecoInit.C>
0016 #include <Trkr_Reco.C>
0017 
0018 #include <trackreco/AzimuthalSeeder.h>
0019 #include <trackingdiagnostics/TrackResiduals.h>
0020 
0021 #include <ffamodules/CDBInterface.h>
0022 #include <fun4all/Fun4AllDstInputManager.h>
0023 #include <fun4all/Fun4AllDstOutputManager.h>
0024 #include <fun4all/Fun4AllInputManager.h>
0025 #include <fun4all/Fun4AllUtils.h>
0026 #include <fun4all/Fun4AllOutputManager.h>
0027 #include <fun4all/Fun4AllRunNodeInputManager.h>
0028 #include <fun4all/Fun4AllServer.h>
0029 
0030 
0031 #include <phool/recoConsts.h>
0032 
0033 R__LOAD_LIBRARY(libfun4all.so)
0034 R__LOAD_LIBRARY(libffamodules.so)
0035 R__LOAD_LIBRARY(libmvtx.so)
0036 R__LOAD_LIBRARY(libintt.so)
0037 R__LOAD_LIBRARY(libtpc.so)
0038 R__LOAD_LIBRARY(libmicromegas.so)
0039 R__LOAD_LIBRARY(libTrackingDiagnostics.so)
0040 void Fun4All_MvtxVertex(
0041     const int nEvents = 0,
0042     const std::string& filename = "DST_INTT_RAW_beam_new_2023p011-00041620-0000.root",
0043     const std::string& dir = "/sphenix/lustre01/sphnxpro/commissioning/slurp/inttbeam/run_00041600_00041700/",
0044     const std::string& outfilename = "clusters_seeds_40630.root")
0045 {
0046   std::string inputRawHitFile = dir + filename;
0047 
0048   std::pair<int, int> runseg = Fun4AllUtils::GetRunSegment(filename);
0049   int runnumber = runseg.first;
0050   // int segment = runseg.second;
0051 
0052   auto *se = Fun4AllServer::instance();
0053   se->Verbosity(1);
0054   auto *rc = recoConsts::instance();
0055   rc->set_IntFlag("RUNNUMBER", runnumber);
0056 
0057   Enable::CDB = true;
0058   rc->set_StringFlag("CDB_GLOBALTAG", "ProdA_2023");
0059   rc->set_uint64Flag("TIMESTAMP", 6);
0060   std::string geofile = CDBInterface::instance()->getUrl("Tracking_Geometry");
0061 
0062   Fun4AllRunNodeInputManager *ingeo = new Fun4AllRunNodeInputManager("GeoIn");
0063   ingeo->AddFile(geofile);
0064   se->registerInputManager(ingeo);
0065 
0066   G4TPC::tpc_drift_velocity_reco = (8.0 / 1000) * 107.0 / 105.0;
0067   G4MAGNET::magfield = "0.01";
0068   G4MAGNET::magfield_tracking = G4MAGNET::magfield;
0069   G4MAGNET::magfield_rescale = 1;
0070   TrackingInit();
0071 
0072   auto *hitsin = new Fun4AllDstInputManager("InputManager");
0073   hitsin->fileopen(inputRawHitFile);
0074   se->registerInputManager(hitsin);
0075 
0076 
0077   Mvtx_HitUnpacking();
0078 
0079   Mvtx_Clustering();
0080 
0081   AzimuthalSeeder *seeder = new AzimuthalSeeder;
0082   se->registerSubsystem(seeder);
0083 
0084   auto *converter = new TrackSeedTrackMapConverter;
0085   converter->setTrackSeedName("SiliconTrackSeedContainer");
0086   converter->setFieldMap(G4MAGNET::magfield_tracking);
0087   converter->Verbosity(0);
0088   converter->constField();
0089   se->registerSubsystem(converter);
0090 
0091   PHSimpleVertexFinder *finder = new PHSimpleVertexFinder;
0092   finder->Verbosity(0);
0093   finder->setDcaCut(0.5);
0094   finder->setTrackPtCut(-99999.);
0095   finder->setBeamLineCut(1);
0096   finder->setTrackQualityCut(1000000000);
0097   finder->setNmvtxRequired(3);
0098   finder->setOutlierPairCut(0.1);
0099   se->registerSubsystem(finder);
0100 
0101   TString residoutfile = outfilename + filename + "_resid.root";
0102   std::string residstring(residoutfile.Data());
0103 
0104   auto *resid = new TrackResiduals("TrackResiduals");
0105   resid->outfileName(residstring);
0106   resid->alignment(false);
0107   resid->clusterTree();
0108   resid->hitTree();
0109   resid->zeroField();
0110   se->registerSubsystem(resid);
0111 
0112 
0113   se->run(nEvents);
0114   se->End();
0115   se->PrintTimer();
0116 
0117   delete se;
0118   std::cout << "Finished" << std::endl;
0119   gSystem->Exit(0);
0120 }