Changeset 3123
- Timestamp:
- 02/12/04 19:44:24 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/NEWS
r3122 r3123 1 1 -*-*- END -*-*- 2 2 *** Version <cvs> 3 4 - added filter against cosmics: MFCosmics: 5 To be used together with MContinue 3 6 4 7 - added new class MArrivalTimeCalc2: -
trunk/MagicSoft/Mars/mcalib/MCalibrationCalc.cc
r3121 r3123 115 115 const UInt_t MCalibrationCalc::fPINDiodeId = 9999; 116 116 const Byte_t MCalibrationCalc::fgSaturationLimit = 254; 117 const Byte_tMCalibrationCalc::fgBlindPixelFirst = 10;118 const Byte_tMCalibrationCalc::fgBlindPixelLast = 20;119 const Int_t MCalibrationCalc::fgBlindPixelSinglePheCut = 200;117 const Int_t MCalibrationCalc::fgBlindPixelFirst = 10; 118 const Int_t MCalibrationCalc::fgBlindPixelLast = 20; 119 const Int_t MCalibrationCalc::fgBlindPixelSinglePheCut = 400; 120 120 121 121 // -------------------------------------------------------------------------- … … 155 155 fBlindPixelLast = 0; 156 156 157 fNumBlindPixelSinglePhe = 0; 158 fNumBlindPixelPedestal = 0; 159 157 160 fNumHiGainSamples = 0; 158 161 fNumLoGainSamples = 0; … … 163 166 } 164 167 165 void MCalibrationCalc::SetBlindPixelRange( Byte_t first, Byte_t last)168 void MCalibrationCalc::SetBlindPixelRange(Int_t first, Int_t last) 166 169 { 167 170 168 171 fBlindPixelFirst = first; 169 172 fBlindPixelLast = last; 173 170 174 } 171 175 … … 396 400 397 401 // 398 // Create a (second) loop to do fill the calibration histograms402 // Create a loop to fill the calibration histograms 399 403 // Search for: a signal in MExtractedSignalCam 400 404 // Fill histograms with: 401 405 // charge 402 406 // charge vs. event nr. 403 // relative arrival time w.r.t. pixel 1404 407 // 405 408 while (pixel.Next()) … … 466 469 // We need a dedicated signal extractor for the blind pixel 467 470 // 468 Int_t diff = 0; 469 470 if (fBlindPixelLast > 15) 471 Int_t diff = 0; 472 Int_t last = fBlindPixelLast; 473 Int_t first = fBlindPixelFirst; 474 475 if (last > 15) 471 476 { 472 diff = fBlindPixelLast - 15;473 fBlindPixelLast = 15;477 diff = last - 15; 478 last = 15; 474 479 } 475 480 476 Byte_t *start = ptr + fBlindPixelFirst - 1;477 Byte_t *end = start + fBlindPixelLast - fBlindPixelFirst +1;481 Byte_t *start = ptr + first - 1; 482 Byte_t *end = ptr + last - 1; 478 483 479 484 ptr = start; … … 481 486 Int_t sum = 0; 482 487 483 while (ptr< end)488 while (ptr<=end) 484 489 { 485 490 sum += *ptr; … … 490 495 { 491 496 ptr = pixel.GetLoGainSamples(); 497 end = ptr + diff - 1; 492 498 493 end = ptr + diff + 1; 494 495 while (ptr<end) 499 while (ptr<=end) 496 500 { 497 501 sum += *ptr; … … 531 535 532 536 if (blindpixelsumhi > fBlindPixelSinglePheCut) 533 hist = (blindpixel.GetHist())->GetHSinglePheFADCSlices(); 537 { 538 hist = (blindpixel.GetHist())->GetHSinglePheFADCSlices(); 539 fNumBlindPixelSinglePhe++; 540 } 534 541 else 535 hist = (blindpixel.GetHist())->GetHPedestalFADCSlices(); 536 542 { 543 hist = (blindpixel.GetHist())->GetHPedestalFADCSlices(); 544 fNumBlindPixelPedestal++; 545 } 546 537 547 ptr = pixel.GetHiGainSamples(); 538 548 for (Int_t i=1;i<16;i++) 539 549 hist->Fill(i,*ptr++); 550 540 551 ptr = pixel.GetLoGainSamples(); 541 552 for (Int_t i=16;i<31;i++) … … 544 555 } /* if use blind pixel */ 545 556 546 //break;557 break; 547 558 case fPINDiodeId: 548 559 … … 643 654 // so that we can use it for the fit 644 655 // 656 Float_t pedestal; 657 Float_t pederr; 658 Float_t pedsigma; 659 Float_t pedsigmaerr; 660 661 const ULong_t nentries = fPedestals->GetTotalEntries(); 662 const Int_t nslices = fBlindPixelLast-fBlindPixelFirst+1; 663 const Float_t sqrslice = TMath::Sqrt((Float_t)nslices); 664 // 665 // retrieve the pedestal pix of the blind pixel 666 // 645 667 if (fPedestals->GetHistSize() > fBlindPixelId) 646 668 { 647 648 Float_t pedestal; 649 Float_t pederr; 650 Float_t pedsigma; 651 Float_t pedsigmaerr; 652 653 const ULong_t nentries = fPedestals->GetTotalEntries(); 654 const Float_t nslices = (Float_t)(fgBlindPixelLast-fgBlindPixelFirst+1); 655 const Float_t sqrslice = TMath::Sqrt(nslices); 669 MHPedestalPixel &pedhist = (*fPedestals)(fBlindPixelId); 670 pedestal = pedhist.GetChargeMean()*nslices; 671 pederr = pedhist.GetChargeMeanErr()*nslices; 656 672 // 657 // retrieve the pedestal pix of the blind pixel 658 // 659 if (fPedestals->GetHistSize() != 0) 660 { 661 MHPedestalPixel &pedhist = (*fPedestals)(fBlindPixelId); 662 pedestal = pedhist.GetChargeMean()*nslices; 663 pederr = pedhist.GetChargeMeanErr()*nslices; 664 // 665 // Fitted sigma: 1. one sqrt(Nr. slices) for the division which is not 666 // not appropriate: sigma(real)/slice = GetSigma*sqrt(nslices) 667 // 2. another sqrt(Nr. slices) to calculate back to number 668 // of slices 669 // 670 pedsigma = pedhist.GetChargeSigma()*nslices; 671 pedsigmaerr = pedhist.GetChargeSigmaErr()*nslices; 672 } 673 else 674 { 675 MPedestalPix &pedpix = (*fPedestals)[fBlindPixelId]; 676 pedestal = pedpix.GetPedestal()*nslices; 677 pederr = pedpix.GetPedestalRms()*nslices/nentries; 678 pedsigma = pedpix.GetPedestalRms()*sqrslice; 679 pedsigmaerr = pederr/2.; 680 } 681 // 682 // retrieve the histogram containers 683 // 684 MHCalibrationBlindPixel *hist = blindpixel.GetHist(); 685 686 hist->SetMeanPedestal(pedestal); 687 hist->SetMeanPedestalErr(pederr); 688 hist->SetSigmaPedestal(pedsigma); 689 hist->SetSigmaPedestalErr(pedsigmaerr); 673 // Fitted sigma: 1. one sqrt(Nr. slices) for the division which is not 674 // not appropriate: sigma(real)/slice = GetSigma*sqrt(nslices) 675 // 2. another sqrt(Nr. slices) to calculate back to number 676 // of slices 677 // 678 pedsigma = pedhist.GetChargeSigma()*nslices; 679 pedsigmaerr = pedhist.GetChargeSigmaErr()*nslices; 690 680 } 691 681 else 682 { 683 MPedestalPix &pedpix = (*fPedestals)[fBlindPixelId]; 684 pedestal = pedpix.GetPedestal()*nslices; 685 pederr = pedpix.GetPedestalRms()*nslices/nentries; 686 pedsigma = pedpix.GetPedestalRms()*sqrslice; 687 pedsigmaerr = pederr/2.; 688 } 689 // 690 // retrieve the histogram containers 691 // 692 MHCalibrationBlindPixel *hist = blindpixel.GetHist(); 693 694 hist->SetMeanPedestal(pedestal); 695 hist->SetMeanPedestalErr(pederr); 696 hist->SetSigmaPedestal(pedsigma); 697 hist->SetSigmaPedestalErr(pedsigmaerr); 698 692 699 if (!blindpixel.FitCharge()) 693 700 { … … 702 709 fCalibrations->SetBlindPixelMethodValid(kFALSE); 703 710 711 TH1I *sphehist = hist->GetHSinglePheFADCSlices(); 712 TH1I *pedhist = hist->GetHPedestalFADCSlices(); 713 714 if (fNumBlindPixelSinglePhe > 1) 715 sphehist->Scale(1./fNumBlindPixelSinglePhe); 716 if (fNumBlindPixelPedestal > 1) 717 pedhist->Scale(1./fNumBlindPixelPedestal); 718 704 719 blindpixel.DrawClone(); 705 720 } 706 721 else 707 722 *fLog << inf << GetDescriptor() << ": Skipping Blind Pixel Fit " << endl; 723 724 *fLog << err << "total: " << GetNumExecutions() << " sphe: " << fNumBlindPixelSinglePhe << " ped: " << fNumBlindPixelPedestal << endl; 708 725 709 726 -
trunk/MagicSoft/Mars/mcalib/MCalibrationCalc.h
r3120 r3123 38 38 private: 39 39 40 static const UInt_t fBlindPixelId; // ID of the blind pixel 41 static const UInt_t fPINDiodeId; // ID of the PIN Diode 42 static const Byte_t fgSaturationLimit; // Saturation of Hi Gain 43 static const Byte_t fgBlindPixelFirst; // First FADC slice blind pixel 44 static const Byte_t fgBlindPixelLast; // Last FADC slice blind pixel 45 40 static const UInt_t fBlindPixelId; // ID of the blind pixel 41 static const UInt_t fPINDiodeId; // ID of the PIN Diode 42 static const Byte_t fgSaturationLimit; // Saturation of Hi Gain 43 static const Int_t fgBlindPixelFirst; // First FADC slice blind pixel 44 static const Int_t fgBlindPixelLast; // Last FADC slice blind pixel 46 45 static const Int_t fgBlindPixelSinglePheCut; // FADC sum from which on an event is considered as a S.ph. one. 47 46 48 MPedestalCam *fPedestals; // Pedestals of all pixels in the camera49 MCalibrationCam *fCalibrations; // Calibration events of all pixels in the camera50 MExtractedSignalCam *fSignals; // Calibration events of all pixels in the camera47 MPedestalCam *fPedestals; // Pedestals of all pixels in the camera 48 MCalibrationCam *fCalibrations; // Calibration events of all pixels in the camera 49 MExtractedSignalCam *fSignals; // Calibration events of all pixels in the camera 51 50 52 MRawEvtData *fRawEvt; // raw event data (time slices)53 MRawRunHeader *fRunHeader; // RunHeader information51 MRawEvtData *fRawEvt; // raw event data (time slices) 52 MRawRunHeader *fRunHeader; // RunHeader information 54 53 55 MTime *fEvtTime; // Time of the event54 MTime *fEvtTime; // Time of the event 56 55 57 Byte_t fNumHiGainSamples;58 Byte_t fNumLoGainSamples;56 Byte_t fNumHiGainSamples; 57 Byte_t fNumLoGainSamples; 59 58 Float_t fSqrtHiGainSamples; 60 59 61 Byte_t fBlindPixelFirst; 62 Byte_t fBlindPixelLast; 60 Int_t fBlindPixelFirst; 61 Int_t fBlindPixelLast; 62 Int_t fBlindPixelSinglePheCut; 63 63 64 Int_t fBlindPixelSinglePheCut; 64 Int_t fNumBlindPixelSinglePhe; 65 Int_t fNumBlindPixelPedestal; 65 66 66 67 Float_t fConversionHiLo; 67 Int_t fFlags; // Flag for the fits used68 Int_t fFlags; // Flag for the fits used 68 69 69 70 TString fExcludedPixelsFile; 70 71 UInt_t fNumExcludedPixels; 71 72 72 enum { kUseBlindPixelFit, kUsePinDiodeFit, 73 enum { kUseBlindPixelFit, 74 kUsePinDiodeFit, 73 75 kUseQualityChecks, 74 76 kHiLoGainCalibration, 75 kHiGainOverFlow, kLoGainOverFlow }; 77 kHiGainOverFlow, 78 kLoGainOverFlow }; 76 79 77 80 public: … … 97 100 98 101 void SkipBlindPixelFit(Bool_t b=kTRUE) 99 {b ? CLRBIT(fFlags, kUseBlindPixelFit) : SETBIT(fFlags, kUseBlindPixelFit);}102 {b ? CLRBIT(fFlags, kUseBlindPixelFit) : SETBIT(fFlags, kUseBlindPixelFit);} 100 103 void SkipPinDiodeFit(Bool_t b=kTRUE) 101 {b ? CLRBIT(fFlags, kUsePinDiodeFit) : SETBIT(fFlags, kUsePinDiodeFit);}104 {b ? CLRBIT(fFlags, kUsePinDiodeFit) : SETBIT(fFlags, kUsePinDiodeFit);} 102 105 void SkipQualityChecks(Bool_t b=kTRUE) 103 {b ? CLRBIT(fFlags, kUseQualityChecks) : SETBIT(fFlags, kUseQualityChecks);}106 {b ? CLRBIT(fFlags, kUseQualityChecks) : SETBIT(fFlags, kUseQualityChecks);} 104 107 void SkipHiLoGainCalibration(Bool_t b=kTRUE) 105 108 {b ? CLRBIT(fFlags, kHiLoGainCalibration) : SETBIT(fFlags, kHiLoGainCalibration);} … … 107 110 108 111 // Setters 109 void SetPulserColor(PulserColor_t color) { fColor= color; }112 void SetPulserColor(PulserColor_t color) { fColor = color; } 110 113 void SetConversionHiLo(Float_t conv) { fConversionHiLo = conv; } 111 114 112 void SetBlindPixelRange(Byte_t first=fgBlindPixelFirst, Byte_t last=fgBlindPixelLast); 113 void SetBlindPixelSinglePheCut(Int_t cut=fgBlindPixelSinglePheCut) { fBlindPixelSinglePheCut = cut; } 115 void SetBlindPixelRange(Int_t first=fgBlindPixelFirst, Int_t last=fgBlindPixelLast); 116 void SetBlindPixelSinglePheCut(Int_t cut=fgBlindPixelSinglePheCut) 117 { fBlindPixelSinglePheCut = cut; } 114 118 115 119 // Getters
Note:
See TracChangeset
for help on using the changeset viewer.