21 mBorrowedHitCounterMax(0),
22 mBorrowedPlusMissingHitCounterMax(0),
23 mGeometryLocked(
false),
26 mBlindCellDecisionLevel(0),
27 mCellAcceptanceDecisionLevel(0),
30 mCurrMinOkHitCounter(0),
31 mMatchCandidateCount(0),
32 mSingleCellEdgeNum(1),
33 mFastTreeSearchMode(
false),
34 mTrackQualityIterationNum(1)
76 for(value--;
value; count++)
93 printf(
"HoughTree::AllocateLookUpTable(): t_btree_index width too small for this granularity!\n");
121 for(
int iq=0; iq<ndim; iq++)
137 const double max[],
const double gra[])
140 if (
mInitialized || !cdim || !min || !max || !gra)
return 0;
156 const double qmin[1] = {min}, qmax[1] = {max}, qgra[1] = {gra};
158 return AddNodeGroup(ptr, 0, 1, qmin, qmax, qgra, gridType);
162 const double gra[], SpaceGridType gridType)
164 return AddNodeGroup(ptr, 0, cdim, min, max, gra, gridType);
171 sprintf(arr,
"%2d", lv);
172 for(
unsigned iq=0; iq<lv; iq++)
173 sprintf(arr + strlen(arr),
"%s",
" ");
199 int daughter_calculation_needed = 0;
203 bool ok[gdim]; memset(ok, 0x00,
sizeof(ok));
211 for(
int iq=0; iq<ddim; iq++)
212 lr[ddim-iq-1] = (
ip >> iq) & 0x1;
230 for(
int iq=ddim-1; iq>=0; iq--)
234 for(
int iq=0; iq<ddim; iq++)
235 idx += sdim[iq]*(
id[iq]+lr[iq])*
246 for(
int iq=0; iq<ddim; iq++)
257 for(
int iq=0; iq<gdim; iq++)
263 for(
int gr=0; gr<gdim; gr++) {
270 daughter_calculation_needed = 1;
278 if (ok_group_sum == gdim)
goto _fall_out;
287 if (!ok[gr]) ok_group_sum++;
316 if (daughter_calculation_needed) {
334 for(
unsigned iq=0; iq<next->GetDaughterCellNumber(); iq++) {
335 for(
int ip=0;
ip<ddim;
ip++)
336 idq[
ip] =
id[
ip]*next->GetParameterSplitFactor(
ip) + next->Remap(iq,
ip);
368 std::map<MatchCandidate*, unsigned> competitors;
374 for(
int gr=0; gr<
mGroups.size(); gr++) {
378 if (!member)
continue;
381 for(std::set<MatchCandidate*>::iterator
it=member->
Begin();
it != member->
End();
it++) {
384 if (qmatch != match) competitors[qmatch]++;
391 for(std::map<MatchCandidate*, unsigned>::iterator
it=competitors.begin();
392 it != competitors.end();
it++)
393 if (
it->second >= myHitCount)
401 #define _NEW_SUBSET_LOGIC_
404 const std::vector<GroupMember*> members[])
411 std::vector<GroupMember*> qmembers[
mGroups.size()];
423 unsigned ok_hit_counter = 0, ok_added_group_counter = 0;
431 for(std::map<unsigned,unsigned>::iterator
it=
mGcounters.begin();
444 for(
int gr=0; gr<
mGroups.size(); gr++) {
445 int ok_group = 0, ok_added_group = 0;
452 for(
unsigned mm=0;
mm<members[gr].size();
mm++) {
472 if (group->
Overlap(std::pair<t_hough_range,t_hough_range>(gfrom, gto),
473 std::pair<t_hough_range,t_hough_range>(gmin, gmax)))
479 if (!
IsBusy(member)) ok_added_group = 1;
483 qmembers[gr].push_back(member);
504 ok_added_group_counter += ok_added_group;
513 printf(
"%s - gr=%d [%4d .. %4d]\n", str, gr, cell->
From(gr), cell->
To(gr));
523 printf(
"%s -* %4d\n", str, gfrom);
532 printf(
"%s + gr=%d [%4d .. %4d]\n", str, gr, cell->from[gr], cell->to[gr]);
551 for(std::map<unsigned,unsigned>::iterator
it=
mGlimits.begin();
557 unsigned borrowed_hit_counter =
572 #ifndef _NEW_SUBSET_LOGIC_
580 if (match->
IsSubset(
this, reference)) {
606 for(
unsigned gr=0; gr<
mGroups.size(); gr++) {
613 if (!member)
continue;
618 mMatchCandidateCount++;
623 mMatchCandidateCount++;
630 return ok_hit_counter;
659 unsigned ret =
CheckCell(lv+1, idq, dcell, qmembers);
669 if (ret == ok_hit_counter)
return ret;
686 void HoughTree::PrintTrackCandidateArray(
unsigned from,
unsigned to,
689 for(
unsigned tc=from; tc<=to; tc++) {
695 unsigned multi_max = 0, ok_hit_counter = 0, ok_group_counter = 0;
697 for(
int gr=0; gr<
mGroups.size(); gr++) {
698 if (match->GetMemberCount(gr) > multi_max)
699 multi_max = match->GetMemberCount(gr);
701 if (match->GetMemberCount(gr)) ok_group_counter++;
702 ok_hit_counter += match->GetMemberCount(gr);
705 for(
unsigned iq=0; iq<multi_max; iq++) {
709 const unsigned *
id = match->
GetIdPtr();
711 printf(
"%2d -> tr.candidate#%02d (%c): id[]: %4d/%4d/%4d:: %2d/%2d hits/groups total -> ",
714 ok_hit_counter, ok_group_counter);
717 for(
int gr=0; gr<
mGroups.size(); gr++)
719 if (match->mnum[gr] > iq && match->members[gr][iq])
721 printf(
" %3d", match->members[gr][iq]->_from >> (groups[gr]._nd+groups[gr]._nh));
725 printf(iq == multi_max-1 ?
"\n\n" :
"\n");
739 unsigned counter = 0;
760 #ifdef _NEW_SUBSET_LOGIC_
769 if (!reference->
IsActive())
continue;
771 if (match->
IsSubset(
this, reference)) {
884 for(
int gr=0; gr<
mGroups.size(); gr++) {
890 buffer[gr].push_back(member);
896 memset(
id, 0x00,
sizeof(
id));
907 printf(
"\n\n------------------------------------------------------------------\n");
915 std::vector<MatchCandidateGroup> mMatchCandidateGroups;
941 printf(
" --> %2d group(s) ...\n", (
unsigned)mMatchCandidateGroups.size());
945 for(
unsigned gr=0; gr<mMatchCandidateGroups.size(); gr++) {
954 unsigned trCounter = 0;
955 std::vector<MatchCandidate*> newMatches;
957 for(std::multimap<__u64, MatchCandidate*>::iterator
it=mgroup->
Begin();
962 printf(
"tr#%2d -> siam group candidate: doit!\n", trCounter++);
965 SeparateSiamTracks(match,
min, &newMatches);
971 for(
unsigned tr=0; tr<newMatches.size(); tr++) {
975 if (newMatches.size())
980 unsigned trCounter = 0;
981 for(std::multimap<__u64, MatchCandidate*>::iterator
it=mgroup->
Begin();
992 printf(
"tr#%2d -> ambiguities : skip!\n", trCounter++);
1013 ResolveAmbiguities(match);
1034 std::multimap<double, MatchCandidate*> finalCandidates;
1036 for(std::multimap<__u64, MatchCandidate*>::iterator
it=mgroup->
Begin();
1040 finalCandidates.insert(std::pair<
double,
1046 for(std::multimap<double, MatchCandidate*>::reverse_iterator
it = finalCandidates.rbegin();
1047 it != finalCandidates.rend();
it++) {
1060 for(
unsigned gr=0; gr<
mGroups.size(); gr++) {
1067 if (!member)
continue;
1070 for(std::multimap<double, MatchCandidate*>::reverse_iterator is = finalCandidates.rbegin();
1071 is != finalCandidates.rend(); is++) {
1077 if (qmatch == match)
continue;
1083 if (!qmember)
continue;
1095 member->SetBusyFlag();
1102 _fast_tree_search_mode:
1106 unsigned newTrackCount = 0;
1111 if (match->
IsActive()) newTrackCount++;
1115 printf(
"@GGG@: min=%2d, added %4d new track(s) ...\n",
min, newTrackCount);
1117 if (!newTrackCount)
break;
1125 if (counter)
printf(
" @PPP@ Purged %2d more duplicate track(s)!\n", counter);