Changeset 3555 for trunk/MagicSoft/Mars/mcalib
- Timestamp:
- 03/19/04 19:37:51 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/mcalib
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc
r3554 r3555 389 389 390 390 391 // --------------------------------------------------------------------------392 //393 // Calculate the integral of the FADC time slices and store them as a new394 // pixel in the MCerPhotEvt container.395 //396 391 Int_t MCalibrationChargeCalc::Process() 397 392 { 398 393 return kTRUE; 399 394 } 395 396 // -------------------------------------------------------------------------- 397 // 398 // Finalize pedestals: 399 // 400 // * Retrieve pedestal and pedestal RMS from MPedestalPix 401 // * Retrieve total entries from MPedestalCam 402 // * sum up pedestal and pedestalRMS for the average pixel 403 // * set pedestal*number of used samples in MCalibrationChargePix 404 // * set pedestal RMS * sqrt of number of used samples in MCalibrationChargePix 405 // 406 // 407 void MCalibrationChargeCalc::FinalizePedestals(MPedestalPix &ped, MCalibrationChargePix &cal, 408 Float_t &avped, Float_t &avrms, Float_t &avnum) 409 { 410 411 // 412 // get the pedestals 413 // 414 const Float_t pedes = ped.GetPedestal(); 415 const Float_t prms = ped.GetPedestalRms(); 416 const Float_t num = TMath::Sqrt((Float_t)fPedestals->GetTotalEntries()); 417 418 // 419 // Calculate the average pedestal 420 // 421 avped += pedes; 422 avrms += prms; 423 avnum++; 424 425 // 426 // set them in the calibration camera 427 // 428 if (cal.IsHiGainSaturation()) 429 { 430 cal.SetPedestal(pedes* fNumLoGainSamples, 431 prms * fSqrtLoGainSamples, 432 prms * fNumLoGainSamples / num); 433 cal.CalcLoGainPedestal((Float_t)fNumLoGainSamples); 434 } 435 else 436 { 437 cal.SetPedestal(pedes* fNumHiGainSamples, 438 prms * fSqrtHiGainSamples, 439 prms * fNumHiGainSamples / num); 440 } 441 442 } 443 444 400 445 401 446 Int_t MCalibrationChargeCalc::PostProcess() … … 417 462 418 463 MCalibrationChargePix &pix = (*fCam)[pixid]; 419 MBadPixelsPix &bad = (*fBadPixels)[pixid];420 421 464 // 422 465 // Check if the pixel has been excluded from the fits … … 425 468 continue; 426 469 427 // 428 // get the pedestals 429 // 430 const Float_t ped = (*fPedestals)[pixid].GetPedestal(); 431 const Float_t prms = (*fPedestals)[pixid].GetPedestalRms(); 432 const Float_t num = TMath::Sqrt((Float_t)fPedestals->GetTotalEntries()); 470 MPedestalPix &ped = (*fPedestals)[pixid]; 471 433 472 434 473 if (fGeom->GetPixRatio(pixid) == 1.) 435 { 436 avinnerped += ped; 437 avinnerprms += prms; 438 avinnernum++; 439 } 474 FinalizePedestals(ped,pix,avinnerped,avinnerprms,avinnernum); 440 475 else 441 { 442 avouterped += ped; 443 avouterprms += prms; 444 avouternum++; 445 } 446 // 447 // set them in the calibration camera 448 // 449 if (pix.IsHiGainSaturation()) 450 { 451 pix.SetPedestal(ped * fNumLoGainSamples, 452 prms * fSqrtLoGainSamples, 453 prms * fNumLoGainSamples / num); 454 pix.SetNumLoGainSamples(fNumLoGainSamples); 455 pix.ApplyLoGainConversion(); 456 } 457 else 458 { 459 pix.SetPedestal(ped * fNumHiGainSamples, 460 prms * fSqrtHiGainSamples, 461 prms * fNumHiGainSamples / num); 462 } 476 FinalizePedestals(ped,pix,avouterped,avouterprms,avouternum); 477 478 479 MBadPixelsPix &bad = (*fBadPixels)[pixid]; 463 480 464 481 pix.CheckChargeValidity (&bad); … … 509 526 avinnerprms/avinnernum * fSqrtLoGainSamples, 510 527 avinnerprms/avinnernum * fSqrtLoGainSamples/avinnernum); 511 avinnerpix->SetNumLoGainSamples(fNumLoGainSamples); 512 avinnerpix->ApplyLoGainConversion(); 528 avinnerpix->CalcLoGainPedestal((Float_t)fNumLoGainSamples); 513 529 } 514 530 else … … 524 540 avouterprms/avouternum * fSqrtLoGainSamples, 525 541 avouterprms/avouternum * fSqrtLoGainSamples/avouternum); 526 avouterpix->SetNumLoGainSamples(fNumLoGainSamples); 527 avouterpix->ApplyLoGainConversion(); 542 avouterpix->CalcLoGainPedestal((Float_t)fNumLoGainSamples); 528 543 } 529 544 else -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.h
r3554 r3555 18 18 class MRawRunHeader; 19 19 class MPedestalCam; 20 class MPedestalPix; 20 21 class MCalibrationChargePINDiode; 21 22 class MCalibrationChargeBlindPix; 23 class MCalibrationChargePix; 22 24 class MCalibrationChargeCam; 23 25 class MCalibrationQECam; … … 59 61 Int_t Process(); 60 62 Int_t PostProcess(); 63 64 void FinalizePedestals(MPedestalPix &ped, MCalibrationChargePix &cal, 65 Float_t &avped, Float_t &avrms, Float_t &avnum); 66 61 67 62 68 public: -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargePix.cc
r3554 r3555 177 177 fLoGainNumPickup = -1; 178 178 179 fNumLoGainSamples = -1.;180 181 179 fPed = -1.; 182 180 fPedRms = -1.; … … 708 706 } 709 707 710 void MCalibrationChargePix::CalcLoGainPed()711 {712 713 Float_t pedRmsSquare = fPedRms * fPedRms;714 Float_t pedRmsSquareVar = fPedVar * pedRmsSquare; // fPedRmsErr = fPedErr/2.715 716 //717 // We do not know the Lo Gain Pedestal RMS, so we have to retrieve it718 // from the HI GAIN (all calculation per slice up to now):719 //720 // We extract the pure NSB contribution:721 //722 const Float_t elecRmsSquare = fElectronicPedRms * fElectronicPedRms;723 const Float_t elecRmsSquareVar = 4.*fElectronicPedRmsVar * elecRmsSquare;724 725 Float_t nsbSquare = pedRmsSquare - elecRmsSquare;726 Float_t nsbSquareRelVar = (pedRmsSquareVar + elecRmsSquareVar)727 / (nsbSquare * nsbSquare) ;728 729 if (nsbSquare < 0.)730 nsbSquare = 0.;731 732 //733 // Now, we divide the NSB by the conversion factor and734 // add it quadratically to the electronic noise735 //736 const Float_t conversionSquare = fConversionHiLo * fConversionHiLo;737 const Float_t convertedNsbSquare = nsbSquare / conversionSquare;738 const Float_t convertedNsbSquareVar = nsbSquareRelVar739 * convertedNsbSquare * convertedNsbSquare;740 741 pedRmsSquare = convertedNsbSquare + elecRmsSquare;742 pedRmsSquareVar = convertedNsbSquareVar + elecRmsSquareVar;743 744 fLoGainPedRms = TMath::Sqrt(pedRmsSquare);745 fLoGainPedRmsVar = 0.25 * pedRmsSquareVar / pedRmsSquare;746 747 }748 708 749 709 // … … 844 804 845 805 846 void MCalibrationChargePix::ApplyLoGainConversion() 847 { 848 849 fElectronicPedRms = gkElectronicPedRms * TMath::Sqrt(fNumLoGainSamples); 850 fElectronicPedRmsVar = gkElectronicPedRmsErr * gkElectronicPedRmsErr * fNumLoGainSamples; 851 852 CalcLoGainPed(); 853 } 854 855 806 void MCalibrationChargePix::CalcLoGainPedestal(Float_t logainsamples) 807 { 808 809 fElectronicPedRms = gkElectronicPedRms * TMath::Sqrt(logainsamples); 810 fElectronicPedRmsVar = gkElectronicPedRmsErr * gkElectronicPedRmsErr * logainsamples; 811 812 Float_t pedRmsSquare = fPedRms * fPedRms; 813 Float_t pedRmsSquareVar = fPedVar * pedRmsSquare; // fPedRmsErr = fPedErr/2. 814 815 // 816 // We do not know the Lo Gain Pedestal RMS, so we have to retrieve it 817 // from the HI GAIN (all calculation per slice up to now): 818 // 819 // We extract the pure NSB contribution: 820 // 821 const Float_t elecRmsSquare = fElectronicPedRms * fElectronicPedRms; 822 const Float_t elecRmsSquareVar = 4.*fElectronicPedRmsVar * elecRmsSquare; 823 824 Float_t nsbSquare = pedRmsSquare - elecRmsSquare; 825 Float_t nsbSquareRelVar = (pedRmsSquareVar + elecRmsSquareVar) 826 / (nsbSquare * nsbSquare) ; 827 828 if (nsbSquare < 0.) 829 nsbSquare = 0.; 830 831 // 832 // Now, we divide the NSB by the conversion factor and 833 // add it quadratically to the electronic noise 834 // 835 const Float_t conversionSquare = fConversionHiLo * fConversionHiLo; 836 const Float_t convertedNsbSquare = nsbSquare / conversionSquare; 837 const Float_t convertedNsbSquareVar = nsbSquareRelVar 838 * convertedNsbSquare * convertedNsbSquare; 839 840 pedRmsSquare = convertedNsbSquare + elecRmsSquare; 841 pedRmsSquareVar = convertedNsbSquareVar + elecRmsSquareVar; 842 843 fLoGainPedRms = TMath::Sqrt(pedRmsSquare); 844 fLoGainPedRmsVar = 0.25 * pedRmsSquareVar / pedRmsSquare; 845 846 } 847 848 849 -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargePix.h
r3553 r3555 109 109 Float_t fConversionHiLoVar; // The error of the conversion factor between Hi Gain and Lo Gain 110 110 111 Float_t fNumLoGainSamples; 112 113 Float_t fHiGainNumPickup; 114 Float_t fLoGainNumPickup; 111 Float_t fHiGainNumPickup; 112 Float_t fLoGainNumPickup; 115 113 116 114 enum { kHiGainSaturation, kLoGainSaturation, … … 121 119 kPINDiodeMethodValid, kCombinedMethodValid }; 122 120 123 void CalcLoGainPed();124 125 121 public: 126 122 … … 170 166 void SetAbsTimeMean ( const Float_t f ) { fAbsTimeMean = f; } 171 167 void SetAbsTimeRms ( const Float_t f ) { fAbsTimeRms = f; } 172 173 void SetNumLoGainSamples ( const Float_t f ) { fNumLoGainSamples = f; }174 168 175 169 // Conversion Factors … … 283 277 284 278 // Miscellaneous 285 void ApplyLoGainConversion();286 287 279 void CheckChargeValidity ( MBadPixelsPix *bad ); 288 280 void CheckTimeValidity ( MBadPixelsPix *bad ); 281 282 void CalcLoGainPedestal(const Float_t logainsamples); 289 283 Bool_t CalcReducedSigma(); 290 284 Bool_t CalcFFactorMethod();
Note:
See TracChangeset
for help on using the changeset viewer.