Changeset 6858 for trunk/MagicSoft/Mars/mbadpixels
- Timestamp:
- 03/18/05 18:07:46 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mbadpixels
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mbadpixels/MBadPixelsTreat.cc
r6377 r6858 53 53 // 54 54 // Input Containers: 55 // M CerPhotEvt55 // MSignalCam 56 56 // MPedPhotCam 57 57 // MBadPixelsCam … … 59 59 // 60 60 // Output Containers: 61 // M CerPhotEvt61 // MSignalCam 62 62 // 63 63 ///////////////////////////////////////////////////////////////////////////// … … 79 79 #include "MGeomCam.h" 80 80 81 #include "M CerPhotPix.h"82 #include "M CerPhotEvt.h"81 #include "MSignalPix.h" 82 #include "MSignalCam.h" 83 83 84 84 #include "MPedPhotPix.h" … … 88 88 #include "MBadPixelsCam.h" 89 89 90 #include "MArrivalTime.h"90 //#include "MArrivalTime.h" 91 91 92 92 ClassImp(MBadPixelsTreat); … … 132 132 // 133 133 // - Try to find or create MBlindPixels in parameter list. 134 // - get the M CerPhotEvtfrom the parlist (abort if missing)134 // - get the MSignalCam from the parlist (abort if missing) 135 135 // - if no pixels are given by the user try to determin the starfield 136 136 // from the monte carlo run header. … … 145 145 } 146 146 147 fEvt = (M CerPhotEvt*)pList->FindObject(AddSerialNumber("MCerPhotEvt"));147 fEvt = (MSignalCam*)pList->FindObject(AddSerialNumber("MSignalCam")); 148 148 if (!fEvt) 149 149 { 150 *fLog << err << AddSerialNumber("M CerPhotEvt") << " not found... aborting." << endl;150 *fLog << err << AddSerialNumber("MSignalCam") << " not found... aborting." << endl; 151 151 return kFALSE; 152 152 } … … 191 191 { 192 192 *fLog << err << AddSerialNumber(o->GetName()) << " [MPedPhotCam] not found... aborting." << endl; 193 //*fLog << " Use MBadPixelsTreat::SetProcessPedestalRun(kFALSE) and" << endl;194 //*fLog << " MBadPixelsTreat::SetProcessPedestalEvt(kFALSE) to switch" << endl;195 //*fLog << " Pedestal treatment off." << endl;196 193 return kFALSE; 197 194 } 198 195 199 196 fPedPhotCams.Add(p); 200 }201 }202 203 fTimes = 0;204 if (IsProcessTimes())205 {206 fTimes = (MArrivalTime*)pList->FindObject(AddSerialNumber("MArrivalTime"));207 if (!fTimes)208 {209 *fLog << err << AddSerialNumber("MArrivalTime") << " not found... aborting." << endl;210 *fLog << " Use MBadPixelsTreat::SetProcessTimes(kFALSE) to switch time interpolation off." << endl;211 return kFALSE;212 197 } 213 198 } … … 245 230 for (UShort_t i=0; i<entries; i++) 246 231 { 247 M CerPhotPix *pix = fEvt->GetPixById(i);232 MSignalPix *pix = fEvt->GetPixById(i); 248 233 249 234 // … … 255 240 // 256 241 // Get a pointer to this pixel. If it is not yet existing 257 // create a new entry for this pixel in M CerPhotEvt242 // create a new entry for this pixel in MSignalCam 258 243 // 259 244 if (!pix) … … 301 286 // Check whether the neighbor has a signal stored 302 287 // 303 const M CerPhotPix *evtpix = fEvt->GetPixById(nidx);288 const MSignalPix *evtpix = fEvt->GetPixById(nidx); 304 289 if (!evtpix) 305 290 continue; … … 416 401 if (num < fNumMinNeighbors) 417 402 { 418 M CerPhotPix *pix =fEvt->GetPixById(i);403 MSignalPix *pix =fEvt->GetPixById(i); 419 404 if (!pix) 420 405 pix = fEvt->AddPixel(i, 0, 0); … … 454 439 void MBadPixelsTreat::InterpolateTimes() const 455 440 { 456 Int_t n = f Times->GetSize();441 Int_t n = fEvt->GetNumPixels(); 457 442 458 443 for (int i=0; i<n; i++) … … 474 459 for (unsigned int j=0; j<time.GetSize(); j++) 475 460 { 476 const Double_t t = (*f Times)[gpix.GetNeighbor(j)];461 const Double_t t = (*fEvt)[j].GetArrivalTime(); 477 462 if (t>=0) 478 463 time[n0++] = t; … … 498 483 // FIXME: Request a minimum number of neighbors to take action? 499 484 if (p0>=0 && p1>=0 && TMath::Abs(time[p0] - time[p1])<250) 500 fTimes->SetTime(i, (time[p0]+time[p1])/2); 501 } 502 } 503 504 // -------------------------------------------------------------------------- 505 // 506 // Replaces each pixel (signal, signal error, pedestal, pedestal rms) 507 // by the average of its surrounding pixels. 508 // If TESTBIT(fFlags, kUseCentralPixel) is set the central pixel is also 509 // included. 510 // 511 // NT: Informations about the interpolated pedestals are added. 512 // When the option Interpolated is called, the blind pixel with the new 513 // values of signal and fluttuation is included in the calculation of 514 // the Image Parameters. 515 // 516 /* 517 void MBadPixelsTreat::Interpolate() const 518 { 519 const UShort_t entries = fGeomCam->GetNumPixels(); 520 521 // 522 // Create arrays 523 // 524 TArrayD nphot(entries); 525 TArrayD perr(entries); 526 TArrayD ped(entries); 527 TArrayD pedrms(entries); 528 529 // 530 // Loop over all pixels 531 // 532 for (UShort_t i=0; i<entries; i++) 533 { 534 MCerPhotPix *pix = fEvt->GetPixById(i); 535 536 // 537 // Check whether pixel with idx i is blind 538 // 539 if (pix && (*fBadPixels)[i].IsOK()) 540 continue; 541 542 // 543 // Get a pointer to this pixel. If it is not yet existing 544 // create a new entry for this pixel in MCerPhotEvt 545 // 546 if (!pix) 547 { 548 pix = fEvt->AddPixel(i, 0, 0); 549 (*fBadPixels)[i].SetUnsuitable(MBadPixelsPix::kUnsuitableEvt); 550 } 551 552 // 553 // Get the corresponding geometry and pedestal 554 // 555 const MGeomPix &gpix = (*fGeomCam)[i]; 556 const MPedPhotPix &ppix = (*fPedPhot)[i]; 557 558 // Do Not-Use-Central-Pixel 559 const Bool_t nucp = !TESTBIT(fFlags, kUseCentralPixel); 560 561 Int_t num = nucp ? 0 : 1; 562 563 nphot[i] = nucp ? 0 : pix->GetNumPhotons(); 564 ped[i] = nucp ? 0 : ppix.GetMean(); 565 perr[i] = nucp ? 0 : Pow2(pix->GetErrorPhot()); 566 pedrms[i] = nucp ? 0 : Pow2(ppix.GetRms()); 567 568 // 569 // The values are rescaled to the small pixels area for the right comparison 570 // 571 const Double_t ratio = fGeomCam->GetPixRatio(i); 572 573 if (nucp) 574 { 575 nphot[i] *= ratio; 576 perr[i] *= ratio; 577 ped[i] *= ratio; 578 pedrms[i] *= ratio; 579 } 580 581 // 582 // Loop over all its neighbors 583 // 584 const Int_t n = gpix.GetNumNeighbors(); 585 for (int j=0; j<n; j++) 586 { 587 const UShort_t nidx = gpix.GetNeighbor(j); 588 589 // 590 // Do not use blind neighbors 591 // 592 if ((*fBadPixels)[nidx].IsBad()) 593 continue; 594 595 // 596 // Check whether the neighbor has a signal stored 597 // 598 const MCerPhotPix *evtpix = fEvt->GetPixById(nidx); 599 if (!evtpix) 600 continue; 601 602 // 603 // Get the geometry for the neighbor 604 // 605 const Double_t nratio = fGeomCam->GetPixRatio(nidx); 606 MPedPhotPix &nppix = (*fPedPhot)[nidx]; 607 608 // 609 // The error is calculated as the quadratic sum of the errors 610 // 611 nphot[i] += nratio*evtpix->GetNumPhotons(); 612 ped[i] += nratio*nppix.GetMean(); 613 perr[i] += nratio*Pow2(evtpix->GetErrorPhot()); 614 pedrms[i] += nratio*Pow2(nppix.GetRms()); 615 616 num++; 617 } 618 619 if (num<fNumMinNeighbors) 620 { 621 pix->SetPixelUnmapped(); 622 nphot[i] = 0; 623 ped[i] = 0; 624 perr[i] = 0; 625 pedrms[i] = 0; 626 continue; 627 } 628 629 // 630 // Now the mean is calculated and the values rescaled back to the pixel area 631 // 632 nphot[i] /= num*ratio; 633 ped[i] /= num*ratio; 634 perr[i] = TMath::Sqrt(perr[i]/(num*ratio)); 635 pedrms[i] = TMath::Sqrt(pedrms[i]/(num*ratio)); 636 637 } 638 639 // 640 // Now the new pixel values are calculated and can be replaced in 641 // the corresponding containers 642 // 643 for (UShort_t i=0; i<entries; i++) 644 { 645 // 646 // Do not use blind neighbors 647 // 648 if ((*fBadPixels)[i].IsOK()) 649 continue; 650 651 // 652 // It must exist, we have created it in the loop before. 653 // 654 fEvt->GetPixById(i)->Set(nphot[i], perr[i]); 655 (*fPedPhot)[i].Set(ped[i], pedrms[i]); 656 } 657 } 658 */ 485 (*fEvt)[i].SetArrivalTime((time[p0]+time[p1])/2); 486 } 487 } 659 488 660 489 // -------------------------------------------------------------------------- … … 673 502 for (UShort_t i=0; i<entries; i++) 674 503 { 675 MCerPhotPix &pix = (*fEvt)[i]; 676 677 if (IsPixelBad(pix.GetPixId())) 678 pix.SetPixelUnmapped(); 504 if (IsPixelBad(i)) 505 (*fEvt)[i].SetPixelUnmapped(); 679 506 } 680 507 } -
trunk/MagicSoft/Mars/mbadpixels/MBadPixelsTreat.h
r5728 r6858 7 7 8 8 class MGeomCam; 9 class M CerPhotEvt;9 class MSignalCam; 10 10 class MPedPhotCam; 11 class MArrivalTime;12 11 class MBadPixelsCam; 13 12 … … 16 15 private: 17 16 MGeomCam *fGeomCam; //! 18 //MPedPhotCam *fPedPhot; //! 19 MCerPhotEvt *fEvt; //! 20 MArrivalTime *fTimes; //! 17 MSignalCam *fEvt; //! 21 18 MBadPixelsCam *fBadPixels; //! 22 19 … … 26 23 Byte_t fNumMinNeighbors; 27 24 28 //TString fNamePedPhotCam; // name of the 'MPedPhotCam' container29 25 TList fNamePedPhotCams; 30 26
Note:
See TracChangeset
for help on using the changeset viewer.