Changeset 3479
- Timestamp:
- 03/11/04 18:27:42 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r3476 r3479 58 58 - added Print function 59 59 60 60 * mcalib/MCalibrationChargeCam.[h,cc] 61 * mcalib/MCalibrationChargePix.h 62 * mcalib/MCalibrationChargeCalc.cc 63 - removed pointers to MGeomCam and MBadPixelsCam in MCalibrationChargeCam 64 - use two loops over pixels in order to determine mean flux of phe;s to 65 discard pixels far outside the normal distribution 61 66 62 67 2004/03/10: Abelardo Moralejo -
trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCam.cc
r3477 r3479 17 17 ! 18 18 ! Author(s): Thomas Bretz 1/2004 <mailto:tbretz@astro.uni-wuerzburg.de> 19 ! Markus Gaug 3/2004 <mailto:markus@ifae.es> 19 20 ! 20 21 ! Copyright: MAGIC Software Development, 2000-2004 … … 225 226 226 227 if (!(count % 25)) 227 *fLog << endl; 228 } 228 *fLog << endl; 229 } 230 229 231 *fLog << endl; 230 232 *fLog << count << " unreliable pixels :-(" << endl; -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc
r3455 r3479 331 331 } 332 332 333 fCam->SetGeomCam(fGeom);334 fCam->SetBadPixelsCam(fBadPixels);335 336 333 fNumHiGainSamples = fSignals->GetNumUsedHiGainFADCSlices(); 337 334 fNumLoGainSamples = fSignals->GetNumUsedLoGainFADCSlices(); … … 437 434 } 438 435 439 pix.CheckChargeValidity (&bad);440 pix.CheckTimeValidity (&bad);436 pix.CheckChargeValidity (&bad); 437 pix.CheckTimeValidity (&bad); 441 438 442 if (bad.IsUnsuitable Run())439 if (bad.IsUnsuitable(MBadPixelsPix::kUnsuitableRun)) 443 440 continue; 444 441 445 442 nvalid++; 446 443 447 444 if (!pix.CalcReducedSigma()) 448 445 { 449 bad.SetUnsuitable Run();446 bad.SetUnsuitable(MBadPixelsPix::kUnsuitableRun); 450 447 continue; 451 448 } 452 449 453 pix.CalcFFactorMethod(); 454 } 455 450 if (!pix.CalcFFactorMethod()) 451 bad.SetUnsuitable(MBadPixelsPix::kUnsuitableRun); 452 453 } 454 456 455 457 456 … … 525 524 // F-Factor calibration 526 525 // 527 if (fCam->CalcMeanFluxPhotonsFFactorMethod( ))528 { 529 fCam->ApplyFFactorCalibration( );526 if (fCam->CalcMeanFluxPhotonsFFactorMethod(*fGeom, *fBadPixels)) 527 { 528 fCam->ApplyFFactorCalibration(*fGeom,*fBadPixels); 530 529 fCam->SetFFactorMethodValid(kTRUE); 531 530 } … … 536 535 } 537 536 538 539 540 537 // 541 538 // Blind Pixel calibration … … 558 555 { 559 556 fCam->SetBlindPixelMethodValid(kTRUE); 560 fCam->ApplyBlindPixelCalibration( );557 fCam->ApplyBlindPixelCalibration(*fGeom,*fBadPixels); 561 558 } 562 559 } … … 582 579 { 583 580 fCam->SetPINDiodeMethodValid(kTRUE); 584 fCam->ApplyPINDiodeCalibration( );581 fCam->ApplyPINDiodeCalibration(*fGeom,*fBadPixels); 585 582 } 586 583 } -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.cc
r3455 r3479 86 86 // 27: Excluded Pixels 87 87 // 28: Pixels where the fit did not succeed --> results obtained only from the histograms 88 // 29: Pixels with apparently wrong results 89 // 30: Pixels with un-expected behavior in the Hi Gain fourier spectrum (e.g. oscillations) 90 // 31: Pixels with un-expected behavior in the Lo Gain fourier spectrum (e.g. oscillations)a 91 // 32: Number of probable pickup events in the Hi Gain 92 // 33: Number of probable pickup events in the Lo Gain 88 // 29: Number of probable pickup events in the Hi Gain 89 // 30: Number of probable pickup events in the Lo Gain 93 90 // 94 91 // Other classifications of pixels: 95 92 // ================================ 96 93 // 97 // 3 4: Pixels with saturated Hi-Gain94 // 31: Pixels with saturated Hi-Gain 98 95 // 99 96 // Classification of validity of the calibrations: 100 97 // =============================================== 101 98 // 102 // 3 5: Pixels with valid calibration by the F-Factor-Method103 // 3 6: Pixels with valid calibration by the Blind Pixel-Method104 // 3 7: Pixels with valid calibration by the PIN Diode-Method99 // 32: Pixels with valid calibration by the F-Factor-Method 100 // 33: Pixels with valid calibration by the Blind Pixel-Method 101 // 34: Pixels with valid calibration by the PIN Diode-Method 105 102 // 106 103 // Used Pedestals: 107 104 // =============== 108 105 // 109 // 3 8: Mean Pedestal over the entire range of signal extraction110 // 3 9: Error on the Mean Pedestal over the entire range of signal extraction111 // 40: Pedestal RMS over the entire range of signal extraction112 // 41: Error on the Pedestal RMS over the entire range of signal extraction106 // 35: Mean Pedestal over the entire range of signal extraction 107 // 36: Error on the Mean Pedestal over the entire range of signal extraction 108 // 37: Pedestal RMS over the entire range of signal extraction 109 // 38: Error on the Pedestal RMS over the entire range of signal extraction 113 110 // 114 111 // Calculated absolute arrival times (very low precision!): 115 112 // ======================================================== 116 113 // 117 // 42: Absolute Arrival time of the signal118 // 4 3: RMS of the Absolute Arrival time of the signal114 // 39: Absolute Arrival time of the signal 115 // 40: RMS of the Absolute Arrival time of the signal 119 116 // 120 117 ///////////////////////////////////////////////////////////////////////////// … … 145 142 const Float_t MCalibrationChargeCam::gkAverageQEErr = 0.02; 146 143 const Float_t MCalibrationChargeCam::fgConvFFactorRelErrLimit = 0.25; 144 const Float_t MCalibrationChargeCam::fgPheFFactorRelLimit = 5.; 147 145 // -------------------------------------------------------------------------- 148 146 // … … 155 153 // 156 154 MCalibrationChargeCam::MCalibrationChargeCam(const char *name, const char *title) 157 : fBlindPixel(NULL), 158 fPINDiode(NULL), 159 fGeomCam(NULL), 160 fBadPixels(NULL), 161 fOffsets(NULL), 155 : fOffsets(NULL), 162 156 fSlopes(NULL), 163 157 fOffvsSlope(NULL) … … 176 170 SetAverageQE(); 177 171 SetConvFFactorRelErrLimit(); 172 SetPheFFactorRelLimit(); 178 173 } 179 174 … … 316 311 int id = 0; 317 312 318 *fLog << all << " Succesfully calibrated pixels:" << endl;313 *fLog << all << "Calibrated pixels:" << endl; 319 314 *fLog << all << endl; 320 315 … … 324 319 { 325 320 326 if ( (*fBadPixels)[pix->GetPixId()].IsCalibrationResultOK() &&!pix->IsExcluded())321 if (!pix->IsExcluded()) 327 322 { 328 323 329 330 324 *fLog << all << "Pix " << pix->GetPixId() 325 << ": Ped. Rms: " << pix->GetPedRms() << " +- " << pix->GetPedRmsErr() 331 326 << " Mean signal: " << pix->GetMeanCharge() << " +- " << pix->GetSigmaCharge() 332 327 << " Reduced Sigma: " << pix->GetRSigmaCharge() … … 338 333 } 339 334 340 *fLog << all << id << " succesful pixels :-))" << endl;335 *fLog << all << id << " pixels" << endl; 341 336 id = 0; 342 337 343 *fLog << all << endl; 344 *fLog << all << "Pixels with errors:" << endl; 345 *fLog << all << endl; 346 347 TIter Next2(fPixels); 348 while ((pix=(MCalibrationChargePix*)Next2())) 349 { 350 351 if (!pix->IsExcluded() && !(*fBadPixels)[pix->GetPixId()].IsCalibrationResultOK()) 352 { 353 354 355 *fLog << all << "Pix " << pix->GetPixId() 356 << ": Ped. Rms: " << pix->GetPedRms() << " +- " << pix->GetPedRmsErr() 357 << " Mean signal: " << pix->GetMeanCharge() << " +- " << pix->GetSigmaCharge() 358 << " Reduced Sigma: " << pix->GetRSigmaCharge() 359 << " Nr Phe's: " << pix->GetPheFFactorMethod() 360 << " Saturated? :" << pix->IsHiGainSaturation() 361 << endl; 362 id++; 363 } 364 } 365 *fLog << all << id << " pixels with errors :-((" << endl; 366 367 *fLog << all << endl; 368 *fLog << all << "Pixels with oscillations:" << endl; 369 *fLog << all << endl; 370 371 id = 0; 372 373 TIter Next3(fPixels); 374 while ((pix=(MCalibrationChargePix*)Next3())) 375 { 376 377 if ( (*fBadPixels)[pix->GetPixId()].IsCalibrationOscillating() && !pix->IsExcluded()) 378 { 379 380 *fLog << all << "Pix " << pix->GetPixId() 381 << ": Ped. Rms: " << pix->GetPedRms() << " +- " << pix->GetPedRmsErr() 382 << " Mean signal: " << pix->GetMeanCharge() << " +- " << pix->GetSigmaCharge() 383 << " Reduced Sigma: " << pix->GetRSigmaCharge() 384 << " Nr Phe's: " << pix->GetPheFFactorMethod() 385 << " Saturated? :" << pix->IsHiGainSaturation() 386 << endl; 387 id++; 388 } 389 } 390 *fLog << all << id << " Oscillating pixels :-((" << endl; 391 392 338 393 339 *fLog << all << endl; 394 340 *fLog << all << "Excluded pixels:" << endl; … … 408 354 *fLog << all << id << " Excluded pixels " << endl; 409 355 *fLog << endl; 356 410 357 *fLog << all << "Average Inner Pix:" 411 358 << " Ped. Rms: " << fAverageInnerPix->GetPedRms() << " +- " << fAverageInnerPix->GetPedRmsErr() … … 474 421 // 27: Excluded Pixels 475 422 // 28: Pixels where the fit did not succeed --> results obtained only from the histograms 476 // 29: Pixels with apparently wrong results 477 // 30: Pixels with un-expected behavior in the Hi Gain fourier spectrum (e.g. oscillations) 478 // 31: Pixels with un-expected behavior in the Lo Gain fourier spectrum (e.g. oscillations)a 479 // 32: Number of probable pickup events in the Hi Gain 480 // 33: Number of probable pickup events in the Lo Gain 423 // 29: Number of probable pickup events in the Hi Gain 424 // 30: Number of probable pickup events in the Lo Gain 481 425 // 482 426 // Other classifications of pixels: 483 427 // ================================ 484 428 // 485 // 3 4: Pixels with saturated Hi-Gain429 // 31: Pixels with saturated Hi-Gain 486 430 // 487 431 // Classification of validity of the calibrations: 488 432 // =============================================== 489 433 // 490 // 3 5: Pixels with valid calibration by the F-Factor-Method491 // 3 6: Pixels with valid calibration by the Blind Pixel-Method492 // 3 7: Pixels with valid calibration by the PIN Diode-Method434 // 32: Pixels with valid calibration by the F-Factor-Method 435 // 33: Pixels with valid calibration by the Blind Pixel-Method 436 // 34: Pixels with valid calibration by the PIN Diode-Method 493 437 // 494 438 // Used Pedestals: 495 439 // =============== 496 440 // 497 // 3 8: Mean Pedestal over the entire range of signal extraction498 // 3 9: Error on the Mean Pedestal over the entire range of signal extraction499 // 40: Pedestal RMS over the entire range of signal extraction500 // 41: Error on the Pedestal RMS over the entire range of signal extraction441 // 35: Mean Pedestal over the entire range of signal extraction 442 // 36: Error on the Mean Pedestal over the entire range of signal extraction 443 // 37: Pedestal RMS over the entire range of signal extraction 444 // 38: Error on the Pedestal RMS over the entire range of signal extraction 501 445 // 502 446 // Calculated absolute arrival times (very low precision!): 503 447 // ======================================================== 504 448 // 505 // 42: Absolute Arrival time of the signal506 // 4 3: RMS of the Absolute Arrival time of the signal449 // 39: Absolute Arrival time of the signal 450 // 40: RMS of the Absolute Arrival time of the signal 507 451 // 508 452 Bool_t MCalibrationChargeCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const … … 540 484 break; 541 485 case 4: 542 if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK())486 if ((*this)[idx].IsExcluded()) 543 487 return kFALSE; 544 488 val = (*this)[idx].GetChargeProb(); 545 489 break; 546 490 case 5: 547 if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK())491 if ((*this)[idx].IsExcluded()) 548 492 return kFALSE; 549 493 if ((*this)[idx].GetRSigmaCharge() == -1.) … … 552 496 break; 553 497 case 6: 554 if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK())498 if ((*this)[idx].IsExcluded()) 555 499 return kFALSE; 556 500 if ((*this)[idx].GetRSigmaCharge() == -1.) … … 559 503 break; 560 504 case 7: 561 if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK())505 if ((*this)[idx].IsExcluded()) 562 506 return kFALSE; 563 507 if ((*this)[idx].GetRSigmaCharge() == -1.) … … 566 510 break; 567 511 case 8: 568 if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK())512 if ((*this)[idx].IsExcluded()) 569 513 return kFALSE; 570 514 if ((*this)[idx].GetRSigmaCharge() == -1.) … … 582 526 break; 583 527 case 9: 584 if ((*this)[idx].IsExcluded() 585 || !(*fBadPixels)[idx].IsCalibrationSignalOK() 586 || !(*this)[idx].IsFFactorMethodValid()) 528 if ((*this)[idx].IsExcluded() || !(*this)[idx].IsFFactorMethodValid()) 587 529 return kFALSE; 588 530 val = (*this)[idx].GetPheFFactorMethod(); 589 531 break; 590 532 case 10: 591 if ((*this)[idx].IsExcluded() 592 || !(*fBadPixels)[idx].IsCalibrationSignalOK() 593 || !(*this)[idx].IsFFactorMethodValid()) 533 if ((*this)[idx].IsExcluded() || !(*this)[idx].IsFFactorMethodValid()) 594 534 return kFALSE; 595 535 val = (*this)[idx].GetPheFFactorMethodErr(); 596 536 break; 597 537 case 11: 598 if ((*this)[idx].IsExcluded() 599 || !(*fBadPixels)[idx].IsCalibrationSignalOK() 600 || !(*this)[idx].IsFFactorMethodValid()) 538 if ((*this)[idx].IsExcluded() || !(*this)[idx].IsFFactorMethodValid()) 601 539 return kFALSE; 602 540 val = (*this)[idx].GetMeanConversionFFactorMethod(); 603 541 break; 604 542 case 12: 605 if ((*this)[idx].IsExcluded() 606 || !(*fBadPixels)[idx].IsCalibrationSignalOK() 607 || !(*this)[idx].IsFFactorMethodValid()) 543 if ((*this)[idx].IsExcluded() || !(*this)[idx].IsFFactorMethodValid()) 608 544 return kFALSE; 609 545 val = (*this)[idx].GetConversionFFactorMethodErr(); 610 546 break; 611 547 case 13: 612 if ((*this)[idx].IsExcluded() 613 || !(*fBadPixels)[idx].IsCalibrationSignalOK() 614 || !(*this)[idx].IsFFactorMethodValid()) 548 if ((*this)[idx].IsExcluded() || !(*this)[idx].IsFFactorMethodValid()) 615 549 return kFALSE; 616 550 val = (*this)[idx].GetTotalFFactorFFactorMethod(); 617 551 break; 618 552 case 14: 619 if ((*this)[idx].IsExcluded() 620 || !(*fBadPixels)[idx].IsCalibrationSignalOK() 621 || !(*this)[idx].IsFFactorMethodValid()) 553 if ((*this)[idx].IsExcluded() || !(*this)[idx].IsFFactorMethodValid()) 622 554 return kFALSE; 623 555 val = (*this)[idx].GetTotalFFactorErrFFactorMethod(); 624 556 break; 625 557 case 15: 626 if ((*this)[idx].IsExcluded() 627 || !(*fBadPixels)[idx].IsCalibrationSignalOK() 628 || !(*this)[idx].IsBlindPixelMethodValid()) 558 if ((*this)[idx].IsExcluded() || !(*this)[idx].IsBlindPixelMethodValid()) 629 559 return kFALSE; 630 560 val = fBlindPixel->GetMeanFluxInsidePlexiglass()*area; 631 561 break; 632 562 case 16: 633 if ((*this)[idx].IsExcluded() 634 || !(*fBadPixels)[idx].IsCalibrationSignalOK() 635 || !(*this)[idx].IsBlindPixelMethodValid()) 563 if ((*this)[idx].IsExcluded() || !(*this)[idx].IsBlindPixelMethodValid()) 636 564 return kFALSE; 637 565 val = fBlindPixel->GetMeanFluxErrInsidePlexiglass()*area; 638 566 break; 639 567 case 17: 640 if ((*this)[idx].IsExcluded() 641 || !(*fBadPixels)[idx].IsCalibrationSignalOK() 642 || !(*this)[idx].IsBlindPixelMethodValid()) 568 if ((*this)[idx].IsExcluded() || !(*this)[idx].IsBlindPixelMethodValid()) 643 569 return kFALSE; 644 570 val = (*this)[idx].GetMeanConversionBlindPixelMethod(); 645 571 break; 646 572 case 18: 647 if ((*this)[idx].IsExcluded() 648 || !(*fBadPixels)[idx].IsCalibrationSignalOK() 649 || !(*this)[idx].IsBlindPixelMethodValid()) 573 if ((*this)[idx].IsExcluded() || !(*this)[idx].IsBlindPixelMethodValid()) 650 574 return kFALSE; 651 575 val = (*this)[idx].GetConversionBlindPixelMethodErr(); 652 576 break; 653 577 case 19: 654 if ((*this)[idx].IsExcluded() 655 || !(*fBadPixels)[idx].IsCalibrationSignalOK() 656 || !(*this)[idx].IsBlindPixelMethodValid()) 578 if ((*this)[idx].IsExcluded() || !(*this)[idx].IsBlindPixelMethodValid()) 657 579 return kFALSE; 658 580 val = (*this)[idx].GetTotalFFactorBlindPixelMethod(); 659 581 break; 660 582 case 20: 661 if ((*this)[idx].IsExcluded() 662 || !(*fBadPixels)[idx].IsCalibrationSignalOK() 663 || !(*this)[idx].IsBlindPixelMethodValid()) 583 if ((*this)[idx].IsExcluded() || !(*this)[idx].IsBlindPixelMethodValid()) 664 584 return kFALSE; 665 585 val = (*this)[idx].GetTotalFFactorErrBlindPixelMethod(); 666 586 break; 667 587 case 21: 668 if ((*this)[idx].IsExcluded() 669 || !(*fBadPixels)[idx].IsCalibrationSignalOK() 670 || !(*this)[idx].IsPINDiodeMethodValid()) 588 if ((*this)[idx].IsExcluded() || !(*this)[idx].IsPINDiodeMethodValid()) 671 589 return kFALSE; 672 590 val = fPINDiode->GetMeanFluxOutsidePlexiglass()*area; 673 591 break; 674 592 case 22: 675 if ((*this)[idx].IsExcluded() 676 || !(*fBadPixels)[idx].IsCalibrationSignalOK() 677 || !(*this)[idx].IsPINDiodeMethodValid()) 593 if ((*this)[idx].IsExcluded() || !(*this)[idx].IsPINDiodeMethodValid()) 678 594 return kFALSE; 679 595 val = fPINDiode->GetMeanFluxErrOutsidePlexiglass()*area; 680 596 break; 681 597 case 23: 682 if ((*this)[idx].IsExcluded() 683 || !(*fBadPixels)[idx].IsCalibrationSignalOK() 684 || !(*this)[idx].IsPINDiodeMethodValid()) 598 if ((*this)[idx].IsExcluded() || !(*this)[idx].IsPINDiodeMethodValid()) 685 599 return kFALSE; 686 600 val = (*this)[idx].GetMeanConversionPINDiodeMethod(); 687 601 break; 688 602 case 24: 689 if ((*this)[idx].IsExcluded() 690 || !(*fBadPixels)[idx].IsCalibrationSignalOK() 691 || !(*this)[idx].IsPINDiodeMethodValid()) 603 if ((*this)[idx].IsExcluded() || !(*this)[idx].IsPINDiodeMethodValid()) 692 604 return kFALSE; 693 605 val = (*this)[idx].GetConversionPINDiodeMethodErr(); 694 606 break; 695 607 case 25: 696 if ((*this)[idx].IsExcluded() 697 || !(*fBadPixels)[idx].IsCalibrationSignalOK() 698 || !(*this)[idx].IsPINDiodeMethodValid()) 608 if ((*this)[idx].IsExcluded() || !(*this)[idx].IsPINDiodeMethodValid()) 699 609 return kFALSE; 700 610 val = (*this)[idx].GetTotalFFactorPINDiodeMethod(); 701 611 break; 702 612 case 26: 703 if ((*this)[idx].IsExcluded() 704 || !(*fBadPixels)[idx].IsCalibrationSignalOK() 705 || !(*this)[idx].IsPINDiodeMethodValid()) 613 if ((*this)[idx].IsExcluded() || !(*this)[idx].IsPINDiodeMethodValid()) 706 614 return kFALSE; 707 615 val = (*this)[idx].GetTotalFFactorErrPINDiodeMethod(); … … 724 632 if ((*this)[idx].IsExcluded()) 725 633 return kFALSE; 726 if (!(*fBadPixels)[idx].IsCalibrationSignalOK()) 727 val = 1; 728 else 729 return kFALSE; 634 val = (*this)[idx].GetHiGainNumPickup(); 730 635 break; 731 636 case 30: 732 637 if ((*this)[idx].IsExcluded()) 733 638 return kFALSE; 734 if ((*fBadPixels)[idx].IsCalibrationOscillating()) 735 val = 1; 736 else 737 return kFALSE; 639 val = (*this)[idx].GetLoGainNumPickup(); 738 640 break; 739 641 case 31: 740 642 if ((*this)[idx].IsExcluded()) 741 643 return kFALSE; 742 if ((*fBadPixels)[idx].IsCalibrationOscillating()) 743 val = 1; 744 else 745 return kFALSE; 644 val = (*this)[idx].IsHiGainSaturation(); 746 645 break; 747 646 case 32: 748 if ((*this)[idx].IsExcluded())749 return kFALSE;750 val = (*this)[idx].GetHiGainNumPickup();751 break;752 case 33:753 if ((*this)[idx].IsExcluded())754 return kFALSE;755 val = (*this)[idx].GetLoGainNumPickup();756 break;757 case 34:758 if ((*this)[idx].IsExcluded())759 return kFALSE;760 val = (*this)[idx].IsHiGainSaturation();761 break;762 case 35:763 647 if ((*this)[idx].IsExcluded()) 764 648 return kFALSE; … … 768 652 return kFALSE; 769 653 break; 770 case 3 6:654 case 33: 771 655 if ((*this)[idx].IsExcluded()) 772 656 return kFALSE; … … 776 660 return kFALSE; 777 661 break; 778 case 3 7:662 case 34: 779 663 if ((*this)[idx].IsExcluded()) 780 664 return kFALSE; … … 784 668 return kFALSE; 785 669 break; 670 case 35: 671 if ((*this)[idx].IsExcluded()) 672 return kFALSE; 673 val = (*this)[idx].GetPed(); 674 break; 675 case 36: 676 if ((*this)[idx].IsExcluded()) 677 return kFALSE; 678 val = (*this)[idx].GetPedErr(); 679 break; 680 case 37: 681 if ((*this)[idx].IsExcluded()) 682 return kFALSE; 683 val = (*this)[idx].GetPedRms(); 684 break; 786 685 case 38: 787 686 if ((*this)[idx].IsExcluded()) 788 687 return kFALSE; 789 val = (*this)[idx].GetPed ();688 val = (*this)[idx].GetPedErr()/2.; 790 689 break; 791 690 case 39: 792 691 if ((*this)[idx].IsExcluded()) 793 692 return kFALSE; 794 val = (*this)[idx].Get PedErr();693 val = (*this)[idx].GetAbsTimeMean(); 795 694 break; 796 695 case 40: 797 696 if ((*this)[idx].IsExcluded()) 798 return kFALSE;799 val = (*this)[idx].GetPedRms();800 break;801 case 41:802 if ((*this)[idx].IsExcluded())803 return kFALSE;804 val = (*this)[idx].GetPedErr()/2.;805 break;806 case 42:807 if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK())808 return kFALSE;809 val = (*this)[idx].GetAbsTimeMean();810 break;811 case 43:812 if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK())813 697 return kFALSE; 814 698 val = (*this)[idx].GetAbsTimeRms(); … … 817 701 return kFALSE; 818 702 } 703 819 704 return val!=-1.; 705 820 706 } 821 707 … … 836 722 // 837 723 // Calculate the weighted mean of the phe's of all inner and outer pixels, respectively. 838 // Bad pixels are excluded from the calculation. 839 // 840 Bool_t MCalibrationChargeCam::CalcMeanFluxPhotonsFFactorMethod() 724 // Bad pixels are excluded from the calculation. Two loops are performed to exclude pixels 725 // which are fPheFFactorRelLimit sigmas from the mean. 726 // 727 Bool_t MCalibrationChargeCam::CalcMeanFluxPhotonsFFactorMethod(const MGeomCam &geom, const MBadPixelsCam &bad) 841 728 { 842 729 … … 848 735 Float_t sumweightsouter = 0.; 849 736 Float_t sumphesouter = 0.; 737 Int_t validinner = 0; 738 Int_t validouter = 0; 739 850 740 851 741 TIter Next(fPixels); … … 859 749 const Int_t idx = pix->GetPixId(); 860 750 861 if(! (*fBadPixels)[idx].IsCalibrationResultOK())751 if(!bad[idx].IsCalibrationResultOK()) 862 752 continue; 863 753 864 754 const Float_t nphe = pix->GetPheFFactorMethod(); 865 755 const Float_t npheerr = pix->GetPheFFactorMethodErr(); 866 const Float_t ratio = fGeomCam->GetPixRatio(idx);756 const Float_t ratio = geom.GetPixRatio(idx); 867 757 868 758 if (npheerr > 0.) … … 876 766 sumweightsinner += weight; 877 767 sumphesinner += weight*nphe; 768 validinner++; 878 769 } 879 770 else … … 885 776 sumweightsouter += weight; 886 777 sumphesouter += weight*nphe; 778 validouter++; 887 779 } 888 780 } /* if npheerr != 0 */ 889 781 } /* while ((pix=(MCalibrationChargePix*)Next())) */ 890 782 891 783 if (sumweightsinner <= 0. || sumphesinner <= 0.) 892 784 { … … 914 806 } 915 807 916 917 const Float_t meanFluxPhotonsRelErrSquare = fMeanFluxPhesInnerPixelErr * fMeanFluxPhesInnerPixelErr 918 / (fMeanFluxPhesInnerPixel * fMeanFluxPhesInnerPixel); 808 Float_t meanFluxPhotonsRelErrSquare = fMeanFluxPhesInnerPixelErr * fMeanFluxPhesInnerPixelErr 809 / (fMeanFluxPhesInnerPixel * fMeanFluxPhesInnerPixel); 810 811 fMeanFluxPhotonsInnerPixel = fMeanFluxPhesInnerPixel/fAverageQE; 812 fMeanFluxPhotonsInnerPixelErr = TMath::Sqrt(meanFluxPhotonsRelErrSquare + avQERelErrSquare) 813 * fMeanFluxPhotonsInnerPixel; 814 815 fMeanFluxPhotonsOuterPixel = 4.*fMeanFluxPhotonsInnerPixel; 816 fMeanFluxPhotonsOuterPixelErr = 4.*fMeanFluxPhotonsInnerPixelErr; 817 818 // 819 // Here starts the second loop discarting pixels out of the range: 820 // 821 const Float_t innererr = TMath::Sqrt((Float_t)validinner)*fPheFFactorRelLimit*fMeanFluxPhesInnerPixelErr; 822 const Float_t outererr = TMath::Sqrt((Float_t)validouter)*fPheFFactorRelLimit*fMeanFluxPhesOuterPixelErr; 823 824 const Float_t lowerpheinnerlimit = fMeanFluxPhesInnerPixel - innererr; 825 const Float_t upperpheinnerlimit = fMeanFluxPhesInnerPixel + innererr; 826 827 const Float_t lowerpheouterlimit = fMeanFluxPhesOuterPixel - outererr; 828 const Float_t upperpheouterlimit = fMeanFluxPhesOuterPixel + outererr; 829 830 sumweightsinner = 0.; 831 sumphesinner = 0.; 832 sumweightsouter = 0.; 833 sumphesouter = 0.; 834 835 TIter Next2(fPixels); 836 MCalibrationChargePix *pix2; 837 while ((pix2=(MCalibrationChargePix*)Next2())) 838 { 839 840 if (!pix2->IsFFactorMethodValid()) 841 continue; 842 843 const Int_t idx = pix2->GetPixId(); 844 845 if(!bad[idx].IsCalibrationResultOK()) 846 continue; 847 848 const Float_t nphe = pix2->GetPheFFactorMethod(); 849 const Float_t npheerr = pix2->GetPheFFactorMethodErr(); 850 const Float_t ratio = geom.GetPixRatio(idx); 851 852 if (npheerr > 0.) 853 { 854 // 855 // first the inner pixels: 856 // 857 if (ratio == 1.) 858 { 859 860 if (nphe < lowerpheinnerlimit || nphe > upperpheinnerlimit) 861 { 862 pix2->SetFFactorMethodValid(kFALSE); 863 continue; 864 } 865 866 const Float_t weight = 1./npheerr/npheerr; 867 sumweightsinner += weight; 868 sumphesinner += weight*nphe; 869 } 870 else 871 { 872 // 873 // now the outers 874 // 875 if (nphe < lowerpheouterlimit || nphe > upperpheouterlimit) 876 { 877 pix2->SetFFactorMethodValid(kFALSE); 878 continue; 879 } 880 881 const Float_t weight = 1./npheerr/npheerr; 882 sumweightsouter += weight; 883 sumphesouter += weight*nphe; 884 } 885 } /* if npheerr != 0 */ 886 } /* while ((pix2=(MCalibrationChargePix*)Next2())) */ 887 888 if (sumweightsinner <= 0. || sumphesinner <= 0.) 889 { 890 *fLog << warn << " Mean number of phe's from inner pixels cannot be calculated: " 891 << " Sum of weights: " << sumweightsinner 892 << " Sum of weighted phes: " << sumphesinner << endl; 893 return kFALSE; 894 } 895 else 896 { 897 fMeanFluxPhesInnerPixel = sumphesinner/sumweightsinner; 898 fMeanFluxPhesInnerPixelErr = TMath::Sqrt(1./sumweightsinner); 899 900 } 901 902 if (sumweightsouter <= 0. || sumphesouter <= 0.) 903 { 904 *fLog << warn << " Mean number of phe's from outer pixels cannot be calculated: " 905 << " Sum of weights or sum of weighted phes is 0. " << endl; 906 } 907 else 908 { 909 fMeanFluxPhesOuterPixel = sumphesouter/sumweightsouter; 910 fMeanFluxPhesOuterPixelErr = TMath::Sqrt(1./sumweightsouter); 911 } 912 913 meanFluxPhotonsRelErrSquare = fMeanFluxPhesInnerPixelErr * fMeanFluxPhesInnerPixelErr 914 / (fMeanFluxPhesInnerPixel * fMeanFluxPhesInnerPixel); 919 915 920 916 fMeanFluxPhotonsInnerPixel = fMeanFluxPhesInnerPixel/fAverageQE; … … 931 927 << fMeanFluxPhotonsInnerPixel << " +- " << fMeanFluxPhotonsInnerPixelErr << endl; 932 928 933 934 935 929 return kTRUE; 936 930 } 937 931 938 void MCalibrationChargeCam::ApplyFFactorCalibration( )932 void MCalibrationChargeCam::ApplyFFactorCalibration(const MGeomCam &geom, const MBadPixelsCam &bad) 939 933 { 940 934 … … 947 941 { 948 942 949 if (!pix->IsFFactorMethodValid()) 943 const Int_t idx = pix->GetPixId(); 944 945 if (!(bad[idx].IsCalibrationResultOK())) 946 { 947 pix->SetFFactorMethodValid(kFALSE); 948 continue; 949 } 950 951 if (!(pix->IsFFactorMethodValid())) 950 952 continue; 951 953 952 const Int_t idx = pix->GetPixId(); 953 954 if(!(*fBadPixels)[idx].IsCalibrationResultOK()) 955 continue; 956 957 const Float_t ratio = fGeomCam->GetPixRatio(idx); 954 const Float_t ratio = geom.GetPixRatio(idx); 958 955 // 959 956 // Calculate the conversion factor between PHOTONS and FADC counts … … 1016 1013 1017 1014 1018 void MCalibrationChargeCam::ApplyBlindPixelCalibration( )1015 void MCalibrationChargeCam::ApplyBlindPixelCalibration(const MGeomCam &geom, const MBadPixelsCam &bad) 1019 1016 { 1020 1017 … … 1027 1024 { 1028 1025 1029 if((*fBadPixels)[pix->GetPixId()].IsCalibrationResultOK()) 1026 const Int_t idx = pix->GetPixId(); 1027 1028 if (!(bad[idx].IsCalibrationResultOK())) 1030 1029 { 1031 1032 const Int_t idx = pix->GetPixId(); 1033 1034 const Float_t charge = pix->GetMeanCharge(); 1035 const Float_t area = (*fGeomCam)[idx].GetA(); 1036 const Float_t chargeerr = pix->GetMeanChargeErr(); 1037 1038 const Float_t nphot = flux * area; 1039 const Float_t nphoterr = fluxerr * area; 1040 const Float_t conversion = nphot/charge; 1041 Float_t conversionerr; 1042 1043 conversionerr = nphoterr/charge 1044 * nphoterr/charge ; 1045 conversionerr += chargeerr/charge 1046 * chargeerr/charge 1047 * conversion*conversion; 1048 conversionerr = TMath::Sqrt(conversionerr); 1049 1050 const Float_t conversionsigma = 0.; 1051 1052 pix->SetConversionBlindPixelMethod(conversion, conversionerr, conversionsigma); 1053 1054 if (conversionerr/conversion < 0.1) 1055 pix->SetBlindPixelMethodValid(); 1030 pix->SetBlindPixelMethodValid(kFALSE); 1031 continue; 1056 1032 } 1057 } 1058 } 1059 1060 1061 void MCalibrationChargeCam::ApplyPINDiodeCalibration() 1033 1034 const Float_t charge = pix->GetMeanCharge(); 1035 const Float_t area = geom[idx].GetA(); 1036 const Float_t chargeerr = pix->GetMeanChargeErr(); 1037 1038 const Float_t nphot = flux * area; 1039 const Float_t nphoterr = fluxerr * area; 1040 const Float_t conversion = nphot/charge; 1041 Float_t conversionerr; 1042 1043 conversionerr = nphoterr/charge 1044 * nphoterr/charge ; 1045 conversionerr += chargeerr/charge 1046 * chargeerr/charge 1047 * conversion*conversion; 1048 conversionerr = TMath::Sqrt(conversionerr); 1049 1050 const Float_t conversionsigma = 0.; 1051 1052 pix->SetConversionBlindPixelMethod(conversion, conversionerr, conversionsigma); 1053 1054 if (conversionerr/conversion < 0.1) 1055 pix->SetBlindPixelMethodValid(); 1056 } 1057 } 1058 1059 void MCalibrationChargeCam::ApplyPINDiodeCalibration(const MGeomCam &geom, const MBadPixelsCam &bad) 1062 1060 { 1063 1061 … … 1070 1068 { 1071 1069 1072 if((*fBadPixels)[pix->GetPixId()].IsCalibrationResultOK()) 1070 const Int_t idx = pix->GetPixId(); 1071 1072 if (!(bad[idx].IsCalibrationResultOK())) 1073 1073 { 1074 1075 const Int_t idx = pix->GetPixId(); 1076 1077 const Float_t charge = pix->GetMeanCharge(); 1078 const Float_t area = (*fGeomCam)[idx].GetA(); 1079 const Float_t chargeerr = pix->GetMeanChargeErr(); 1080 1081 const Float_t nphot = flux * area; 1082 const Float_t nphoterr = fluxerr * area; 1083 const Float_t conversion = nphot/charge; 1084 1085 Float_t conversionerr; 1086 1087 conversionerr = nphoterr/charge 1088 * nphoterr/charge ; 1089 conversionerr += chargeerr/charge 1090 * chargeerr/charge 1091 * conversion*conversion; 1092 if (conversionerr > 0.) 1093 conversionerr = TMath::Sqrt(conversionerr); 1094 1095 const Float_t conversionsigma = 0.; 1096 1097 pix->SetConversionPINDiodeMethod(conversion, conversionerr, conversionsigma); 1098 1099 if (conversionerr/conversion < 0.1) 1100 pix->SetPINDiodeMethodValid(); 1101 1074 pix->SetPINDiodeMethodValid(kFALSE); 1075 continue; 1102 1076 } 1103 } 1104 } 1105 1077 1078 const Float_t charge = pix->GetMeanCharge(); 1079 const Float_t area = geom[idx].GetA(); 1080 const Float_t chargeerr = pix->GetMeanChargeErr(); 1081 1082 const Float_t nphot = flux * area; 1083 const Float_t nphoterr = fluxerr * area; 1084 const Float_t conversion = nphot/charge; 1085 1086 Float_t conversionerr; 1087 1088 conversionerr = nphoterr/charge 1089 * nphoterr/charge ; 1090 conversionerr += chargeerr/charge 1091 * chargeerr/charge 1092 * conversion*conversion; 1093 if (conversionerr > 0.) 1094 conversionerr = TMath::Sqrt(conversionerr); 1095 1096 const Float_t conversionsigma = 0.; 1097 1098 pix->SetConversionPINDiodeMethod(conversion, conversionerr, conversionsigma); 1099 1100 if (conversionerr/conversion < 0.1) 1101 pix->SetPINDiodeMethodValid(); 1102 1103 } 1104 } 1106 1105 1107 1106 -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.h
r3455 r3479 26 26 27 27 static const Float_t fgConvFFactorRelErrLimit; // The limit for acceptance of the rel. error of the conversion factor with the FFactor method 28 29 Float_t fAverageQE; // The average quantum efficieny (see Class description) 30 Float_t fAverageQEErr; // The error of the average quantum efficieny (see Class description) 28 static const Float_t fgPheFFactorRelLimit; // The rel. limit for acceptance of a calculated number of phe's w.r.t the mean number (in sigma of the error) 31 29 32 Float_t fConvFFactorRelErrLimit; // The limit for acceptance of the rel. error of the conversion factor with the FFactor method 33 30 Float_t fAverageQE; // The average quantum efficieny (see Class description) 31 Float_t fAverageQEErr; // The error of the average quantum efficieny (see Class description) 32 33 Float_t fConvFFactorRelErrLimit; // The limit for acceptance of the rel. error of the conversion factor with the FFactor method 34 Float_t fPheFFactorRelLimit; // The rel. limit for acceptance of a calculated number of phe's w.r.t the mean number (in sigma of the error). 35 34 36 Int_t fNumPixels; 35 37 TClonesArray *fPixels; //-> Array of MCalibrationPix with fit results 38 36 39 MCalibrationChargePix *fAverageInnerPix; //-> Average Pixel of all events 37 40 MCalibrationChargePix *fAverageOuterPix; //-> Average Pixel of all events … … 42 45 const MCalibrationChargeBlindPix *fBlindPixel; //! Pointer to the Blind Pixel with fit results 43 46 const MCalibrationChargePINDiode *fPINDiode; //! Pointer to the PIN Diode with fit results 44 45 const MGeomCam *fGeomCam; //! Need geom cam to know which pixel in inner or outer46 const MBadPixelsCam *fBadPixels; //! Bad Pixels cam, only for reading47 47 48 48 TH1D* fOffsets; //! … … 79 79 const Float_t err=gkAverageQEErr) { fAverageQE = qe; 80 80 fAverageQEErr = err; } 81 void SetNumPixelsExcluded( const UInt_t n ) { fNumExcludedPixels = n; } 81 82 void SetConvFFactorRelErrLimit( const Float_t f=fgConvFFactorRelErrLimit ) { fConvFFactorRelErrLimit = f; } 82 void SetNumPixelsExcluded( const UInt_t n ) { fNumExcludedPixels = n; } 83 void SetGeomCam( const MGeomCam *geom) { fGeomCam = geom; } 84 void SetBadPixelsCam( const MBadPixelsCam *bad) { fBadPixels = bad; } 83 void SetPheFFactorRelLimit ( const Float_t f=fgPheFFactorRelLimit ) { fPheFFactorRelLimit = f; } 85 84 86 85 void SetPINDiode ( const MCalibrationChargePINDiode *d ) { fPINDiode = d; } … … 139 138 Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const; 140 139 141 Bool_t CalcMeanFluxPhotonsFFactorMethod( );140 Bool_t CalcMeanFluxPhotonsFFactorMethod(const MGeomCam &geom, const MBadPixelsCam &bad); 142 141 143 void ApplyPINDiodeCalibration( );144 void ApplyBlindPixelCalibration( );145 void ApplyFFactorCalibration( );142 void ApplyPINDiodeCalibration(const MGeomCam &geom, const MBadPixelsCam &bad); 143 void ApplyBlindPixelCalibration(const MGeomCam &geom, const MBadPixelsCam &bad); 144 void ApplyFFactorCalibration(const MGeomCam &geom, const MBadPixelsCam &bad); 146 145 147 146 ClassDef(MCalibrationChargeCam, 1) // Container for calibration information of the camera -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargePix.cc
r3476 r3479 668 668 const Float_t chargeSquareRelErrSquare = 4.* GetMeanChargeErr() * GetMeanChargeErr() / chargeSquare; 669 669 670 const Float_t chargeRelErrSquare = GetMeanChargeErr() * GetMeanChargeErr()671 / (GetMeanCharge() * GetMeanCharge());672 673 670 const Float_t ffactorsquare = gkFFactor * gkFFactor; 674 671 const Float_t ffactorsquareRelErrSquare = 4.*gkFFactorErr * gkFFactorErr / ffactorsquare; … … 703 700 return kTRUE; 704 701 } 705 706 702 707 703
Note:
See TracChangeset
for help on using the changeset viewer.