53 cout<<
"-E- CbmRichRingFinderHoughImpl::DoFind: Number of hits is more than "<<
kMAX_NOF_HITS << endl;
105 for (
unsigned int iHit = 0; iHit <
fData.size(); iHit++)
107 if (
fData[iHit].fIsUsed ==
true)
continue;
119 int *indmin,
int *indmax)
122 std::vector<CbmRichHoughHit>::iterator itmin, itmax;
131 *indmin = itmin -
fData.begin();
132 *indmax = itmax -
fData.begin();
134 int arSize = *indmax - *indmin + 1;
147 register int indmin1=*indmin;
148 register int indmax1=*indmax;
152 for (
int i = indmin1; i <= indmax1; i+=2) {
153 if (
fData[i].fIsUsed ==
true)
continue;
154 register float ry = y0 -
fData[i].fHit.fY;
155 if (fabs(ry) > maxDistance08)
continue;
156 register float rx = x0 -
fData[i].fHit.fX;
157 register float d = rx * rx +ry * ry;
162 for (
int i = indmin1+1; i <= indmax1; i+=2) {
163 if (
fData[i].fIsUsed ==
true)
continue;
164 register float ry = y0 -
fData[i].fHit.fY;
165 if (fabs(ry) > maxDistance08)
continue;
166 register float rx = x0 -
fData[i].fHit.fX;
167 register float d = rx * rx +ry * ry;
185 for (
register unsigned short j = 0; j <
fNofBinsXY; j++){
191 for (
register unsigned short k = 0;
k <
fNofBinsR;
k++) {
198 for (
int iPart = 0; iPart <
fNofParts; iPart++){
206 unsigned short int indmax,
int iPart)
208 register unsigned short nofHits;
209 register float xcs, ycs;
212 register vector<CbmRichHoughHit>
data;
216 }
else if (iPart == 1) {
220 typedef vector<CbmRichHoughHit>::iterator iH;
222 for (iH iHit1 = data.begin(); iHit1 != data.end(); iHit1++) {
223 register float iH1X = iHit1->fHit.fX;
224 register float iH1Y = iHit1->fHit.fY;
226 for (iH iHit2 = iHit1 + 1; iHit2 != data.end(); iHit2++) {
227 register float iH2X = iHit2->fHit.fX;
228 register float iH2Y = iHit2->fHit.fY;
230 register float rx0 = iH1X - iH2X;
231 register float ry0 = iH1Y- iH2Y;
232 register float r12 = rx0 * rx0 + ry0 * ry0;
235 register float t10 = iHit1->fX2plusY2 - iHit2->fX2plusY2;
236 for (iH iHit3 = iHit2 + 1; iHit3 != data.end(); iHit3++) {
237 register float iH3X = iHit3->fHit.fX;
238 register float iH3Y = iHit3->fHit.fY;
240 register float rx1 = iH1X - iH3X;
241 register float ry1 = iH1Y - iH3Y;
242 register float r13 = rx1 * rx1 + ry1 * ry1;
243 if (r13 < fMinDistanceSq || r13 > fMaxDistanceSq)
continue;
245 register float rx2 = iH2X - iH3X;
246 register float ry2 = iH2Y - iH3Y;
247 register float r23 = rx2 * rx2 + ry2 * ry2;
248 if (r23 < fMinDistanceSq || r23 > fMaxDistanceSq)
continue;
250 register float det = rx2*ry0 - rx0*ry2;
251 if (det == 0.0f)
continue;
252 register float t19 = 0.5f / det;
253 register float t5 = iHit2->fX2plusY2 - iHit3->fX2plusY2;
255 register float xc = (t5 * ry0 - t10 * ry2) * t19;
257 register int intX = int( xcs *dx);
258 if (intX < 0 || intX >=
fNofBinsX )
continue;
260 register float yc = (t10 * rx2 - t5 * rx0) * t19;
262 register int intY = int( ycs *dy);
263 if (intY < 0 || intY >=
fNofBinsY )
continue;
266 register float t6 = iH1X - xc;
267 register float t7 = iH1Y - yc;
269 register float r = sqrt(t6 * t6 + t7 * t7);
271 register int intR = int(r *dr);
272 if (intR < 0 || intR >=
fNofBinsR)
continue;
285 int maxBinR = -1, maxR = -1;
286 register unsigned int size =
fHistR.size();
287 for (
unsigned int k = 0;
k < size;
k++){
296 int maxBinXY = -1, maxXY = -1;
298 for (
unsigned int k = 0;
k < size;
k++){
304 if (maxBinXY <
fHTCut)
return;
309 register float xc, yc, r;
310 register float rx, ry, dr;
313 r = (maxR + 0.5f)*
fDr;
314 for (
int j = indmin; j < indmax + 1; j++) {
315 rx =
fData[j].fHit.fX - xc;
316 ry =
fData[j].fHit.fY - yc;
318 dr = fabs(sqrt(rx * rx + ry * ry) - r);
319 if (dr > 0.6f)
continue;
336 for (
int j = indmin; j < indmax + 1; j++) {
337 rx =
fData[j].fHit.fX - xc;
338 ry =
fData[j].fHit.fY - yc;
340 dr = fabs(sqrt(rx * rx + ry * ry) - r);
341 if (dr > drCOPCut)
continue;
375 for (
int j = indmin; j < indmax + 1; j++) {
379 float dr = fabs(sqrt(rx * rx + ry * ry) - ring->
GetRadius());
381 fData[j].fIsUsed =
true;
391 std::set<unsigned short> usedHitsAll;
392 std::vector<unsigned short> goodRingIndex;
393 goodRingIndex.reserve(nofRings);
396 for (
int iRing = 0; iRing < nofRings; iRing++){
401 bool isGoodRingAll =
true;
402 int nofUsedHitsAll = 0;
403 for(
int iHit = 0; iHit < nofHits; iHit++){
404 std::set<unsigned short>::iterator
it = usedHitsAll.find(ring->
GetHitId(iHit));
405 if(it != usedHitsAll.end()){
410 isGoodRingAll =
false;
415 for (
int iRSet = 0; iRSet < goodRingIndex.size(); iRSet++){
418 goodRingIndex.push_back(iRing);
420 for(
int iHit = 0; iHit < nofHits; iHit++){
422 usedHitsAll.insert(ring->
GetHitId(iHit));
428 goodRingIndex.clear();
439 for(
int iHit1 = 0; iHit1 < nofHits1; iHit1++){
440 unsigned short hitInd1 = ring1->
GetHitId(iHit1);
441 for(
int iHit2 = 0; iHit2 < nofHits2; iHit2++){
442 unsigned short hitInd2 = ring2->
GetHitId(iHit2);
443 if(hitInd1 != hitInd2)
continue;
445 float hitX =
fData[hitIndData].fHit.fX;
446 float hitY =
fData[hitIndData].fHit.fY;
449 float dr1 = fabs(sqrt(rx1 * rx1 + ry1 * ry1) - ring1->
GetRadius());
453 float dr2 = fabs(sqrt(rx2 * rx2 + ry2 * ry2) - ring2->
GetRadius());
466 unsigned int size =
fData.size();
467 for (
register unsigned int i = 0; i < size; i++){
468 if (
fData[i].fId == hitInd)
return i;