Changeset 2445 for trunk/MagicSoft/Mars/mimage
- Timestamp:
- 10/30/03 17:09:40 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mimage/MImgCleanStd.cc
r2239 r2445 329 329 // set them to 'unused' state if necessary 330 330 // 331 331 332 for (Int_t i=0; i<entries; i++ ) 332 333 { … … 373 374 MCerPhotPix &pix = (*fEvt)[i]; 374 375 375 const Int_t id = pix.GetPixId();376 const Int_t idx = pix.GetPixId(); 376 377 377 378 const Float_t entry = pix.GetNumPhotons(); 378 const Double_t ratio = fCam->GetPixRatio(id );379 const Double_t ratio = fCam->GetPixRatio(idx); 379 380 380 381 // COBB: '<=' to skip entry=noise=0 … … 422 423 // (MCerPhotEvt::IsPixelUsed) all the time. 423 424 // 425 // We allocate the array ourself because the TArrays always do 426 // range check which slows down the access to the array 427 // by 25-50% 428 // 424 429 Byte_t *ispixused = new Byte_t[fCam->GetNumPixels()]; 430 memset(ispixused, 0, sizeof(Byte_t)*fCam->GetNumPixels()); 425 431 426 432 for (Int_t i=0; i<entries; i++) … … 428 434 const MCerPhotPix &pix = (*fEvt)[i]; 429 435 ispixused[pix.GetPixId()] = pix.IsPixelUsed() ? 1 : 0 ; 430 436 } 431 437 432 438 for (Int_t i=0; i<entries; i++) … … 436 442 437 443 // get pixel id of this entry 438 const Int_t id = pix.GetPixId();444 const Int_t idx = pix.GetPixId(); 439 445 440 446 // check if pixel is in use, if not goto next pixel in list 441 if (ispixused[id ] == 0)447 if (ispixused[idx] == 0) 442 448 continue; 443 449 444 450 // check for 'used' neighbors of this pixel 445 const MGeomPix &gpix = (*fCam)[id ];451 const MGeomPix &gpix = (*fCam)[idx]; 446 452 const Int_t nnmax = gpix.GetNumNeighbors(); 447 453 … … 451 457 for (Int_t j=0; j<nnmax; j++) 452 458 { 453 const Int_t id 2 = gpix.GetNeighbor(j);459 const Int_t idx2 = gpix.GetNeighbor(j); 454 460 455 461 // when you find an used neighbor, break the loop 456 if (ispixused[id 2] == 1)462 if (ispixused[idx2] == 1) 457 463 { 458 459 464 hasNeighbor = kTRUE; 465 break; 460 466 } 461 467 } … … 478 484 } 479 485 } 486 480 487 481 488 // -------------------------------------------------------------------------- … … 518 525 // get pixel id of this entry 519 526 // 520 const Int_t id = pix.GetPixId();527 const Int_t idx = pix.GetPixId(); 521 528 522 529 // … … 524 531 // 525 532 const Float_t entry = pix.GetNumPhotons(); 526 const Double_t ratio = fCam->GetPixRatio(id );533 const Double_t ratio = fCam->GetPixRatio(idx); 527 534 528 535 return (entry * ratio <= fCleanLvl2 * fInnerNoise); … … 531 538 void MImgCleanStd::CleanStep3b(MCerPhotPix &pix) 532 539 { 533 const Int_t id = pix.GetPixId();540 const Int_t idx = pix.GetPixId(); 534 541 535 542 // … … 537 544 // if it is a core pixel set pixel state to: used. 538 545 // 539 MGeomPix &gpix = (*fCam)[id ];546 MGeomPix &gpix = (*fCam)[idx]; 540 547 const Int_t nnmax = gpix.GetNumNeighbors(); 541 548 542 549 for (Int_t j=0; j<nnmax; j++) 543 550 { 544 const Int_t id 2 = gpix.GetNeighbor(j);545 546 if (!fEvt->GetPixById(id 2) || !fEvt->IsPixelCore(id2))547 551 const Int_t idx2 = gpix.GetNeighbor(j); 552 553 if (!fEvt->GetPixById(idx2) || !fEvt->IsPixelCore(idx2)) 554 continue; 548 555 549 556 pix.SetPixelUsed(); 550 557 break; 551 558 } 552 559 } … … 568 575 // and tell to which ring it belongs to. 569 576 // 570 const Int_t id = pix.GetPixId();571 MGeomPix &gpix = (*fCam)[id ];577 const Int_t idx = pix.GetPixId(); 578 MGeomPix &gpix = (*fCam)[idx]; 572 579 573 580 const Int_t nnmax = gpix.GetNumNeighbors(); … … 575 582 for (Int_t j=0; j<nnmax; j++) 576 583 { 577 const Int_t id2 = gpix.GetNeighbor(j); 578 579 MCerPhotPix &npix = *fEvt->GetPixById(id2); 580 581 // FIXME! 582 // Needed check to read CT1 data without having a Segmentation fault 583 if (!fEvt->GetPixById(id2)) 584 continue; 585 586 if (!npix.IsPixelUsed() || npix.GetRing()>r-1 ) 584 const Int_t idx2 = gpix.GetNeighbor(j); 585 586 MCerPhotPix *npix = fEvt->GetPixById(idx2); 587 588 if (!npix || !npix->IsPixelUsed() || npix->GetRing()>r-1 ) 587 589 continue; 588 590
Note:
See TracChangeset
for help on using the changeset viewer.