Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Fun4All_TrkrClusteringSeeding.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Fun4All_TrkrClusteringSeeding.C
1 /*
2  * This macro shows a minimum working example of running the tracking
3  * hit unpackers with some basic seeding algorithms to try to put together
4  * tracks. There are some analysis modules run at the end which package
5  * hits, clusters, and clusters on tracks into trees for analysis.
6  */
7 
8 #include <G4_ActsGeom.C>
9 #include <G4_Magnet.C>
10 #include <GlobalVariables.C>
11 #include <Trkr_Clustering.C>
12 #include <Trkr_Reco_Cosmics.C>
13 
20 #include <fun4all/Fun4AllServer.h>
21 
22 #include <phool/recoConsts.h>
23 
28 
29 #include <trackingdiagnostics/TrackResiduals.h>
30 #include <trackingdiagnostics/TrkrNtuplizer.h>
31 
32 #include <stdio.h>
33 
34 R__LOAD_LIBRARY(libfun4all.so)
35 R__LOAD_LIBRARY(libffamodules.so)
36 R__LOAD_LIBRARY(libmvtx.so)
37 R__LOAD_LIBRARY(libintt.so)
38 R__LOAD_LIBRARY(libtpc.so)
39 R__LOAD_LIBRARY(libmicromegas.so)
40 R__LOAD_LIBRARY(libTrackingDiagnostics.so)
42  const int nEvents = 2,
43  const std::string filename = "cosmics-00025926-0005.root",
44  const std::string outfilename = "cosmics",
45  const std::string dir = "/sphenix/lustre01/sphnxpro/commissioning/aligned_streaming_all_3/")
46 {
47  std::string inputRawHitFile = dir + filename;
48  auto pos = filename.find("0002");
49  std::string runnumber_str = filename.substr(pos, pos + 8);
50  int runnumber = std::stoi(runnumber_str);
51 
52  auto se = Fun4AllServer::instance();
53  se->Verbosity(1);
54  auto rc = recoConsts::instance();
55  rc->set_IntFlag("RUNNUMBER", runnumber);
56 
57  Enable::CDB = true;
58  rc->set_StringFlag("CDB_GLOBALTAG", "ProdA_2023");
59  rc->set_uint64Flag("TIMESTAMP", 6);
60  std::string geofile = CDBInterface::instance()->getUrl("Tracking_Geometry");
61 
63  ingeo->AddFile(geofile);
64  se->registerInputManager(ingeo);
65 
66  G4MAGNET::magfield = "0.01";
69 
70  auto hitsin = new Fun4AllDstInputManager("InputManager");
71  hitsin->fileopen(inputRawHitFile);
72  se->registerInputManager(hitsin);
73 
74  auto mvtxunpacker = new MvtxCombinedRawDataDecoder;
75  se->registerSubsystem(mvtxunpacker);
76 
77  auto inttunpacker = new InttCombinedRawDataDecoder;
78  inttunpacker->LoadHotChannelMapRemote("INTT_HotMap");
79  se->registerSubsystem(inttunpacker);
80 
81  auto tpcunpacker = new TpcCombinedRawDataUnpacker;
82  se->registerSubsystem(tpcunpacker);
83 
84  auto tpotunpacker = new MicromegasCombinedDataDecoder;
85 
86  std::string calibrationFile = CDBInterface::instance()->getUrl("TPOT_Pedestal");
87  tpotunpacker->set_calibration_file(calibrationFile);
88  se->registerSubsystem(tpotunpacker);
89 
92 
93  auto tpcclusterizer = new TpcClusterizer;
94  tpcclusterizer->Verbosity(0);
95  tpcclusterizer->set_do_hit_association(G4TPC::DO_HIT_ASSOCIATION);
96  tpcclusterizer->set_rawdata_reco();
97  se->registerSubsystem(tpcclusterizer);
98 
100 
102  convert_seeds();
103 
104  TString ntupoutfile = outfilename + filename + "_ntup.root";
105  std::string ntupstring(ntupoutfile.Data());
106 
107  auto ntp = new TrkrNtuplizer("TrkrNtuplizer", ntupstring);
108  ntp->do_hit_eval(true);
109  ntp->do_cluster_eval(true);
110  ntp->do_track_eval(true);
111  ntp->do_siseed_eval(true);
112  ntp->do_tpcseed_eval(true);
113  ntp->do_clus_trk_eval(true);
114  ntp->do_vertex_eval(false);
115  ntp->set_trkclus_seed_container("SvtxTrackSeedContainer");
116  ntp->Verbosity(0);
117  ntp->do_info_eval(false);
118  se->registerSubsystem(ntp);
119 
120  TString residoutfile = outfilename + filename + "_resid.root";
121  std::string residstring(residoutfile.Data());
122 
123  auto resid = new TrackResiduals("TrackResiduals");
124  resid->outfileName(residstring);
125  resid->alignment(false);
126  resid->clusterTree();
127  resid->hitTree();
128  resid->zeroField();
129  se->registerSubsystem(resid);
130 
131  // Fun4AllOutputManager *out = new Fun4AllDstOutputManager("out", "/sphenix/tg/tg01/hf/jdosbo/tracking_development/onlineoffline/hitsets.root");
132  // se->registerOutputManager(out);
133 
134  se->run(nEvents);
135  se->End();
136  se->PrintTimer();
137 
138  delete se;
139  std::cout << "Finished" << std::endl;
140  gSystem->Exit(0);
141 }