Changeset 3455 for trunk/MagicSoft/Mars
- Timestamp:
- 03/10/04 16:50:25 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r3454 r3455 18 18 19 19 -*-*- END OF LINE -*-*- 20 2004/03/10: Markus Gaug 21 22 * mcalib/MCalibrationChargeCalc.cc 23 * mcalib/MCalibrationChargePix.[h,cc] 24 * mcalib/MCalibrationChargeCam.[h,cc] 25 - calculation of conversion factor with F-Factor method from 26 same mean number of photons, derived from weighted mean number 27 of photo-electrons from inner and outer pixels, respectively 28 29 20 30 2004/03/10: Thomas Bretz 21 31 -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc
r3451 r3455 522 522 avouterpix->CalcFFactorMethod(); 523 523 524 // 525 // F-Factor calibration 526 // 527 if (fCam->CalcMeanFluxPhotonsFFactorMethod()) 528 { 529 fCam->ApplyFFactorCalibration(); 530 fCam->SetFFactorMethodValid(kTRUE); 531 } 532 else 533 { 534 *fLog << warn << "Could not calculate the flux of photo-electrons from the F-Factor method, " << endl; 535 fCam->SetFFactorMethodValid(kFALSE); 536 } 537 538 539 540 // 541 // Blind Pixel calibration 542 // 524 543 if (!fBlindPixel->CheckChargeFitValidity()) 525 544 { … … 543 562 } 544 563 564 // 565 // PIN Diode calibration 566 // 545 567 if (!fPINDiode->CheckChargeFitValidity() || !fPINDiode->CheckTimeFitValidity()) 546 568 { -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.cc
r3446 r3455 138 138 #include "MCalibrationChargePINDiode.h" 139 139 140 141 140 ClassImp(MCalibrationChargeCam); 142 141 143 142 using namespace std; 144 143 144 const Float_t MCalibrationChargeCam::gkAverageQE = 0.18; 145 const Float_t MCalibrationChargeCam::gkAverageQEErr = 0.02; 146 const Float_t MCalibrationChargeCam::fgConvFFactorRelErrLimit = 0.25; 145 147 // -------------------------------------------------------------------------- 146 148 // … … 171 173 172 174 Clear(); 175 176 SetAverageQE(); 177 SetConvFFactorRelErrLimit(); 173 178 } 174 179 … … 261 266 fAverageOuterBadPix->Clear(); 262 267 263 fNumExcludedPixels = 0; 268 fNumExcludedPixels = 0; 269 fMeanFluxPhesInnerPixel = 0.; 270 fMeanFluxPhesInnerPixelErr = 0.; 271 fMeanFluxPhesOuterPixel = 0.; 272 fMeanFluxPhesOuterPixelErr = 0.; 264 273 265 274 CLRBIT(fFlags,kBlindPixelMethodValid); 275 CLRBIT(fFlags,kFFactorMethodValid); 266 276 CLRBIT(fFlags,kPINDiodeMethodValid); 267 277 268 278 return; 279 } 280 281 void MCalibrationChargeCam::SetFFactorMethodValid(const Bool_t b) 282 { 283 b ? SETBIT(fFlags, kFFactorMethodValid) : CLRBIT(fFlags, kFFactorMethodValid); 269 284 } 270 285 … … 567 582 break; 568 583 case 9: 569 if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK() || !(*this)[idx].IsFFactorMethodValid()) 584 if ((*this)[idx].IsExcluded() 585 || !(*fBadPixels)[idx].IsCalibrationSignalOK() 586 || !(*this)[idx].IsFFactorMethodValid()) 570 587 return kFALSE; 571 588 val = (*this)[idx].GetPheFFactorMethod(); 572 589 break; 573 590 case 10: 574 if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK() || !(*this)[idx].IsFFactorMethodValid()) 591 if ((*this)[idx].IsExcluded() 592 || !(*fBadPixels)[idx].IsCalibrationSignalOK() 593 || !(*this)[idx].IsFFactorMethodValid()) 575 594 return kFALSE; 576 595 val = (*this)[idx].GetPheFFactorMethodErr(); 577 596 break; 578 597 case 11: 579 if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK() || !(*this)[idx].IsFFactorMethodValid()) 598 if ((*this)[idx].IsExcluded() 599 || !(*fBadPixels)[idx].IsCalibrationSignalOK() 600 || !(*this)[idx].IsFFactorMethodValid()) 580 601 return kFALSE; 581 602 val = (*this)[idx].GetMeanConversionFFactorMethod(); 582 603 break; 583 604 case 12: 584 if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK() || !(*this)[idx].IsFFactorMethodValid()) 605 if ((*this)[idx].IsExcluded() 606 || !(*fBadPixels)[idx].IsCalibrationSignalOK() 607 || !(*this)[idx].IsFFactorMethodValid()) 585 608 return kFALSE; 586 609 val = (*this)[idx].GetConversionFFactorMethodErr(); 587 610 break; 588 611 case 13: 589 if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK() || !(*this)[idx].IsFFactorMethodValid()) 612 if ((*this)[idx].IsExcluded() 613 || !(*fBadPixels)[idx].IsCalibrationSignalOK() 614 || !(*this)[idx].IsFFactorMethodValid()) 590 615 return kFALSE; 591 616 val = (*this)[idx].GetTotalFFactorFFactorMethod(); 592 617 break; 593 618 case 14: 594 if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK() || !(*this)[idx].IsFFactorMethodValid()) 619 if ((*this)[idx].IsExcluded() 620 || !(*fBadPixels)[idx].IsCalibrationSignalOK() 621 || !(*this)[idx].IsFFactorMethodValid()) 595 622 return kFALSE; 596 623 val = (*this)[idx].GetTotalFFactorErrFFactorMethod(); 597 624 break; 598 625 case 15: 599 if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK() || !(*this)[idx].IsBlindPixelMethodValid()) 626 if ((*this)[idx].IsExcluded() 627 || !(*fBadPixels)[idx].IsCalibrationSignalOK() 628 || !(*this)[idx].IsBlindPixelMethodValid()) 600 629 return kFALSE; 601 630 val = fBlindPixel->GetMeanFluxInsidePlexiglass()*area; 602 631 break; 603 632 case 16: 604 if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK() || !(*this)[idx].IsBlindPixelMethodValid()) 633 if ((*this)[idx].IsExcluded() 634 || !(*fBadPixels)[idx].IsCalibrationSignalOK() 635 || !(*this)[idx].IsBlindPixelMethodValid()) 605 636 return kFALSE; 606 637 val = fBlindPixel->GetMeanFluxErrInsidePlexiglass()*area; 607 638 break; 608 639 case 17: 609 if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK() || !(*this)[idx].IsBlindPixelMethodValid()) 640 if ((*this)[idx].IsExcluded() 641 || !(*fBadPixels)[idx].IsCalibrationSignalOK() 642 || !(*this)[idx].IsBlindPixelMethodValid()) 610 643 return kFALSE; 611 644 val = (*this)[idx].GetMeanConversionBlindPixelMethod(); 612 645 break; 613 646 case 18: 614 if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK() || !(*this)[idx].IsBlindPixelMethodValid()) 647 if ((*this)[idx].IsExcluded() 648 || !(*fBadPixels)[idx].IsCalibrationSignalOK() 649 || !(*this)[idx].IsBlindPixelMethodValid()) 615 650 return kFALSE; 616 651 val = (*this)[idx].GetConversionBlindPixelMethodErr(); 617 652 break; 618 653 case 19: 619 if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK() || !(*this)[idx].IsBlindPixelMethodValid()) 654 if ((*this)[idx].IsExcluded() 655 || !(*fBadPixels)[idx].IsCalibrationSignalOK() 656 || !(*this)[idx].IsBlindPixelMethodValid()) 620 657 return kFALSE; 621 658 val = (*this)[idx].GetTotalFFactorBlindPixelMethod(); 622 659 break; 623 660 case 20: 624 if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK() || !(*this)[idx].IsBlindPixelMethodValid()) 661 if ((*this)[idx].IsExcluded() 662 || !(*fBadPixels)[idx].IsCalibrationSignalOK() 663 || !(*this)[idx].IsBlindPixelMethodValid()) 625 664 return kFALSE; 626 665 val = (*this)[idx].GetTotalFFactorErrBlindPixelMethod(); 627 666 break; 628 667 case 21: 629 if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK() || !(*this)[idx].IsPINDiodeMethodValid()) 668 if ((*this)[idx].IsExcluded() 669 || !(*fBadPixels)[idx].IsCalibrationSignalOK() 670 || !(*this)[idx].IsPINDiodeMethodValid()) 630 671 return kFALSE; 631 672 val = fPINDiode->GetMeanFluxOutsidePlexiglass()*area; 632 673 break; 633 674 case 22: 634 if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK() || !(*this)[idx].IsPINDiodeMethodValid()) 675 if ((*this)[idx].IsExcluded() 676 || !(*fBadPixels)[idx].IsCalibrationSignalOK() 677 || !(*this)[idx].IsPINDiodeMethodValid()) 635 678 return kFALSE; 636 679 val = fPINDiode->GetMeanFluxErrOutsidePlexiglass()*area; 637 680 break; 638 681 case 23: 639 if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK() || !(*this)[idx].IsPINDiodeMethodValid()) 682 if ((*this)[idx].IsExcluded() 683 || !(*fBadPixels)[idx].IsCalibrationSignalOK() 684 || !(*this)[idx].IsPINDiodeMethodValid()) 640 685 return kFALSE; 641 686 val = (*this)[idx].GetMeanConversionPINDiodeMethod(); 642 687 break; 643 688 case 24: 644 if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK() || !(*this)[idx].IsPINDiodeMethodValid()) 689 if ((*this)[idx].IsExcluded() 690 || !(*fBadPixels)[idx].IsCalibrationSignalOK() 691 || !(*this)[idx].IsPINDiodeMethodValid()) 645 692 return kFALSE; 646 693 val = (*this)[idx].GetConversionPINDiodeMethodErr(); 647 694 break; 648 695 case 25: 649 if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK() || !(*this)[idx].IsPINDiodeMethodValid()) 696 if ((*this)[idx].IsExcluded() 697 || !(*fBadPixels)[idx].IsCalibrationSignalOK() 698 || !(*this)[idx].IsPINDiodeMethodValid()) 650 699 return kFALSE; 651 700 val = (*this)[idx].GetTotalFFactorPINDiodeMethod(); 652 701 break; 653 702 case 26: 654 if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK() || !(*this)[idx].IsPINDiodeMethodValid()) 703 if ((*this)[idx].IsExcluded() 704 || !(*fBadPixels)[idx].IsCalibrationSignalOK() 705 || !(*this)[idx].IsPINDiodeMethodValid()) 655 706 return kFALSE; 656 707 val = (*this)[idx].GetTotalFFactorErrPINDiodeMethod(); … … 782 833 (*this)[idx].DrawClone(); 783 834 } 835 836 // 837 // 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() 841 { 842 843 const Float_t avQERelErrSquare = fAverageQEErr * fAverageQEErr 844 / (fAverageQE * fAverageQE ); 845 846 Float_t sumweightsinner = 0.; 847 Float_t sumphesinner = 0.; 848 Float_t sumweightsouter = 0.; 849 Float_t sumphesouter = 0.; 850 851 TIter Next(fPixels); 852 MCalibrationChargePix *pix; 853 while ((pix=(MCalibrationChargePix*)Next())) 854 { 855 856 if (!pix->IsFFactorMethodValid()) 857 continue; 858 859 const Int_t idx = pix->GetPixId(); 860 861 if(!(*fBadPixels)[idx].IsCalibrationResultOK()) 862 continue; 863 864 const Float_t nphe = pix->GetPheFFactorMethod(); 865 const Float_t npheerr = pix->GetPheFFactorMethodErr(); 866 const Float_t ratio = fGeomCam->GetPixRatio(idx); 867 868 if (npheerr > 0.) 869 { 870 // 871 // first the inner pixels: 872 // 873 if (ratio == 1.) 874 { 875 const Float_t weight = 1./npheerr/npheerr; 876 sumweightsinner += weight; 877 sumphesinner += weight*nphe; 878 } 879 else 880 { 881 // 882 // now the outers 883 // 884 const Float_t weight = 1./npheerr/npheerr; 885 sumweightsouter += weight; 886 sumphesouter += weight*nphe; 887 } 888 } /* if npheerr != 0 */ 889 } /* while ((pix=(MCalibrationChargePix*)Next())) */ 890 891 if (sumweightsinner <= 0. || sumphesinner <= 0.) 892 { 893 *fLog << warn << " Mean number of phe's from inner pixels cannot be calculated: " 894 << " Sum of weights: " << sumweightsinner 895 << " Sum of weighted phes: " << sumphesinner << endl; 896 return kFALSE; 897 } 898 else 899 { 900 fMeanFluxPhesInnerPixel = sumphesinner/sumweightsinner; 901 fMeanFluxPhesInnerPixelErr = TMath::Sqrt(1./sumweightsinner); 902 903 } 904 905 if (sumweightsouter <= 0. || sumphesouter <= 0.) 906 { 907 *fLog << warn << " Mean number of phe's from outer pixels cannot be calculated: " 908 << " Sum of weights or sum of weighted phes is 0. " << endl; 909 } 910 else 911 { 912 fMeanFluxPhesOuterPixel = sumphesouter/sumweightsouter; 913 fMeanFluxPhesOuterPixelErr = TMath::Sqrt(1./sumweightsouter); 914 } 915 916 917 const Float_t meanFluxPhotonsRelErrSquare = fMeanFluxPhesInnerPixelErr * fMeanFluxPhesInnerPixelErr 918 / (fMeanFluxPhesInnerPixel * fMeanFluxPhesInnerPixel); 919 920 fMeanFluxPhotonsInnerPixel = fMeanFluxPhesInnerPixel/fAverageQE; 921 fMeanFluxPhotonsInnerPixelErr = TMath::Sqrt(meanFluxPhotonsRelErrSquare + avQERelErrSquare) 922 * fMeanFluxPhotonsInnerPixel; 923 924 fMeanFluxPhotonsOuterPixel = 4.*fMeanFluxPhotonsInnerPixel; 925 fMeanFluxPhotonsOuterPixelErr = 4.*fMeanFluxPhotonsInnerPixelErr; 926 927 *fLog << inf << " Mean number of photo-electrons from inner pixels (F-Factor Method): " 928 << fMeanFluxPhesInnerPixel << " +- " << fMeanFluxPhesInnerPixelErr << endl; 929 930 *fLog << inf << " Mean number of photons from inner pixels (F-Factor Method): " 931 << fMeanFluxPhotonsInnerPixel << " +- " << fMeanFluxPhotonsInnerPixelErr << endl; 932 933 934 935 return kTRUE; 936 } 937 938 void MCalibrationChargeCam::ApplyFFactorCalibration() 939 { 940 941 const Float_t meanphotRelErrSquare = fMeanFluxPhotonsInnerPixelErr * fMeanFluxPhotonsInnerPixelErr 942 /( fMeanFluxPhotonsInnerPixel * fMeanFluxPhotonsInnerPixel ); 943 944 TIter Next(fPixels); 945 MCalibrationChargePix *pix; 946 while ((pix=(MCalibrationChargePix*)Next())) 947 { 948 949 if (!pix->IsFFactorMethodValid()) 950 continue; 951 952 const Int_t idx = pix->GetPixId(); 953 954 if(!(*fBadPixels)[idx].IsCalibrationResultOK()) 955 continue; 956 957 const Float_t ratio = fGeomCam->GetPixRatio(idx); 958 // 959 // Calculate the conversion factor between PHOTONS and FADC counts 960 // 961 // Nphot = Nphe / avQE 962 // conv = Nphot / FADC counts 963 // 964 Float_t conv; 965 966 if (ratio == 1.) 967 conv = fMeanFluxPhotonsInnerPixel / pix->GetMeanCharge(); 968 else 969 conv = fMeanFluxPhotonsOuterPixel / pix->GetMeanCharge(); 970 971 if (conv <= 0.) 972 { 973 pix->SetFFactorMethodValid(kFALSE); 974 continue; 975 } 976 977 const Float_t chargeRelErrSquare = pix->GetMeanChargeErr() * pix->GetMeanChargeErr() 978 / ( pix->GetMeanCharge() * pix->GetMeanCharge()); 979 const Float_t rsigmaChargeRelErrSquare = pix->GetRSigmaChargeErr() * pix->GetRSigmaChargeErr() 980 / (pix->GetRSigmaCharge() * pix->GetRSigmaCharge()) ; 981 982 const Float_t convrelerr = TMath::Sqrt(meanphotRelErrSquare + chargeRelErrSquare); 983 984 if (convrelerr > fConvFFactorRelErrLimit) 985 { 986 *fLog << warn << GetDescriptor() << ": Conversion Factor F-Factor Method Rel. Error: " 987 << convrelerr << " above limit of: " << fConvFFactorRelErrLimit 988 << " in pixel: " << idx << endl; 989 pix->SetFFactorMethodValid(kFALSE); 990 continue; 991 } 992 993 // 994 // Calculate the Total F-Factor of the camera (in photons) 995 // 996 const Float_t totalFFactor = (pix->GetRSigmaCharge()/pix->GetMeanCharge()) 997 *TMath::Sqrt(fMeanFluxPhotonsInnerPixel); 998 999 // 1000 // Calculate the error of the Total F-Factor of the camera ( in photons ) 1001 // 1002 const Float_t totalFFactorErr = TMath::Sqrt( rsigmaChargeRelErrSquare 1003 + chargeRelErrSquare 1004 + meanphotRelErrSquare ); 1005 1006 pix->SetConversionFFactorMethod(conv, 1007 convrelerr*conv, 1008 totalFFactor*TMath::Sqrt(conv)); 1009 1010 pix->SetTotalFFactorFFactorMethod( totalFFactor ); 1011 pix->SetTotalFFactorErrFFactorMethod(totalFFactorErr); 1012 pix->SetFFactorMethodValid(); 1013 } 1014 } 1015 1016 784 1017 785 1018 void MCalibrationChargeCam::ApplyBlindPixelCalibration() -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.h
r3429 r3455 22 22 private: 23 23 24 static const Float_t gkAverageQE; // The average quantum efficieny agreed on for the first analysis 25 static const Float_t gkAverageQEErr; // The error of average quantum efficieny 26 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) 31 32 Float_t fConvFFactorRelErrLimit; // The limit for acceptance of the rel. error of the conversion factor with the FFactor method 33 24 34 Int_t fNumPixels; 25 35 TClonesArray *fPixels; //-> Array of MCalibrationPix with fit results … … 45 55 Byte_t fFlags; 46 56 47 enum { kBlindPixelMethodValid, kPINDiodeMethodValid, kCombinedMethodValid }; 57 enum { kFFactorMethodValid, kBlindPixelMethodValid, kPINDiodeMethodValid, kCombinedMethodValid }; 58 59 Float_t fMeanFluxPhesInnerPixel; // The mean number of photo-electrons in an INNER PIXEL 60 Float_t fMeanFluxPhesInnerPixelErr; // The uncertainty about the number of photo-electrons INNER PIXEL 61 Float_t fMeanFluxPhesOuterPixel; // The mean number of photo-electrons in an INNER PIXEL 62 Float_t fMeanFluxPhesOuterPixelErr; // The uncertainty about the number of photo-electrons INNER PIXEL 63 64 Float_t fMeanFluxPhotonsInnerPixel; // The mean number of photo-electrons in an INNER PIXEL 65 Float_t fMeanFluxPhotonsInnerPixelErr; // The uncertainty about the number of photo-electrons INNER PIXEL 66 Float_t fMeanFluxPhotonsOuterPixel; // The mean number of photo-electrons in an INNER PIXEL 67 Float_t fMeanFluxPhotonsOuterPixelErr; // The uncertainty about the number of photo-electrons INNER PIXEL 48 68 49 69 public: … … 56 76 57 77 // Setters 78 void SetAverageQE( const Float_t qe= gkAverageQE, 79 const Float_t err=gkAverageQEErr) { fAverageQE = qe; 80 fAverageQEErr = err; } 81 void SetConvFFactorRelErrLimit( const Float_t f=fgConvFFactorRelErrLimit ) { fConvFFactorRelErrLimit = f; } 58 82 void SetNumPixelsExcluded( const UInt_t n ) { fNumExcludedPixels = n; } 59 83 void SetGeomCam( const MGeomCam *geom) { fGeomCam = geom; } … … 63 87 void SetBlindPixel( const MCalibrationChargeBlindPix *b ) { fBlindPixel = b; } 64 88 65 // Setters only for MC!!89 void SetFFactorMethodValid( const Bool_t b = kTRUE ); 66 90 void SetBlindPixelMethodValid( const Bool_t b = kTRUE ); 67 91 void SetPINDiodeMethodValid( const Bool_t b = kTRUE ); 68 92 69 93 // Getters 70 Int_t GetSize() const;71 UInt_t GetNumPixels() const { return fNumPixels; }94 Int_t GetSize() const; 95 UInt_t GetNumPixels() const { return fNumPixels; } 72 96 73 Bool_t GetConversionFactorFFactor( Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma ); 74 Bool_t GetConversionFactorBlindPixel( Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma ); 75 Bool_t GetConversionFactorPINDiode( Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma ); 76 Bool_t GetConversionFactorCombined( Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma ); 97 Bool_t GetConversionFactorFFactor( Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma ); 98 Bool_t GetConversionFactorBlindPixel( Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma ); 99 Bool_t GetConversionFactorPINDiode( Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma ); 100 Bool_t GetConversionFactorCombined( Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma ); 101 102 Float_t GetMeanFluxPhesInnerPixel() const { return fMeanFluxPhesInnerPixel; } 103 Float_t GetMeanFluxPhesInnerPixelErr() const { return fMeanFluxPhesInnerPixelErr; } 104 Float_t GetMeanFluxPhesOuterPixel() const { return fMeanFluxPhesOuterPixel; } 105 Float_t GetMeanFluxPhesOuterPixelErr() const { return fMeanFluxPhesOuterPixelErr; } 106 107 Float_t GetMeanFluxPhotonsInnerPixel() const { return fMeanFluxPhotonsInnerPixel; } 108 Float_t GetMeanFluxPhotonsInnerPixelErr() const { return fMeanFluxPhotonsInnerPixelErr; } 109 Float_t GetMeanFluxPhotonsOuterPixel() const { return fMeanFluxPhotonsOuterPixel; } 110 Float_t GetMeanFluxPhotonsOuterPixelErr() const { return fMeanFluxPhotonsOuterPixelErr; } 77 111 78 112 Bool_t IsBlindPixelMethodValid() const; … … 105 139 Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const; 106 140 141 Bool_t CalcMeanFluxPhotonsFFactorMethod(); 142 107 143 void ApplyPINDiodeCalibration(); 108 144 void ApplyBlindPixelCalibration(); 145 void ApplyFFactorCalibration(); 109 146 110 147 ClassDef(MCalibrationChargeCam, 1) // Container for calibration information of the camera … … 112 149 113 150 #endif 114 115 116 117 118 -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargePix.cc
r3450 r3455 101 101 const Float_t MCalibrationChargePix::gkFFactorErr = 0.02; 102 102 103 const Float_t MCalibrationChargePix::gkAverageQE = 0.18;104 const Float_t MCalibrationChargePix::gkAverageQEErr = 0.02;105 103 const Float_t MCalibrationChargePix::gkConversionHiLo = 10.; 106 104 const Float_t MCalibrationChargePix::gkConversionHiLoErr = 2.5; … … 111 109 const Float_t MCalibrationChargePix::fgTimeLimit = 1.5; 112 110 const Float_t MCalibrationChargePix::fgTimeErrLimit = 3.; 113 const Float_t MCalibrationChargePix::fgConvFFactorRelErrLimit = 0.25;114 111 // -------------------------------------------------------------------------- 115 112 // … … 133 130 SetConversionHiLoErr(); 134 131 135 SetAverageQE();136 132 SetChargeLimit(); 137 133 SetChargeErrLimit(); … … 140 136 SetTimeLimit(); 141 137 SetTimeErrLimit(); 142 SetConvFFactorRelErrLimit();143 138 } 144 139 … … 565 560 bad->SetUnsuitableRun(); 566 561 } 567 568 562 } 569 563 … … 661 655 662 656 if (fRSigmaCharge < 0.) 657 { 658 SetFFactorMethodValid(kFALSE); 663 659 return kFALSE; 664 660 } 661 665 662 // 666 663 // Square all variables in order to avoid applications of square root … … 677 674 const Float_t ffactorsquareRelErrSquare = 4.*gkFFactorErr * gkFFactorErr / ffactorsquare; 678 675 679 const Float_t avQERelErrSquare = fAverageQEErr * fAverageQEErr / fAverageQE / fAverageQE;680 681 const Float_t avQEFFactor = TMath::Sqrt( ( 1. - fAverageQE ) / fAverageQE );682 const Float_t avQEFFactorErr = 1./ ( 2. * avQEFFactor ) * fAverageQEErr683 / ( fAverageQE * fAverageQE );684 685 const Float_t avQEFFactorRelErrSquare = avQEFFactorErr * avQEFFactorErr686 / ( avQEFFactor * avQEFFactor) ;687 676 688 677 const Float_t rsigmaSquare = fRSigmaCharge * fRSigmaCharge; … … 697 686 698 687 if (fPheFFactorMethod < 0.) 688 { 689 SetFFactorMethodValid(kFALSE); 699 690 return kFALSE; 700 691 } 692 701 693 // 702 694 // Calculate the Error of Nphe … … 707 699 fPheFFactorMethodErr = TMath::Sqrt(pheFFactorRelErrSquare) * fPheFFactorMethod; 708 700 709 // 710 // Calculate the conversion factor between PHOTONS and FADC counts 711 // 712 // Nphot = Nphe / avQE 713 // conv = Nphot / FADC counts 714 // 715 fMeanConversionFFactorMethod = fPheFFactorMethod / fAverageQE / GetMeanCharge(); 716 717 718 // 719 // Calculate the error of the mean conversion factor between PHOTONS and FADC counts 720 // 721 const Float_t convRelErrSquare = ( pheFFactorRelErrSquare + chargeRelErrSquare + avQERelErrSquare); 722 723 if (convRelErrSquare < 0.) 724 return kFALSE; 725 726 727 const Float_t convRelErr = TMath::Sqrt(convRelErrSquare); 728 fConversionFFactorMethodErr = convRelErr * fMeanConversionFFactorMethod; 729 730 if (convRelErr < fConvFFactorRelErrLimit) 731 SetFFactorMethodValid(); 732 733 // 734 // Calculate the Total F-Factor of the camera (in photons) 735 // 736 fTotalFFactorFFactorMethod = (fRSigmaCharge/GetMeanCharge())*TMath::Sqrt(fPheFFactorMethod); 737 fTotalFFactorFFactorMethod *= avQEFFactor; 738 739 // 740 // Calculate the error of the Total F-Factor of the camera ( in photons ) 741 // 742 const Float_t rsigmaChargeRelErrSquare = fRSigmaChargeErr * fRSigmaChargeErr 743 / (fRSigmaCharge * fRSigmaCharge) ; 744 745 fTotalFFactorErrFFactorMethod = TMath::Sqrt( rsigmaChargeRelErrSquare 746 + chargeRelErrSquare 747 + pheFFactorRelErrSquare 748 + avQEFFactorRelErrSquare ); 749 fTotalFFactorErrFFactorMethod *= fTotalFFactorFFactorMethod; 750 751 // 752 // Calculate the sigma of the conversion from FADC counts to photons 753 // 754 fSigmaConversionFFactorMethod = GetTotalFFactorFFactorMethod()*TMath::Sqrt(fMeanConversionFFactorMethod); 701 SetFFactorMethodValid(kTRUE); 755 702 756 703 return kTRUE; 757 704 } 705 706 758 707 759 708 void MCalibrationChargePix::ApplyLoGainConversion() -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargePix.h
r3435 r3455 11 11 private: 12 12 13 static const Float_t gkAverageQE; // The average quantum efficieny agreed on for the first analysis14 static const Float_t gkAverageQEErr; // The error of average quantum efficieny15 16 13 static const Float_t gkConversionHiLo; // The default conversion factor HI gain - Lo Gain 17 14 static const Float_t gkConversionHiLoErr; // The error of the default conversion factor … … 28 25 static const Float_t fgTimeLimit; // The limit (in units of FADC slices) for acceptance of the fitted time 29 26 static const Float_t fgTimeErrLimit; // The limit (in units of FADC slices) for acceptance of the fitted time sigma 30 static const Float_t fgConvFFactorRelErrLimit; // The limit for acceptance of the rel. error of the conversion factor with the FFactor method31 27 32 28 Float_t fChargeLimit; // The limit (in units of PedRMS) for acceptance of the fitted mean charge … … 36 32 Float_t fTimeLimit; // The limit (in units of FADC slices) for acceptance of the fitted time 37 33 Float_t fTimeErrLimit; // The limit (in units of FADC slices) for acceptance of the fitted time sigma 38 Float_t fConvFFactorRelErrLimit; // The limit for acceptance of the rel. error of the conversion factor with the FFactor method39 34 40 35 Float_t fElectronicPedRms; // The pure electronic component of the RMS … … 45 40 UInt_t fFlags; // Flag for the set bits 46 41 47 Float_t fAverageQE; // The average quantum efficieny (see Class description)48 Float_t fAverageQEErr; // The error of the average quantum efficieny (see Class description)49 50 42 Float_t fHiGainMeanCharge; // The mean reduced charge after the fit 51 43 Float_t fHiGainMeanChargeErr; // The error of reduced mean charge after the fit … … 139 131 void SetConversionHiLo( const Float_t c = gkConversionHiLo) { fConversionHiLo = c; } 140 132 void SetConversionHiLoErr( const Float_t e = gkConversionHiLoErr) { fConversionHiLoErr = e; } 141 void SetAverageQE( const Float_t qe= gkAverageQE,142 const Float_t err=gkAverageQEErr) { fAverageQE = qe;143 fAverageQEErr = err; }144 133 void SetChargeLimit ( const Float_t f=fgChargeLimit ) { fChargeLimit = f; } 145 134 void SetChargeErrLimit ( const Float_t f=fgChargeErrLimit ) { fChargeErrLimit = f; } … … 148 137 void SetTimeLimit ( const Float_t f=fgTimeLimit ) { fTimeLimit = f; } 149 138 void SetTimeErrLimit ( const Float_t f=fgTimeErrLimit ) { fTimeErrLimit = f; } 150 void SetConvFFactorRelErrLimit( const Float_t f=fgConvFFactorRelErrLimit ) { fConvFFactorRelErrLimit = f; }151 139 152 140 // Charges … … 177 165 void SetNumLoGainSamples ( const Float_t f ) { fNumLoGainSamples = f; } 178 166 179 // Setters for MC167 // Conversion Factors 180 168 void SetConversionFFactorMethod ( Float_t c, Float_t err, Float_t sig ); 181 169 void SetConversionBlindPixelMethod( Float_t c, Float_t err, Float_t sig ); … … 183 171 void SetConversionCombinedMethod ( Float_t c, Float_t err, Float_t sig ); 184 172 173 void SetTotalFFactorFFactorMethod ( const Float_t f) { fTotalFFactorFFactorMethod = f; } 174 void SetTotalFFactorBlindPixelMethod ( const Float_t f) { fTotalFFactorBlindPixelMethod = f; } 175 void SetTotalFFactorPINDiodeMethod ( const Float_t f) { fTotalFFactorPINDiodeMethod = f; } 176 177 void SetTotalFFactorErrFFactorMethod ( const Float_t f) { fTotalFFactorErrFFactorMethod = f; } 178 void SetTotalFFactorErrBlindPixelMethod ( const Float_t f) { fTotalFFactorErrBlindPixelMethod = f; } 179 void SetTotalFFactorErrPINDiodeMethod ( const Float_t f) { fTotalFFactorErrPINDiodeMethod = f; } 180 185 181 // Bit Setters 186 182 void SetHiGainSaturation ( const Bool_t b = kTRUE );
Note:
See TracChangeset
for help on using the changeset viewer.