Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Trkr_Reco_Cosmics.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Trkr_Reco_Cosmics.C
1 #ifndef MACRO_TRKRRECO_COSMICS_C
2 #define MACRO_TRKRRECO_COSMICS_C
3 
4 #include <G4_TrkrVariables.C>
5 
7 #include <trackingdiagnostics/TrackSeedTrackMapConverter.h>
8 
22 
24 
26 
27 #include <trackermillepedealignment/HelicalFitter.h>
28 #include <trackermillepedealignment/MakeMilleFiles.h>
29 
30 #include <fun4all/Fun4AllServer.h>
31 
32 #include <string>
33 
34 R__LOAD_LIBRARY(libtrack_reco.so)
35 R__LOAD_LIBRARY(libtpccalib.so)
36 R__LOAD_LIBRARY(libtpc.so)
37 R__LOAD_LIBRARY(libtrackeralign.so)
38 R__LOAD_LIBRARY(libTrackingDiagnostics.so)
40 {
43 
45  // Default set to full SvtxTrackSeeds. Can be set to
46  // SiliconTrackSeedContainer or TpcTrackSeedContainer
47  converter->setTrackSeedName("SvtxTrackSeedContainer");
48  converter->Verbosity(verbosity);
49  converter->cosmics();
50  converter->setFieldMap(G4MAGNET::magfield);
51  se->registerSubsystem(converter);
52 }
53 
55 {
56  // set up verbosity
58 
59  // get fun4all server instance
60  auto se = Fun4AllServer::instance();
61 
63  seeder->Verbosity(0);
64  se->registerSubsystem(seeder);
65 
66  PHCosmicSiliconPropagator *hprop = new PHCosmicSiliconPropagator("HelicalPropagator");
67  hprop->Verbosity(verbosity);
68  hprop->zero_field();
69  hprop->set_dca_z_cut(2);
70  hprop->set_dca_xy_cut(2);
71  se->registerSubsystem(hprop);
72 
73  // Associate Micromegas clusters with the tracks
74 
75  // Match TPC track stubs from CA seeder to clusters in the micromegas layers
76  auto mm_match = new PHMicromegasTpcTrackMatching;
77  mm_match->Verbosity(verbosity);
78 
79  // baseline configuration is (0.2, 13.0, 26, 0.2) and is the default
80  mm_match->set_rphi_search_window_lyr1(0.2);
81  mm_match->set_rphi_search_window_lyr2(13.0);
82  mm_match->set_z_search_window_lyr1(26.0);
83  mm_match->set_z_search_window_lyr2(0.2);
84  mm_match->set_min_tpc_layer(38); // layer in TPC to start projection fit
85  mm_match->set_test_windows_printout(false); // used for tuning search windows only
86  se->registerSubsystem(mm_match);
87 
88  auto merger = new PHCosmicTrackMerger("PHCosmicMerger");
89  merger->Verbosity(verbosity);
90  se->registerSubsystem(merger);
91 
92  PHCosmicSiliconPropagator *hprop2 = new PHCosmicSiliconPropagator("HelicalPropagator2");
93  hprop2->Verbosity(verbosity);
94  hprop2->resetSvtxSeedContainer();
95  hprop2->zero_field();
96  hprop2->set_dca_z_cut(2.5);
97  hprop2->set_dca_xy_cut(2.5);
98  se->registerSubsystem(hprop2);
99 
100  auto merger2 = new PHCosmicTrackMerger("PHCosmicMerger2");
101  merger2->Verbosity(verbosity);
102  se->registerSubsystem(merger2);
103 }
104 
105 void vertexing()
106 {
109 
110  auto vtxfinder = new PHSimpleVertexFinder;
111  vtxfinder->Verbosity(verbosity);
112  se->registerSubsystem(vtxfinder);
113 }
114 
116 {
118  auto se = Fun4AllServer::instance();
119 
120  // correct clusters for particle propagation in TPC
121  auto deltazcorr = new PHTpcDeltaZCorrection;
122  deltazcorr->Verbosity(verbosity);
123  se->registerSubsystem(deltazcorr);
124 
125  // perform final track fit with ACTS
126  auto actsFit = new PHCosmicsTrkFitter;
127  actsFit->Verbosity(verbosity);
128  // actsFit->commissioning(G4TRACKING::use_alignment);
129  // actsFit->set_cluster_version(G4TRACKING::cluster_version);
130  // in calibration mode, fit only Silicons and Micromegas hits
131  actsFit->useActsEvaluator(true);
132  actsFit->useOutlierFinder(false);
133  actsFit->setFieldMap(G4MAGNET::magfield);
134  se->registerSubsystem(actsFit);
135 }
136 
137 void alignment(std::string datafilename = "mille_output_data_file",
138  std::string steeringfilename = "mille_steer")
139 {
142 
143  auto mille = new MakeMilleFiles;
144  mille->Verbosity(verbosity);
145  mille->set_datafile_name(datafilename + ".bin");
146  mille->set_steeringfile_name(steeringfilename + ".txt");
147  // mille->set_cluster_version(G4TRACKING::cluster_version);
148  se->registerSubsystem(mille);
149 
150  auto helical = new HelicalFitter;
151  helical->Verbosity(0);
152  helical->set_datafile_name(datafilename + "_helical.bin");
153  helical->set_steeringfile_name(steeringfilename + "_helical.txt");
154  // helical->set_cluster_version(G4TRACKING::cluster_version);
155  se->registerSubsystem(helical);
156 }
157 
159 {
162  {
163  convert_seeds();
164  }
165  else
166  {
168  }
169 
170  vertexing();
171 
173  {
174  alignment();
175  }
176 }
177 
178 #endif