Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:20:29

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