ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHSiliconTpcTrackMatching.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHSiliconTpcTrackMatching.h
1 // Tell emacs that this is a C++ source
2 // -*- C++ -*-.
3 #ifndef PHSILICONTPCTRACKMATCHING_H
4 #define PHSILICONTPCTRACKMATCHING_H
5 
6 #include <fun4all/SubsysReco.h>
9 
10 #include <string>
11 #include <map>
12 
13 class PHCompositeNode;
14 class SvtxTrackMap;
15 class SvtxTrack;
17 class TF1;
18 class TpcSeedTrackMap;
19 class AssocInfoContainer;
20 
22 {
23  public:
24 
25  PHSiliconTpcTrackMatching(const std::string &name = "PHSiliconTpcTrackMatching");
26 
27  ~PHSiliconTpcTrackMatching() override;
28 
29  void set_track_map_name_silicon(const std::string &map_name) { _track_map_name_silicon = map_name; }
30  void set_phi_search_window(const double win){_phi_search_win = win;}
31  void set_eta_search_window(const double win){_eta_search_win = win;}
32  void set_x_search_window(const double win){_x_search_win = win;}
33  void set_y_search_window(const double win){_y_search_win = win;}
34  void set_z_search_window(const double win){_z_search_win = win;}
35  void set_search_par_values(const double p0, const double p1, const double p2){_par0 = p0; _par1 = p1; _par2 = p2; }
36  void set_seeder(const bool is_ca_seeder){_is_ca_seeder = is_ca_seeder;}
37 
38  void set_field_dir(const double rescale)
39  {
40  _fieldDir = -1;
41  if(rescale > 0)
42  _fieldDir = 1;
43  }
44  void set_field(const std::string &field) { _field = field;}
45 
47  void set_sc_calib_mode(const bool flag){_sc_calib_flag = flag;}
48  void set_collision_rate(const double rate){_collision_rate = rate;}
49  void set_pp_mode(const bool flag){_pp_mode = flag ;}
50 
51  int InitRun(PHCompositeNode* topNode) override;
52 
53  int process_event(PHCompositeNode*) override;
54 
55  int End(PHCompositeNode*) override;
56 
57  void set_silicon_track_map_name(const std::string &map_name) { _silicon_track_map_name = map_name; }
58  void set_tpcseed_track_map_name(const std::string &map_name) { _tpcseed_track_map_name = map_name; }
59  void set_track_map_name(const std::string &map_name) { _track_map_name = map_name; }
60  void SetIteration(int iter){_n_iteration = iter;}
61  private:
62 
63  int GetNodes(PHCompositeNode* topNode);
64 
65  double getBunchCrossing(unsigned int trid, double z_mismatch);
66  double getMedian(std::vector<double> &v);
67  void addSiliconClusters( std::multimap<int, std::pair<unsigned int, unsigned int>> &crossing_matches);
68  void addSiliconClusters( std::multimap<unsigned int, std::pair<unsigned int, unsigned int>> &vertex_map);
69  void addSiliconClusters( std::multimap<unsigned int, unsigned int> &tpc_matches);
70  void correctTpcClusterZ( std::map<unsigned int, double> &vertex_crossings_map,
71  std::multimap<unsigned int, std::pair<unsigned int, unsigned int>> &vertex_map );
72  void getCrossingNumber( std::vector<double> &vertex_list,
73  std::multimap<unsigned int, std::pair<unsigned int, unsigned int>> &vertex_map,
74  std::map<unsigned int, double> &vertex_crossings_map);
75  void getSiVertexList( std::multimap<double, std::pair<unsigned int, unsigned int>> &si_sorted_map,
76  std::vector<double> &vertex_list,
77  std::multimap<unsigned int, std::pair<unsigned int, unsigned int>> &vertex_map);
78  void findEtaPhiMatches( std::set<unsigned int> &tpc_matched_set,
79  std::multimap<unsigned int, unsigned int> &tpc_matches );
80  void tagInTimeTracks( std::multimap<unsigned int, unsigned int> &tpc_matches,
81  std::set<int> &crossing_set,
82  std::multimap<int, std::pair<unsigned int, unsigned int>> &crossing_matches,
83  std::map<unsigned int, int> &tpc_crossing_map );
84  void tagMatchCrossing( std::multimap<unsigned int, unsigned int> &tpc_matches,
85  std::set<int> &crossing_set,
86  std::multimap<int, std::pair<unsigned int, unsigned int>> &crossing_matches,
87  std::map<unsigned int, int> &tpc_crossing_map );
88  void cleanVertexMap( std::map<unsigned int, double> &vertex_crossings_map,
89  std::multimap<unsigned int, std::pair<unsigned int, unsigned int>> &vertex_map,
90  std::map<unsigned int, int> &tpc_crossing_map );
92 
93 
95 
96  // default values, can be replaced from the macro
97  double _phi_search_win = 0.01;
98  double _eta_search_win = 0.004;
99  double _x_search_win = 0.3;
100  double _y_search_win = 0.3;
101  double _z_search_win = 0.4;
102 
112 
113 
115  //std::multimap<unsigned int, unsigned int> _seed_track_map;
116  std::map<unsigned int, double> _z_mismatch_map;
117 
118  // correction function for PHTpcTracker track phi bias
119  TF1 *fdphi{nullptr};
120  // default values, can be replaced from the macro
121  double _par0 = -0.000650;
122  double _par1 = 0.13373;
123  double _par2 = 0.98298;
124 
125  // correction factor for TPC tracklet phi offset due to space charge in TPC
126  TF1 *fscdphi{nullptr};
127  double _parsc0 = 0.0366293;
128  double _parsc1 = -0.0133073;
129 
130  double _collision_rate = 50e3; // input rate for phi correction
131  double _reference_collision_rate = 50e3; // reference rate for phi correction
132  double _si_vertex_dzmax = 0.25; // mm
133 
134  bool _is_ca_seeder = true;
135  bool _sc_calib_flag = false;
136  bool _test_windows = false;
137  bool _pp_mode = false;
138 
139  std::string _field;
140  int _fieldDir = -1;
141 
142  int _n_iteration = 0;
143  std::string _track_map_name = "SvtxTrackMap";
144  std::string _tpcseed_track_map_name = "TpcSeedTrackMap";
145  std::string _silicon_track_map_name = "SvtxSiliconTrackMap";
146 };
147 
148 #endif // PHTRUTHSILICONASSOCIATION_H