23 : m_verbosity(verbosity)
38 std::cout <<
"Missing containers, will not run TPC seed ghost rejection"
44 std::cout <<
"PHGhostRejection beginning track map size " <<
m_trackMap->
size() << std::endl;
48 std::set<unsigned int> matches_set;
49 std::multimap<unsigned int, unsigned int> matches;
51 for (
unsigned int trid1 = 0;
59 float track1x = track1->
get_x();
60 float track1y = track1->
get_y();
61 float track1z = track1->
get_z();
62 float track1eta = track1->
get_eta();
63 for (
unsigned int trid2 = trid1;
67 if(trid1 == trid2)
continue;
79 matches_set.insert(trid1);
80 matches.insert( std::pair( trid1, trid2) );
83 std::cout <<
"Found match for tracks " << trid1 <<
" and " << trid2 << std::endl;
88 std::set<unsigned int> ghost_reject_list;
90 for(
auto set_it : matches_set)
92 if(ghost_reject_list.find(set_it) != ghost_reject_list.end())
continue;
94 auto match_list = matches.equal_range(set_it);
97 double best_qual = trackChi2.at(set_it);
98 unsigned int best_track = set_it;
101 std::cout <<
" ****** start checking track " << set_it <<
" with best quality " << best_qual <<
" best_track " << best_track << std::endl;
103 for (
auto it=match_list.first;
it!=match_list.second; ++
it)
106 std::cout <<
" match of track " <<
it->first <<
" to track " <<
it->second << std::endl;
114 if(!is_same_track)
continue;
117 double tr2_qual = trackChi2.at(
it->second);
120 std::cout <<
" Compare: best quality " << best_qual <<
" track 2 quality " << tr2_qual << std::endl;
121 std::cout <<
" tr1: phi " << tr1->get_phi(
m_positions) <<
" eta " << tr1->get_eta()
122 <<
" x " << tr1->get_x() <<
" y " << tr1->get_y() <<
" z " << tr1->get_z() << std::endl;
123 std::cout <<
" tr2: phi " << tr2->get_phi(
m_positions) <<
" eta " << tr2->get_eta()
124 <<
" x " << tr2->get_x() <<
" y " << tr2->get_y() <<
" z " << tr2->get_z() << std::endl;
127 if(tr2_qual < best_qual)
130 std::cout <<
" --------- Track " <<
it->second <<
" has better quality, erase track " << best_track << std::endl;
131 ghost_reject_list.insert(best_track);
132 best_qual = tr2_qual;
133 best_track =
it->second;
138 std::cout <<
" --------- Track " << best_track <<
" has better quality, erase track " <<
it->second << std::endl;
139 ghost_reject_list.insert(
it->second);
144 std::cout <<
" best track " << best_track <<
" best_qual " << best_qual << std::endl;
149 for(
auto it : ghost_reject_list)
152 std::cout <<
" erasing track ID " <<
it << std::endl;
158 std::cout <<
"Track map size after deleting ghost tracks: " <<
m_trackMap->
size() << std::endl;
169 bool is_same_track =
false;
171 std::multimap<TrkrDefs::cluskey, unsigned int> cluskey_map;
172 std::vector<TrkrDefs::cluskey> clusterkeys;
179 if(
m_verbosity > 2) std::cout <<
" track id: " << trid1 <<
" adding clusterkey " << cluster_key << std::endl;
180 cluskey_map.insert( std::make_pair(cluster_key, trid1) );
181 clusterkeys.push_back(cluster_key);
189 if(
m_verbosity > 2) std::cout <<
" track id: " << trid2 <<
" adding clusterkey " << cluster_key << std::endl;
190 cluskey_map.insert( std::make_pair(cluster_key, trid2) );
193 unsigned int nclus = clusterkeys.size();
195 unsigned int nclus_used = 0;
198 if(cluskey_map.count(
cluskey)>0) nclus_used++;
201 if( (
float) nclus_used / (float) nclus > 0.5)
202 is_same_track =
true;
205 std::cout <<
" tr1 " << trid1 <<
" tr2 " << trid2 <<
" nclus_used " << nclus_used <<
" nclus " << nclus << std::endl;
207 if(!is_same_track) std::cout <<
" ***** not the same track! ********" <<
" tr1 " << trid1 <<
" tr2 "
208 << trid2 <<
" nclus_used " << nclus_used <<
" nclus " << nclus << std::endl;
210 return is_same_track;