Changeset 3065 for trunk/MagicSoft/Mars/mcalib/MCalibrationCam.cc
- Timestamp:
- 02/09/04 10:36:04 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mcalib/MCalibrationCam.cc
r3063 r3065 262 262 { 263 263 264 if (pix->IsCharge FitValid() && !pix->IsExcluded())264 if (pix->IsChargeValid() && !pix->IsExcluded()) 265 265 { 266 266 … … 284 284 { 285 285 286 if (!pix->IsCharge FitValid() && !pix->IsExcluded())286 if (!pix->IsChargeValid() && !pix->IsExcluded()) 287 287 { 288 288 … … 383 383 Float_t arearatio = cam.GetPixRatio(idx); 384 384 385 385 if (arearatio == 0) 386 386 return kFALSE; 387 387 … … 587 587 if (!(*this)[idx].IsFitted()) 588 588 return kFALSE; 589 if (!(*this)[idx].IsCharge FitValid())589 if (!(*this)[idx].IsChargeValid()) 590 590 val = 1; 591 591 else … … 702 702 const Float_t mean = fBlindPixel->GetLambda(); 703 703 const Float_t merr = fBlindPixel->GetErrLambda(); 704 705 // 706 // Start calculation of number of photons 707 // 708 // The blind pixel has exactly one cm^2 area (with negligible error), 709 // thus we omi division by 1. 710 // 711 fMeanPhotInsidePlexiglass = mean * gkCalibrationInnerPixelArea; 712 713 // Start calculation of number of photons relative Variance (!!) 714 fMeanPhotErrInsidePlexiglass = merr*merr/mean/mean; 715 fMeanPhotErrInsidePlexiglass += gkCalibrationInnerPixelAreaError*gkCalibrationInnerPixelAreaError 716 / gkCalibrationInnerPixelArea/gkCalibrationInnerPixelArea; 704 717 705 718 switch (fColor) 706 719 { 707 720 case kECGreen: 708 fMeanPhotInsidePlexiglass = (mean / gkCalibrationBlindPixelQEGreen) // real photons 709 *TMath::Power(10,gkCalibrationBlindPixelAttGreen) // correct for absorption 710 * gkCalibrationInnerPixelArea; // correct for area 711 712 721 fMeanPhotInsidePlexiglass /= gkCalibrationBlindPixelQEGreen; 722 fMeanPhotErrInsidePlexiglass += gkCalibrationBlindPixelQEGreenError*gkCalibrationBlindPixelQEGreenError 723 / gkCalibrationBlindPixelQEGreen / gkCalibrationBlindPixelQEGreen; 724 725 fMeanPhotInsidePlexiglass *= TMath::Power(10,gkCalibrationBlindPixelAttGreen); // correct for absorption 726 // attenuation has negligible error 713 727 break; 714 728 case kECBlue: 715 fMeanPhotInsidePlexiglass = (mean / gkCalibrationBlindPixelQEBlue ) 716 *TMath::Power(10,gkCalibrationBlindPixelAttBlue) 717 * gkCalibrationInnerPixelArea; 729 fMeanPhotInsidePlexiglass /= gkCalibrationBlindPixelQEBlue; 730 fMeanPhotErrInsidePlexiglass += gkCalibrationBlindPixelQEBlueError*gkCalibrationBlindPixelQEBlueError 731 / gkCalibrationBlindPixelQEBlue / gkCalibrationBlindPixelQEBlue; 732 733 fMeanPhotInsidePlexiglass *= TMath::Power(10,gkCalibrationBlindPixelAttBlue); // correct for absorption 734 // attenuation has negligible error 718 735 break; 719 736 case kECUV: 720 fMeanPhotInsidePlexiglass = (mean / gkCalibrationBlindPixelQEUV ) 721 *TMath::Power(10,gkCalibrationBlindPixelAttUV) 722 * gkCalibrationInnerPixelArea; 737 fMeanPhotInsidePlexiglass /= gkCalibrationBlindPixelQEUV; 738 fMeanPhotErrInsidePlexiglass += gkCalibrationBlindPixelQEUVError*gkCalibrationBlindPixelQEUVError 739 / gkCalibrationBlindPixelQEUV / gkCalibrationBlindPixelQEUV; 740 741 fMeanPhotInsidePlexiglass *= TMath::Power(10,gkCalibrationBlindPixelAttUV); // correct for absorption 742 // attenuation has negligible error 723 743 break; 724 744 case kECCT1: 725 745 default: 726 fMeanPhotInsidePlexiglass = (mean / gkCalibrationBlindPixelQECT1 ) 727 *TMath::Power(10,gkCalibrationBlindPixelAttCT1) 728 * gkCalibrationInnerPixelArea; 729 break; 730 } 731 732 SETBIT(fFlags,kNumPhotInsidePlexiglassAvailable); 746 fMeanPhotInsidePlexiglass /= gkCalibrationBlindPixelQECT1; 747 fMeanPhotErrInsidePlexiglass += gkCalibrationBlindPixelQECT1Error*gkCalibrationBlindPixelQECT1Error 748 / gkCalibrationBlindPixelQECT1 / gkCalibrationBlindPixelQECT1; 749 750 fMeanPhotInsidePlexiglass *= TMath::Power(10,gkCalibrationBlindPixelAttCT1); // correct for absorption 751 // attenuation has negligible error 752 break; 753 } 733 754 734 755 *fLog << inf << endl; 735 *fLog << inf << " Mean number of Photons for an Inner Pixel (inside Plexiglass): "756 *fLog << inf << " Mean number of Photons for an Inner Pixel (inside Plexiglass): " 736 757 << fMeanPhotInsidePlexiglass << endl; 758 759 if (fMeanPhotInsidePlexiglass > 0.) 760 SETBIT(fFlags,kNumPhotInsidePlexiglassAvailable); 761 else 762 { 763 CLRBIT(fFlags,kNumPhotInsidePlexiglassAvailable); 764 return kFALSE; 765 } 766 767 if (fMeanPhotErrInsidePlexiglass < 0.) 768 { 769 *fLog << warn << " Relative Variance on number of Photons for an Inner Pixel (inside Plexiglass): " 770 << fMeanPhotErrInsidePlexiglass << endl; 771 CLRBIT(fFlags,kNumPhotInsidePlexiglassAvailable); 772 return kFALSE; 773 } 774 775 // Finish calculation of errors -> convert from relative variance to absolute error 776 fMeanPhotErrInsidePlexiglass = TMath::Sqrt(fMeanPhotErrInsidePlexiglass); 777 fMeanPhotErrInsidePlexiglass *= fMeanPhotInsidePlexiglass; 778 779 *fLog << inf << " Error on number of Photons for an Inner Pixel (inside Plexiglass): " 780 << fMeanPhotErrInsidePlexiglass << endl; 781 *fLog << inf << endl; 782 783 737 784 738 785 TIter Next(fPixels); … … 740 787 while ((pix=(MCalibrationPix*)Next())) 741 788 { 742 if((pix->GetCharge() > 0.) && (fMeanPhotInsidePlexiglass > 0.)) 789 790 if(pix->IsChargeValid()) 743 791 { 744 792 745 Float_t conversion = fMeanPhotInsidePlexiglass/pix->GetCharge(); 746 Float_t conversionerr = 0.; 747 Float_t conversionsigma = 0.; 793 const Float_t charge = pix->GetCharge(); 794 const Float_t ratio = fGeomCam->GetPixRatio(pix->GetPixId()); 795 const Float_t chargeerr = pix->GetErrCharge(); 796 797 Float_t nphot; 798 Float_t nphoterr; 799 800 if (ratio == 1.) 801 { 802 nphot = fMeanPhotInsidePlexiglass; 803 nphoterr = fMeanPhotErrInsidePlexiglass; 804 } 805 else 806 { 807 nphot = fMeanPhotInsidePlexiglass*gkCalibrationOutervsInnerPixelArea; 808 nphoterr = fMeanPhotErrInsidePlexiglass*gkCalibrationOutervsInnerPixelArea 809 *fMeanPhotErrInsidePlexiglass*gkCalibrationOutervsInnerPixelArea; 810 nphoterr += fMeanPhotInsidePlexiglass*gkCalibrationOutervsInnerPixelAreaError 811 *fMeanPhotInsidePlexiglass*gkCalibrationOutervsInnerPixelAreaError; 812 nphoterr = TMath::Sqrt(nphoterr); 813 } 814 815 816 817 const Float_t conversion = nphot/charge; 818 Float_t conversionerr; 819 820 conversionerr = nphoterr/charge 821 * nphoterr/charge ; 822 conversionerr += chargeerr/charge 823 * chargeerr/charge 824 * conversion*conversion; 825 conversionerr = TMath::Sqrt(conversionerr); 826 827 const Float_t conversionsigma = 0.; 828 748 829 pix->SetConversionBlindPixelMethod(conversion, conversionerr, conversionsigma); 749 830 … … 764 845 const Float_t mean = fPINDiode->GetCharge(); 765 846 const Float_t merr = fPINDiode->GetErrCharge(); 847 848 // Start calculation of number of photons 849 fMeanPhotOutsidePlexiglass = mean * gkCalibrationInnerPixelvsPINDiodeArea; 850 851 // Start calculation of number of photons relative Variance (!!) 852 fMeanPhotErrOutsidePlexiglass = merr*merr/mean/mean; 853 fMeanPhotErrOutsidePlexiglass += gkCalibrationInnerPixelvsPINDiodeAreaError*gkCalibrationInnerPixelvsPINDiodeAreaError 854 / gkCalibrationInnerPixelvsPINDiodeArea/gkCalibrationInnerPixelvsPINDiodeArea; 766 855 767 856 switch (fColor) 768 857 { 769 858 case kECGreen: 770 fMeanPhotOutsidePlexiglass = (mean / gkCalibrationPINDiodeQEGreen) // real photons 771 * gkCalibrationInnerPixelvsPINDiodeArea; // correct for area 859 fMeanPhotOutsidePlexiglass /= gkCalibrationPINDiodeQEGreen; 860 fMeanPhotErrOutsidePlexiglass += gkCalibrationPINDiodeQEGreenError*gkCalibrationPINDiodeQEGreenError 861 / gkCalibrationPINDiodeQEGreen/gkCalibrationPINDiodeQEGreen; 772 862 break; 773 863 case kECBlue: 774 fMeanPhotOutsidePlexiglass = (mean / gkCalibrationPINDiodeQEBlue ) 775 * gkCalibrationInnerPixelvsPINDiodeArea; 776 break; 864 fMeanPhotOutsidePlexiglass /= gkCalibrationPINDiodeQEBlue; 865 fMeanPhotErrOutsidePlexiglass += gkCalibrationPINDiodeQEBlueError*gkCalibrationPINDiodeQEBlueError 866 / gkCalibrationPINDiodeQEBlue/gkCalibrationPINDiodeQEBlue; 867 break; 777 868 case kECUV: 778 fMeanPhotOutsidePlexiglass = (mean / gkCalibrationPINDiodeQEUV ) 779 * gkCalibrationInnerPixelvsPINDiodeArea; 869 fMeanPhotOutsidePlexiglass /= gkCalibrationPINDiodeQEUV; 870 fMeanPhotErrOutsidePlexiglass += gkCalibrationPINDiodeQEUVError*gkCalibrationPINDiodeQEUVError 871 / gkCalibrationPINDiodeQEUV/gkCalibrationPINDiodeQEUV; 780 872 break; 781 873 case kECCT1: 782 874 default: 783 fMeanPhotOutsidePlexiglass = (mean / gkCalibrationPINDiodeQECT1 )784 * gkCalibrationInnerPixelvsPINDiodeArea;785 break;786 }787 788 SETBIT(fFlags,kNumPhotOutsidePlexiglassAvailable); 875 fMeanPhotOutsidePlexiglass /= gkCalibrationPINDiodeQECT1; 876 fMeanPhotErrOutsidePlexiglass += gkCalibrationPINDiodeQECT1Error*gkCalibrationPINDiodeQECT1Error 877 / gkCalibrationPINDiodeQECT1/gkCalibrationPINDiodeQECT1; 878 break; 879 } 880 789 881 790 882 *fLog << inf << endl; 791 *fLog << inf << mean <<" Mean number of Photons for an Inner Pixel (outside Plexiglass): "883 *fLog << inf << " Mean number of Photons for an Inner Pixel (outside Plexiglass): " 792 884 << fMeanPhotOutsidePlexiglass << endl; 885 886 if (fMeanPhotOutsidePlexiglass > 0.) 887 SETBIT(fFlags,kNumPhotOutsidePlexiglassAvailable); 888 else 889 { 890 CLRBIT(fFlags,kNumPhotOutsidePlexiglassAvailable); 891 return kFALSE; 892 } 893 894 if (fMeanPhotErrOutsidePlexiglass < 0.) 895 { 896 *fLog << warn << "Relative Variance on number of Photons for an Inner Pixel (outside Plexiglass): " 897 << fMeanPhotErrOutsidePlexiglass << endl; 898 CLRBIT(fFlags,kNumPhotOutsidePlexiglassAvailable); 899 return kFALSE; 900 } 901 902 // Finish calculation of errors -> convert from relative variance to absolute error 903 fMeanPhotErrOutsidePlexiglass = TMath::Sqrt(fMeanPhotErrOutsidePlexiglass); 904 fMeanPhotErrOutsidePlexiglass *= fMeanPhotOutsidePlexiglass; 905 906 *fLog << inf << " Error on number of Photons for an Inner Pixel (outside Plexiglass): " 907 << fMeanPhotErrOutsidePlexiglass << endl; 793 908 *fLog << inf << endl; 794 909 … … 797 912 while ((pix=(MCalibrationPix*)Next())) 798 913 { 799 800 if((pix->GetCharge() > 0.) && (fMeanPhotInsidePlexiglass > 0.)) 801 pix->SetConversionPINDiodeMethod(fMeanPhotOutsidePlexiglass/pix->GetCharge(), 0., 0.); 914 915 if (pix->IsChargeValid()) 916 { 917 918 const Float_t charge = pix->GetCharge(); 919 const Float_t ratio = fGeomCam->GetPixRatio(pix->GetPixId()); 920 const Float_t chargeerr = pix->GetErrCharge(); 921 922 Float_t nphot; 923 Float_t nphoterr; 924 925 if (ratio == 1.) 926 { 927 nphot = fMeanPhotInsidePlexiglass; 928 nphoterr = fMeanPhotErrInsidePlexiglass; 929 } 930 else 931 { 932 nphot = fMeanPhotInsidePlexiglass*gkCalibrationOutervsInnerPixelArea; 933 nphoterr = fMeanPhotErrInsidePlexiglass*gkCalibrationOutervsInnerPixelArea 934 *fMeanPhotErrInsidePlexiglass*gkCalibrationOutervsInnerPixelArea; 935 nphoterr += fMeanPhotInsidePlexiglass*gkCalibrationOutervsInnerPixelAreaError 936 *fMeanPhotInsidePlexiglass*gkCalibrationOutervsInnerPixelAreaError; 937 nphoterr = TMath::Sqrt(nphoterr); 938 } 939 940 const Float_t conversion = nphot/charge; 941 Float_t conversionerr; 942 943 conversionerr = nphoterr/charge 944 * nphoterr/charge ; 945 conversionerr += chargeerr/charge 946 * chargeerr/charge 947 * conversion*conversion; 948 if (conversionerr > 0.) 949 conversionerr = TMath::Sqrt(conversionerr); 950 951 const Float_t conversionsigma = 0.; 952 953 pix->SetConversionBlindPixelMethod(conversion, conversionerr, conversionsigma); 954 955 if (conversionerr/conversion < 0.1) 956 pix->SetBlindPixelMethodValid(); 957 958 } 802 959 } 803 960 return kTRUE;
Note:
See TracChangeset
for help on using the changeset viewer.