Changeset 3029 for trunk/MagicSoft/Mars/mcalib/MCalibrationCalc.cc
- Timestamp:
- 02/05/04 17:28:52 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mcalib/MCalibrationCalc.cc
r3019 r3029 68 68 // fits) 69 69 // 70 // Hi-Gain vs. Lo-Gain Calibration (very memory-intensive) 71 // can be skipped with the command: 72 // MalibrationCam::SkipHiLoGainCalibration() 73 // 70 74 // Input Containers: 71 75 // MRawEvtData … … 116 120 const Int_t MCalibrationCalc::fBlindPixelId = 559; 117 121 const Int_t MCalibrationCalc::fPINDiodeId = 9999; 122 const Byte_t MCalibrationCalc::fgSaturationLimit = 254; 123 const Byte_t MCalibrationCalc::fgBlindPixelFirst = 3; 124 const Byte_t MCalibrationCalc::fgBlindPixelLast = 12; 118 125 119 126 // -------------------------------------------------------------------------- … … 144 151 SETBIT(fFlags, kUseCosmicsRejection); 145 152 SETBIT(fFlags, kUseQualityChecks); 153 SETBIT(fFlags, kHiLoGainCalibration); 146 154 147 155 CLRBIT(fFlags, kBlindPixelOverFlow); … … 496 504 } 497 505 } 498 } 506 } /* if Use Times */ 499 507 500 508 switch(pixid) … … 502 510 503 511 case fBlindPixelId: 504 505 if (!blindpixel.FillCharge(sumhi)) 506 *fLog << warn << 507 "Overflow or Underflow occurred filling Blind Pixel sum = " << sumhi << endl; 508 509 if (TESTBIT(fFlags,kUseTimes)) 512 513 if (TESTBIT(fFlags,kUseBlindPixelFit)) 510 514 { 511 if (!blindpixel.FillTime(reltime)) 515 516 Float_t blindpixelsum = 0.; 517 // 518 // We need a dedicated signal extractor for the blind pixel 519 // 520 MPedestalPix &ped = (*fPedestals)[pixid]; 521 if (!CalcSignalBlindPixel(pixel.GetHiGainSamples(), blindpixelsum, ped.GetPedestal())) 522 return kFALSE; 523 524 if (!blindpixel.FillCharge(blindpixelsum)) 512 525 *fLog << warn << 513 "Overflow or Underflow occurred filling Blind Pixel time = " << reltime << endl; 514 } 515 516 if (!TESTBIT(fFlags,kBlindPixelOverFlow)) 517 if (!blindpixel.FillRChargevsTime(sumhi,fEvents)) 518 { 526 "Overflow or Underflow occurred filling Blind Pixel sum = " << blindpixelsum << endl; 527 528 if (TESTBIT(fFlags,kUseTimes)) 529 { 530 if (!blindpixel.FillTime(reltime)) 531 *fLog << warn << 532 "Overflow or Underflow occurred filling Blind Pixel time = " << reltime << endl; 533 } 534 535 if (!TESTBIT(fFlags,kBlindPixelOverFlow)) 536 if (!blindpixel.FillRChargevsTime(blindpixelsum,fEvents)) 537 { 538 *fLog << warn << 539 "Overflow or Underflow occurred filling Blind Pixel eventnr = " << fEvents << endl; 540 SETBIT(fFlags,kBlindPixelOverFlow); 541 } 542 } /* if use blind pixel */ 543 544 break; 545 546 case fPINDiodeId: 547 548 if (TESTBIT(fFlags,kUsePinDiodeFit)) 549 { 550 551 if (!pindiode.FillCharge(sumhi)) 519 552 *fLog << warn << 520 "Overflow or Underflow occurred filling Blind Pixel eventnr = " << fEvents << endl; 521 SETBIT(fFlags,kBlindPixelOverFlow); 522 } 553 "Overflow or Underflow occurred filling PINDiode: sum = " << sumhi << endl; 554 555 if (TESTBIT(fFlags,kUseTimes)) 556 { 557 if (!pindiode.FillAbsTime(abstime)) 558 *fLog << warn << 559 "Overflow or Underflow occurred filling PINDiode abs. time = " << abstime << endl; 560 if (!pindiode.FillRelTime(reltime)) 561 *fLog << warn << 562 "Overflow or Underflow occurred filling PINDiode rel. time = " << reltime << endl; 563 } 564 565 if (!TESTBIT(fFlags,kPINDiodeOverFlow)) 566 if (!pindiode.FillRChargevsTime(sumhi,fEvents)) 567 { 568 *fLog << warn 569 << "Overflow or Underflow occurred filling PINDiode: eventnr = " 570 << fEvents << endl; 571 SETBIT(fFlags,kPINDiodeOverFlow); 572 } 573 574 } /* if use PIN Diode */ 523 575 524 576 break; 525 526 case fPINDiodeId: 527 528 if (!pindiode.FillCharge(sumhi)) 529 *fLog << warn << 530 "Overflow or Underflow occurred filling PINDiode: sum = " << sumhi << endl; 531 532 if (TESTBIT(fFlags,kUseTimes)) 533 { 534 if (!pindiode.FillAbsTime(abstime)) 535 *fLog << warn << 536 "Overflow or Underflow occurred filling PINDiode abs. time = " << abstime << endl; 537 if (!pindiode.FillRelTime(reltime)) 538 *fLog << warn << 539 "Overflow or Underflow occurred filling PINDiode rel. time = " << reltime << endl; 540 } 541 542 if (!TESTBIT(fFlags,kPINDiodeOverFlow)) 543 if (!pindiode.FillRChargevsTime(sumhi,fEvents)) 544 { 545 *fLog << warn 546 << "Overflow or Underflow occurred filling PINDiode: eventnr = " 547 << fEvents << endl; 548 SETBIT(fFlags,kPINDiodeOverFlow); 549 } 550 break; 551 577 552 578 default: 553 554 pix.FillChargesInGraph(sumhi,sumlo); 555 579 556 580 if (!TESTBIT(fFlags,kLoGainOverFlow)) 557 581 if (!pix.FillRChargevsTimeLoGain(sumlo,fEvents)) … … 561 585 << fEvents << endl; 562 586 SETBIT(fFlags,kLoGainOverFlow); 587 SkipHiLoGainCalibration(); 563 588 } 564 589 … … 570 595 << fEvents << endl; 571 596 SETBIT(fFlags,kHiGainOverFlow); 597 SkipHiLoGainCalibration(); 572 598 } 573 599 574 600 601 if (TESTBIT(fFlags,kHiLoGainCalibration)) 602 pix.FillChargesInGraph(sumhi,sumlo); 603 575 604 if (sig.IsLoGainUsed()) 576 605 { … … 670 699 // Set the corresponding values 671 700 // 672 const Float_t nslices = (Float_t)fSignals->GetNumUsedFADCSlices(); 701 const Float_t nslices = (Float_t)(fgBlindPixelLast-fgBlindPixelFirst+1); 702 const Float_t sqrslice = TMath::Sqrt(nslices); 673 703 const ULong_t nentries = fPedestals->GetTotalEntries(); 674 704 675 705 const Float_t peddiff = (pedhist.GetChargeMean()-pedpix.GetPedestal())*nslices; 676 677 const Float_t sqrslice = TMath::Sqrt(nslices);678 706 679 707 Float_t pederr = pedhist.GetChargeMeanErr()*pedhist.GetChargeMeanErr(); … … 721 749 722 750 // 723 // get the pedestals724 //725 const Float_t ped = (*fPedestals)[pixid].GetPedestal() * fNumHiGainSamples;726 const Float_t prms = (*fPedestals)[pixid].GetPedestalRms() * fSqrtHiGainSamples;727 728 //729 // set them in the calibration camera730 //731 pix.SetPedestal(ped,prms);732 733 734 //735 751 // Check if the pixel has been excluded from the fits 736 752 // 737 753 if (pix.IsExcluded()) 738 754 continue; 755 756 // 757 // get the pedestals 758 // 759 const Float_t ped = (*fPedestals)[pixid].GetPedestal(); 760 const Float_t prms = (*fPedestals)[pixid].GetPedestalRms(); 761 762 // 763 // set them in the calibration camera 764 // 765 pix.SetPedestal(ped,prms,(Float_t)fNumHiGainSamples,(Float_t)fNumLoGainSamples); 739 766 740 767 // … … 793 820 } 794 821 822 Bool_t MCalibrationCalc::CalcSignalBlindPixel(Byte_t *ptr, Float_t &signal, const Float_t ped) const 823 { 824 825 Byte_t *start = ptr + fgBlindPixelFirst; 826 Byte_t *end = ptr + fgBlindPixelLast; 827 828 Byte_t sum = 0; 829 Int_t sat = 0; 830 831 ptr = start; 832 833 while (ptr<end) 834 { 835 sum += *ptr; 836 837 if (*ptr++ >= fgSaturationLimit) 838 sat++; 839 } 840 841 if (sat) 842 { 843 *fLog << err << "HI Gain Saturation occurred in the blind pixel! " 844 << " Do not know yet how to treat this ... aborting " << endl; 845 return kFALSE; 846 } 847 848 signal = (Float_t)sum - ped*(Float_t)(fgBlindPixelLast-fgBlindPixelFirst+1); 849 850 return kTRUE; 851 }
Note:
See TracChangeset
for help on using the changeset viewer.