59 std::cout <<
"Track map size after deleting ghost tracks: " <<
_track_map->
size() << std::endl;
76 std::cout <<
PHWHERE <<
" ERROR: Can't find SvtxTrackMap: " << std::endl;
85 std::set<unsigned int> matches_set;
86 std::multimap<unsigned int, unsigned int> matches;
91 auto track1 = (tr1_iter)->
second;
93 for (
auto tr2_iter = tr1_iter;
97 if((tr2_iter)->first == (tr1_iter)->first)
continue;
99 auto track2 = (tr2_iter)->
second;
101 fabs( track1->get_phi() - track2->get_phi() ) <
_phi_cut &&
102 fabs( track1->get_eta() - track2->get_eta() ) <
_eta_cut &&
103 fabs( track1->get_x() - track2->get_x() ) <
_x_cut &&
104 fabs( track1->get_y() - track2->get_y() ) <
_y_cut &&
105 fabs( track1->get_z() - track2->get_z() ) <
_z_cut
108 matches_set.insert(tr1_iter->first);
109 matches.insert( std::pair( (tr1_iter)->first, (tr2_iter)->first) );
112 std::cout <<
"Found match for tracks " << (tr1_iter)->first <<
" and " << (tr2_iter)->first << std::endl;
117 std::set<unsigned int> ghost_reject_list;
119 for(
auto set_it : matches_set)
121 if(ghost_reject_list.find(set_it) != ghost_reject_list.end())
continue;
123 auto match_list = matches.equal_range(set_it);
126 double best_qual = tr1->
get_chisq() / tr1->get_ndf();
127 unsigned int best_track = set_it;
130 std::cout <<
" ****** start checking track " << set_it <<
" with best quality " << best_qual <<
" best_track " << best_track << std::endl;
132 for (
auto it=match_list.first;
it!=match_list.second; ++
it)
135 std::cout <<
" match of track " <<
it->first <<
" to track " <<
it->second << std::endl;
142 if(!is_same_track)
continue;
145 double tr2_qual = tr2->get_chisq() / tr2->get_ndf();
148 std::cout <<
" Compare: best quality " << best_qual <<
" track 2 quality " << tr2_qual << std::endl;
149 std::cout <<
" tr1: phi " << tr1->get_phi() <<
" eta " << tr1->get_eta()
150 <<
" x " << tr1->get_x() <<
" y " << tr1->get_y() <<
" z " << tr1->get_z() << std::endl;
151 std::cout <<
" tr2: phi " << tr2->get_phi() <<
" eta " << tr2->get_eta()
152 <<
" x " << tr2->get_x() <<
" y " << tr2->get_y() <<
" z " << tr2->get_z() << std::endl;
155 if(tr2_qual < best_qual)
158 std::cout <<
" --------- Track " <<
it->second <<
" has better quality, erase track " << best_track << std::endl;
159 ghost_reject_list.insert(best_track);
160 best_qual = tr2_qual;
161 best_track =
it->second;
166 std::cout <<
" --------- Track " << best_track <<
" has better quality, erase track " <<
it->second << std::endl;
167 ghost_reject_list.insert(
it->second);
172 std::cout <<
" best track " << best_track <<
" best_qual " << best_qual << std::endl;
177 for(
auto it : ghost_reject_list)
180 std::cout <<
" erasing track ID " <<
it << std::endl;
192 bool is_same_track =
false;
194 std::multimap<TrkrDefs::cluskey, unsigned int> cluskey_map;
195 std::vector<TrkrDefs::cluskey> clusterkeys;
202 if(
Verbosity() > 2) std::cout <<
" track id: " << tr1->
get_id() <<
" adding clusterkey " << cluster_key << std::endl;
203 cluskey_map.insert( std::make_pair(cluster_key, tr1->
get_id()) );
204 clusterkeys.push_back(cluster_key);
212 if(
Verbosity() > 2) std::cout <<
" track id: " << tr2->
get_id() <<
" adding clusterkey " << cluster_key << std::endl;
213 cluskey_map.insert( std::make_pair(cluster_key, tr2->
get_id()) );
216 unsigned int nclus = clusterkeys.size();
218 unsigned int nclus_used = 0;
221 if(cluskey_map.count(
cluskey)>0) nclus_used++;
224 if( (
float) nclus_used / (float) nclus > 0.5)
225 is_same_track =
true;
228 std::cout <<
" tr1 " << tr1->
get_id() <<
" tr2 " << tr2->
get_id() <<
" nclus_used " << nclus_used <<
" nclus " << nclus << std::endl;
230 if(!is_same_track) std::cout <<
" ***** not the same track! ********" <<
" tr1 " << tr1->
get_id() <<
" tr2 "
231 << tr2->
get_id() <<
" nclus_used " << nclus_used <<
" nclus " << nclus << std::endl;
233 return is_same_track;