Changeset 3511
- Timestamp:
- 03/15/04 17:53:38 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r3510 r3511 42 42 of sigmas to calculation of variances which saves all the useless 43 43 square rooting. 44 45 - took out pointers to MCalibraitonChargeBlindPix and 46 MCalibrationChargePINDiode in MCalibrationChargeCam. 44 47 45 48 -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc
r3496 r3511 279 279 return kFALSE; 280 280 281 fCam->SetPINDiode(fPINDiode);282 fCam->SetBlindPixel(fBlindPixel);283 284 281 fEvtTime = (MTime*)pList->FindObject("MTime"); 285 282 … … 558 555 { 559 556 fCam->SetBlindPixelMethodValid(kTRUE); 560 fCam->ApplyBlindPixelCalibration(*fGeom,*fBadPixels );557 fCam->ApplyBlindPixelCalibration(*fGeom,*fBadPixels, *fBlindPixel); 561 558 } 562 559 } … … 582 579 { 583 580 fCam->SetPINDiodeMethodValid(kTRUE); 584 fCam->ApplyPINDiodeCalibration(*fGeom,*fBadPixels );581 fCam->ApplyPINDiodeCalibration(*fGeom,*fBadPixels, *fPINDiode); 585 582 } 586 583 } -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.cc
r3496 r3511 141 141 const Float_t MCalibrationChargeCam::gkAverageQE = 0.18; 142 142 const Float_t MCalibrationChargeCam::gkAverageQEErr = 0.02; 143 const Float_t MCalibrationChargeCam::fgConvFFactorRelErrLimit = 0. 25;144 const Float_t MCalibrationChargeCam::fgPheFFactorRel Limit = 7.;143 const Float_t MCalibrationChargeCam::fgConvFFactorRelErrLimit = 0.35; 144 const Float_t MCalibrationChargeCam::fgPheFFactorRelErrLimit = 5.; 145 145 // -------------------------------------------------------------------------- 146 146 // … … 170 170 SetAverageQE(); 171 171 SetConvFFactorRelErrLimit(); 172 SetPheFFactorRel Limit();172 SetPheFFactorRelErrLimit(); 173 173 } 174 174 … … 263 263 fNumExcludedPixels = 0; 264 264 fMeanFluxPhesInnerPixel = 0.; 265 fMeanFluxPhesInnerPixel Err = 0.;265 fMeanFluxPhesInnerPixelVar = 0.; 266 266 fMeanFluxPhesOuterPixel = 0.; 267 fMeanFluxPhesOuterPixel Err = 0.;267 fMeanFluxPhesOuterPixelVar = 0.; 268 268 269 269 CLRBIT(fFlags,kBlindPixelMethodValid); … … 287 287 { 288 288 b ? SETBIT(fFlags, kPINDiodeMethodValid) : CLRBIT(fFlags, kPINDiodeMethodValid); 289 } 290 291 Float_t MCalibrationChargeCam::GetMeanFluxPhesInnerPixelErr() const 292 { 293 if (fMeanFluxPhesInnerPixelVar <= 0.) 294 return -1.; 295 return TMath::Sqrt(fMeanFluxPhesInnerPixelVar); 296 } 297 298 Float_t MCalibrationChargeCam::GetMeanFluxPhesOuterPixelErr() const 299 { 300 if (fMeanFluxPhesOuterPixelVar <= 0.) 301 return -1.; 302 return TMath::Sqrt(fMeanFluxPhesOuterPixelVar); 303 } 304 305 Float_t MCalibrationChargeCam::GetMeanFluxPhotonsInnerPixelErr() const 306 { 307 if (fMeanFluxPhotonsInnerPixelVar <= 0.) 308 return -1.; 309 return TMath::Sqrt(fMeanFluxPhotonsInnerPixelVar); 310 } 311 312 Float_t MCalibrationChargeCam::GetMeanFluxPhotonsOuterPixelErr() const 313 { 314 if (fMeanFluxPhotonsOuterPixelVar <= 0.) 315 return -1.; 316 return TMath::Sqrt(fMeanFluxPhotonsOuterPixelVar); 289 317 } 290 318 … … 506 534 return kFALSE; 507 535 if ((*this)[idx].GetRSigmaCharge() == -1.) 536 return kFALSE; 537 if ((*this)[idx].GetMeanCharge() == 0.) 538 return kFALSE; 539 val = (*this)[idx].GetRSigmaCharge() / (*this)[idx].GetMeanCharge(); 540 break; 541 case 8: 542 if ((*this)[idx].IsExcluded()) 543 return kFALSE; 544 if ((*this)[idx].GetRSigmaCharge() <= 0.) 508 545 return kFALSE; 509 val = (*this)[idx].GetRSigmaCharge() / (*this)[idx].GetMeanCharge(); 510 break; 511 case 8: 512 if ((*this)[idx].IsExcluded()) 513 return kFALSE; 514 if ((*this)[idx].GetRSigmaCharge() == -1.) 546 if ((*this)[idx].GetMeanCharge() <= 0.) 547 return kFALSE; 548 if ((*this)[idx].GetRSigmaChargeErr() <= 0.) 515 549 return kFALSE; 550 if ((*this)[idx].GetMeanChargeErr() <= 0.) 551 return kFALSE; 516 552 // relative error RsigmaCharge square 517 553 val = (*this)[idx].GetRSigmaChargeErr()* (*this)[idx].GetRSigmaChargeErr() … … 553 589 if ((*this)[idx].IsExcluded() || !(*this)[idx].IsFFactorMethodValid()) 554 590 return kFALSE; 555 val = (*this)[idx].GetTotalFFactor ErrFFactorMethod();591 val = (*this)[idx].GetTotalFFactorFFactorMethodErr(); 556 592 break; 557 593 case 15: 558 594 if ((*this)[idx].IsExcluded() || !(*this)[idx].IsBlindPixelMethodValid()) 559 595 return kFALSE; 560 val = fBlindPixel->GetMeanFluxInsidePlexiglass()*area; 596 // val = fBlindPixel->GetMeanFluxInsidePlexiglass()*area; 597 val = 1.; 561 598 break; 562 599 case 16: 563 600 if ((*this)[idx].IsExcluded() || !(*this)[idx].IsBlindPixelMethodValid()) 564 601 return kFALSE; 565 val = fBlindPixel->GetMeanFluxErrInsidePlexiglass()*area; 602 // val = fBlindPixel->GetMeanFluxErrInsidePlexiglass()*area; 603 val = 1.; 566 604 break; 567 605 case 17: … … 583 621 if ((*this)[idx].IsExcluded() || !(*this)[idx].IsBlindPixelMethodValid()) 584 622 return kFALSE; 585 val = (*this)[idx].GetTotalFFactor ErrBlindPixelMethod();623 val = (*this)[idx].GetTotalFFactorBlindPixelMethodErr(); 586 624 break; 587 625 case 21: 588 626 if ((*this)[idx].IsExcluded() || !(*this)[idx].IsPINDiodeMethodValid()) 589 627 return kFALSE; 590 val = fPINDiode->GetMeanFluxOutsidePlexiglass()*area; 628 // val = fPINDiode->GetMeanFluxOutsidePlexiglass()*area; 629 val = 1.; 591 630 break; 592 631 case 22: 593 632 if ((*this)[idx].IsExcluded() || !(*this)[idx].IsPINDiodeMethodValid()) 594 633 return kFALSE; 595 val = fPINDiode->GetMeanFluxErrOutsidePlexiglass()*area; 634 // val = fPINDiode->GetMeanFluxErrOutsidePlexiglass()*area; 635 val = 1.; 596 636 break; 597 637 case 23: … … 613 653 if ((*this)[idx].IsExcluded() || !(*this)[idx].IsPINDiodeMethodValid()) 614 654 return kFALSE; 615 val = (*this)[idx].GetTotalFFactor ErrPINDiodeMethod();655 val = (*this)[idx].GetTotalFFactorPINDiodeMethodErr(); 616 656 break; 617 657 case 27: … … 725 765 // which are fPheFFactorRelLimit sigmas from the mean. 726 766 // 727 Bool_t MCalibrationChargeCam::CalcMeanFluxPhotonsFFactorMethod(const MGeomCam &geom, const MBadPixelsCam &bad) 728 { 729 730 const Float_t avQERelErrSquare = fAverageQEErr * fAverageQEErr 731 / (fAverageQE * fAverageQE ); 767 Bool_t MCalibrationChargeCam::CalcMeanFluxPhotonsFFactorMethod(const MGeomCam &geom, MBadPixelsCam &bad) 768 { 769 770 const Float_t avQERelVar = fAverageQEVar / (fAverageQE * fAverageQE ); 732 771 733 772 Float_t sumweightsinner = 0.; … … 757 796 if (npheerr > 0.) 758 797 { 798 const Float_t weight = nphe*nphe/npheerr/npheerr; 759 799 // 760 800 // first the inner pixels: … … 762 802 if (ratio == 1.) 763 803 { 764 const Float_t weight = 1./npheerr/npheerr;765 804 sumweightsinner += weight; 766 805 sumphesinner += weight*nphe; … … 772 811 // now the outers 773 812 // 774 const Float_t weight = 1./npheerr/npheerr;775 813 sumweightsouter += weight; 776 814 sumphesouter += weight*nphe; … … 790 828 { 791 829 fMeanFluxPhesInnerPixel = sumphesinner/sumweightsinner; 792 fMeanFluxPhesInnerPixelErr = TMath::Sqrt(1./sumweightsinner); 793 830 fMeanFluxPhesInnerPixelVar = (1./sumweightsinner)*fMeanFluxPhesInnerPixel*fMeanFluxPhesInnerPixel; 794 831 } 795 832 … … 802 839 { 803 840 fMeanFluxPhesOuterPixel = sumphesouter/sumweightsouter; 804 fMeanFluxPhesOuterPixel Err = TMath::Sqrt(1./sumweightsouter);805 } 806 807 Float_t meanFluxPhotonsRel ErrSquare = fMeanFluxPhesInnerPixelErr * fMeanFluxPhesInnerPixelErr808 / (fMeanFluxPhesInnerPixel* fMeanFluxPhesInnerPixel);841 fMeanFluxPhesOuterPixelVar = (1./sumweightsouter)*fMeanFluxPhesOuterPixel*fMeanFluxPhesOuterPixel; 842 } 843 844 Float_t meanFluxPhotonsRelVar = fMeanFluxPhesInnerPixelVar 845 / (fMeanFluxPhesInnerPixel * fMeanFluxPhesInnerPixel); 809 846 810 847 fMeanFluxPhotonsInnerPixel = fMeanFluxPhesInnerPixel/fAverageQE; 811 fMeanFluxPhotonsInnerPixel Err = TMath::Sqrt(meanFluxPhotonsRelErrSquare + avQERelErrSquare)812 813 814 fMeanFluxPhotonsOuterPixel = 4. *fMeanFluxPhotonsInnerPixel;815 fMeanFluxPhotonsOuterPixel Err = 4.*fMeanFluxPhotonsInnerPixelErr;848 fMeanFluxPhotonsInnerPixelVar = (meanFluxPhotonsRelVar + avQERelVar) 849 * fMeanFluxPhotonsInnerPixel * fMeanFluxPhotonsInnerPixel; 850 851 fMeanFluxPhotonsOuterPixel = 4. *fMeanFluxPhotonsInnerPixel; 852 fMeanFluxPhotonsOuterPixelVar = 16.*fMeanFluxPhotonsInnerPixelVar; 816 853 854 *fLog << inf << " Mean number of photo-electrons from inner pixels (F-Factor Method): " 855 << fMeanFluxPhesInnerPixel << " +- " << GetMeanFluxPhesInnerPixelErr() << endl; 856 857 *fLog << inf << " Mean number of photons from inner pixels (F-Factor Method): " 858 << fMeanFluxPhotonsInnerPixel << " +- " << GetMeanFluxPhotonsInnerPixelErr() << endl; 859 817 860 // 818 861 // Here starts the second loop discarting pixels out of the range: 819 862 // 820 const Float_t innererr = TMath::Sqrt((Float_t)validinner)*fPheFFactorRelLimit*fMeanFluxPhesInnerPixelErr; 821 const Float_t outererr = TMath::Sqrt((Float_t)validouter)*fPheFFactorRelLimit*fMeanFluxPhesOuterPixelErr; 863 const Float_t innervar = (Float_t)validinner*fPheFFactorRelVarLimit*fMeanFluxPhesInnerPixelVar; 864 const Float_t outervar = (Float_t)validouter*fPheFFactorRelVarLimit*fMeanFluxPhesOuterPixelVar; 865 866 Float_t innererr; 867 Float_t outererr; 868 869 if (innervar > 0.) 870 innererr = TMath::Sqrt(innervar); 871 else 872 { 873 *fLog << warn << GetDescriptor() << ": Variance of mean number of photo-electrons for inner pixels " 874 << " is smaller than 0. " << endl; 875 SetFFactorMethodValid(kFALSE); 876 return kFALSE; 877 } 878 879 if (outervar > 0.) 880 outererr = TMath::Sqrt(outervar); 881 else 882 { 883 *fLog << warn << GetDescriptor() << ": Variance of mean number of photo-electrons for outer pixels " 884 << " is smaller than 0. " << endl; 885 SetFFactorMethodValid(kFALSE); 886 return kFALSE; 887 } 822 888 823 889 const Float_t lowerpheinnerlimit = fMeanFluxPhesInnerPixel - innererr; … … 851 917 if (npheerr > 0.) 852 918 { 919 const Float_t weight = nphe*nphe/npheerr/npheerr; 853 920 // 854 921 // first the inner pixels: … … 859 926 if (nphe < lowerpheinnerlimit || nphe > upperpheinnerlimit) 860 927 { 861 pix2->SetFFactorMethodValid(kFALSE);928 bad[idx].SetUnsuitable(MBadPixelsPix::kUnreliableRun); 862 929 continue; 863 930 } 864 931 865 const Float_t weight = 1./npheerr/npheerr;866 932 sumweightsinner += weight; 867 933 sumphesinner += weight*nphe; … … 874 940 if (nphe < lowerpheouterlimit || nphe > upperpheouterlimit) 875 941 { 876 pix2->SetFFactorMethodValid(kFALSE);942 bad[idx].SetUnsuitable(MBadPixelsPix::kUnreliableRun); 877 943 continue; 878 944 } 879 945 880 const Float_t weight = 1./npheerr/npheerr;881 946 sumweightsouter += weight; 882 947 sumphesouter += weight*nphe; … … 895 960 { 896 961 fMeanFluxPhesInnerPixel = sumphesinner/sumweightsinner; 897 fMeanFluxPhesInnerPixel Err = TMath::Sqrt(1./sumweightsinner);962 fMeanFluxPhesInnerPixelVar = (1./sumweightsinner)*fMeanFluxPhesInnerPixel*fMeanFluxPhesInnerPixel; 898 963 899 964 } … … 907 972 { 908 973 fMeanFluxPhesOuterPixel = sumphesouter/sumweightsouter; 909 fMeanFluxPhesOuterPixel Err = TMath::Sqrt(1./sumweightsouter);910 } 911 912 meanFluxPhotonsRel ErrSquare = fMeanFluxPhesInnerPixelErr * fMeanFluxPhesInnerPixelErr913 974 fMeanFluxPhesOuterPixelVar = (1./sumweightsouter)*fMeanFluxPhesOuterPixel*fMeanFluxPhesOuterPixel; 975 } 976 977 meanFluxPhotonsRelVar = fMeanFluxPhesInnerPixelVar 978 / (fMeanFluxPhesInnerPixel * fMeanFluxPhesInnerPixel); 914 979 915 980 fMeanFluxPhotonsInnerPixel = fMeanFluxPhesInnerPixel/fAverageQE; 916 fMeanFluxPhotonsInnerPixel Err = TMath::Sqrt(meanFluxPhotonsRelErrSquare + avQERelErrSquare)917 * fMeanFluxPhotonsInnerPixel ;918 919 fMeanFluxPhotonsOuterPixel = 4. *fMeanFluxPhotonsInnerPixel;920 fMeanFluxPhotonsOuterPixel Err = 4.*fMeanFluxPhotonsInnerPixelErr;981 fMeanFluxPhotonsInnerPixelVar = (meanFluxPhotonsRelVar + avQERelVar) 982 * fMeanFluxPhotonsInnerPixel * fMeanFluxPhotonsInnerPixel; 983 984 fMeanFluxPhotonsOuterPixel = 4. *fMeanFluxPhotonsInnerPixel; 985 fMeanFluxPhotonsOuterPixelVar = 16.*fMeanFluxPhotonsInnerPixelVar; 921 986 922 987 *fLog << inf << " Mean number of photo-electrons from inner pixels (F-Factor Method): " 923 << fMeanFluxPhesInnerPixel << " +- " << fMeanFluxPhesInnerPixelErr<< endl;988 << fMeanFluxPhesInnerPixel << " +- " << GetMeanFluxPhesInnerPixelErr() << endl; 924 989 925 990 *fLog << inf << " Mean number of photons from inner pixels (F-Factor Method): " 926 << fMeanFluxPhotonsInnerPixel << " +- " << fMeanFluxPhotonsInnerPixelErr<< endl;991 << fMeanFluxPhotonsInnerPixel << " +- " << GetMeanFluxPhotonsInnerPixelErr() << endl; 927 992 928 993 return kTRUE; … … 932 997 { 933 998 934 const Float_t meanphotRel ErrSquare = fMeanFluxPhotonsInnerPixelErr * fMeanFluxPhotonsInnerPixelErr935 999 const Float_t meanphotRelVar = fMeanFluxPhotonsInnerPixelVar 1000 /( fMeanFluxPhotonsInnerPixel * fMeanFluxPhotonsInnerPixel ); 936 1001 937 1002 TIter Next(fPixels); … … 971 1036 } 972 1037 973 const Float_t chargeRel ErrSquare= pix->GetMeanChargeErr() * pix->GetMeanChargeErr()974 975 const Float_t rsigmaChargeRel ErrSquare= pix->GetRSigmaChargeErr() * pix->GetRSigmaChargeErr()976 977 978 const Float_t convrel err = TMath::Sqrt(meanphotRelErrSquare + chargeRelErrSquare);979 980 if (convrel err > fConvFFactorRelErrLimit)1038 const Float_t chargeRelVar = pix->GetMeanChargeErr() * pix->GetMeanChargeErr() 1039 / ( pix->GetMeanCharge() * pix->GetMeanCharge()); 1040 const Float_t rsigmaChargeRelVar = pix->GetRSigmaChargeErr() * pix->GetRSigmaChargeErr() 1041 / (pix->GetRSigmaCharge() * pix->GetRSigmaCharge()) ; 1042 1043 const Float_t convrelvar = meanphotRelVar + chargeRelVar; 1044 1045 if (convrelvar > fConvFFactorRelVarLimit) 981 1046 { 982 *fLog << warn << GetDescriptor() << ": Conversion Factor F-Factor Method Rel. Error: "983 << convrel err << " above limit of: " << fConvFFactorRelErrLimit1047 *fLog << warn << GetDescriptor() << ": Conversion Factor F-Factor Method Rel. Variance: " 1048 << convrelvar << " above limit of: " << fConvFFactorRelVarLimit 984 1049 << " in pixel: " << idx << endl; 985 1050 pix->SetFFactorMethodValid(kFALSE); … … 996 1061 // Calculate the error of the Total F-Factor of the camera ( in photons ) 997 1062 // 998 const Float_t totalFFactorErr = TMath::Sqrt( rsigmaChargeRelErrSquare 999 + chargeRelErrSquare 1000 + meanphotRelErrSquare ); 1001 1002 pix->SetConversionFFactorMethod(conv, 1003 convrelerr*conv, 1004 totalFFactor*TMath::Sqrt(conv)); 1063 const Float_t totalFFactorVar = rsigmaChargeRelVar + chargeRelVar + meanphotRelVar; 1064 1065 if (convrelvar > 0. && conv > 0.) 1066 pix->SetConversionFFactorMethod(conv, 1067 TMath::Sqrt(convrelvar)*conv, 1068 totalFFactor*TMath::Sqrt(conv)); 1005 1069 1006 1070 pix->SetTotalFFactorFFactorMethod( totalFFactor ); 1007 pix->SetTotalFFactorErrFFactorMethod(totalFFactorErr); 1071 1072 if (totalFFactorVar > 0.) 1073 pix->SetTotalFFactorFFactorMethodErr(TMath::Sqrt(totalFFactorVar)); 1074 1008 1075 pix->SetFFactorMethodValid(); 1009 1076 } … … 1012 1079 1013 1080 1014 void MCalibrationChargeCam::ApplyBlindPixelCalibration(const MGeomCam &geom, const MBadPixelsCam &bad )1015 { 1016 1017 Float_t flux = fBlindPixel->GetMeanFluxInsidePlexiglass();1018 Float_t fluxerr = fBlindPixel->GetMeanFluxErrInsidePlexiglass();1081 void MCalibrationChargeCam::ApplyBlindPixelCalibration(const MGeomCam &geom, const MBadPixelsCam &bad, const MCalibrationChargeBlindPix &blindpix) 1082 { 1083 1084 Float_t flux = blindpix.GetMeanFluxInsidePlexiglass(); 1085 Float_t fluxerr = blindpix.GetMeanFluxErrInsidePlexiglass(); 1019 1086 1020 1087 TIter Next(fPixels); … … 1056 1123 } 1057 1124 1058 void MCalibrationChargeCam::ApplyPINDiodeCalibration(const MGeomCam &geom, const MBadPixelsCam &bad )1059 { 1060 1061 Float_t flux = fPINDiode->GetMeanFluxOutsidePlexiglass();1062 Float_t fluxerr = fPINDiode->GetMeanFluxErrOutsidePlexiglass();1125 void MCalibrationChargeCam::ApplyPINDiodeCalibration(const MGeomCam &geom, const MBadPixelsCam &bad, const MCalibrationChargePINDiode &pindiode) 1126 { 1127 1128 Float_t flux = pindiode.GetMeanFluxOutsidePlexiglass(); 1129 Float_t fluxerr = pindiode.GetMeanFluxErrOutsidePlexiglass(); 1063 1130 1064 1131 TIter Next(fPixels); … … 1137 1204 // and the number of photons reaching the plexiglass for one Inner Pixel 1138 1205 // 1139 // FIXME: The PINDiode is still not working and so is the code1140 //1141 1206 Bool_t MCalibrationChargeCam::GetConversionFactorPINDiode(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma) 1142 1207 { … … 1157 1222 // and the number of photons reaching one Inner Pixel. 1158 1223 // The procedure is not yet defined. 1159 //1160 // FIXME: The PINDiode is still not working and so is the code1161 1224 // 1162 1225 Bool_t MCalibrationChargeCam::GetConversionFactorCombined(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma) -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.h
r3479 r3511 26 26 27 27 static const Float_t fgConvFFactorRelErrLimit; // The limit for acceptance of the rel. error of the conversion factor with the FFactor method 28 static const Float_t fgPheFFactorRel Limit;// The rel. limit for acceptance of a calculated number of phe's w.r.t the mean number (in sigma of the error)28 static const Float_t fgPheFFactorRelErrLimit; // The rel. limit for acceptance of a calculated number of phe's w.r.t the mean number (in sigma of the error) 29 29 30 30 Float_t fAverageQE; // The average quantum efficieny (see Class description) 31 Float_t fAverageQE Err; // The error of the average quantum efficieny (see Class description)31 Float_t fAverageQEVar; // The error of the average quantum efficieny (see Class description) 32 32 33 Float_t fConvFFactorRel ErrLimit; // The limit for acceptance of the rel. error of the conversion factor with the FFactor method34 Float_t fPheFFactorRel Limit; // The rel. limit for acceptance of a calculated number of phe's w.r.t the mean number (in sigmaof the error).33 Float_t fConvFFactorRelVarLimit; // The limit for acceptance of the rel. error of the conversion factor with the FFactor method 34 Float_t fPheFFactorRelVarLimit; // The rel. limit for acceptance of a calculated number of phe's w.r.t the mean number (in variances of the error). 35 35 36 36 Int_t fNumPixels; … … 43 43 MBadPixelsPix *fAverageOuterBadPix; //-> Average Pixel of all events 44 44 45 const MCalibrationChargeBlindPix *fBlindPixel; //! Pointer to the Blind Pixel with fit results46 const MCalibrationChargePINDiode *fPINDiode; //! Pointer to the PIN Diode with fit results47 48 45 TH1D* fOffsets; //! 49 46 TH1D* fSlopes; //! … … 58 55 59 56 Float_t fMeanFluxPhesInnerPixel; // The mean number of photo-electrons in an INNER PIXEL 60 Float_t fMeanFluxPhesInnerPixel Err; // The uncertainty aboutthe number of photo-electrons INNER PIXEL57 Float_t fMeanFluxPhesInnerPixelVar; // The variance of the number of photo-electrons INNER PIXEL 61 58 Float_t fMeanFluxPhesOuterPixel; // The mean number of photo-electrons in an INNER PIXEL 62 Float_t fMeanFluxPhesOuterPixel Err; // The uncertainty aboutthe number of photo-electrons INNER PIXEL59 Float_t fMeanFluxPhesOuterPixelVar; // The variance of the number of photo-electrons INNER PIXEL 63 60 64 61 Float_t fMeanFluxPhotonsInnerPixel; // The mean number of photo-electrons in an INNER PIXEL 65 Float_t fMeanFluxPhotonsInnerPixel Err; // The uncertainty aboutthe number of photo-electrons INNER PIXEL62 Float_t fMeanFluxPhotonsInnerPixelVar; // The variance of the number of photo-electrons INNER PIXEL 66 63 Float_t fMeanFluxPhotonsOuterPixel; // The mean number of photo-electrons in an INNER PIXEL 67 Float_t fMeanFluxPhotonsOuterPixel Err; // The uncertainty aboutthe number of photo-electrons INNER PIXEL64 Float_t fMeanFluxPhotonsOuterPixelVar; // The variance of the number of photo-electrons INNER PIXEL 68 65 69 66 public: … … 78 75 void SetAverageQE( const Float_t qe= gkAverageQE, 79 76 const Float_t err=gkAverageQEErr) { fAverageQE = qe; 80 fAverageQE Err = err;}77 fAverageQEVar = err*err; } 81 78 void SetNumPixelsExcluded( const UInt_t n ) { fNumExcludedPixels = n; } 82 void SetConvFFactorRelErrLimit( const Float_t f=fgConvFFactorRelErrLimit ) { fConvFFactorRelErrLimit = f; } 83 void SetPheFFactorRelLimit ( const Float_t f=fgPheFFactorRelLimit ) { fPheFFactorRelLimit = f; } 84 85 void SetPINDiode ( const MCalibrationChargePINDiode *d ) { fPINDiode = d; } 86 void SetBlindPixel( const MCalibrationChargeBlindPix *b ) { fBlindPixel = b; } 79 void SetConvFFactorRelErrLimit( const Float_t f=fgConvFFactorRelErrLimit ) { fConvFFactorRelVarLimit = f*f; } 80 void SetPheFFactorRelErrLimit ( const Float_t f=fgPheFFactorRelErrLimit ) { fPheFFactorRelVarLimit = f*f; } 87 81 88 82 void SetFFactorMethodValid( const Bool_t b = kTRUE ); … … 100 94 101 95 Float_t GetMeanFluxPhesInnerPixel() const { return fMeanFluxPhesInnerPixel; } 102 Float_t GetMeanFluxPhesInnerPixelErr() const { return fMeanFluxPhesInnerPixelErr; }96 Float_t GetMeanFluxPhesInnerPixelErr() const; 103 97 Float_t GetMeanFluxPhesOuterPixel() const { return fMeanFluxPhesOuterPixel; } 104 Float_t GetMeanFluxPhesOuterPixelErr() const { return fMeanFluxPhesOuterPixelErr; }98 Float_t GetMeanFluxPhesOuterPixelErr() const; 105 99 106 100 Float_t GetMeanFluxPhotonsInnerPixel() const { return fMeanFluxPhotonsInnerPixel; } 107 Float_t GetMeanFluxPhotonsInnerPixelErr() const { return fMeanFluxPhotonsInnerPixelErr; }101 Float_t GetMeanFluxPhotonsInnerPixelErr() const; 108 102 Float_t GetMeanFluxPhotonsOuterPixel() const { return fMeanFluxPhotonsOuterPixel; } 109 Float_t GetMeanFluxPhotonsOuterPixelErr() const { return fMeanFluxPhotonsOuterPixelErr; }103 Float_t GetMeanFluxPhotonsOuterPixelErr() const; 110 104 111 105 Bool_t IsBlindPixelMethodValid() const; … … 138 132 Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const; 139 133 140 Bool_t CalcMeanFluxPhotonsFFactorMethod(const MGeomCam &geom, constMBadPixelsCam &bad);134 Bool_t CalcMeanFluxPhotonsFFactorMethod(const MGeomCam &geom, MBadPixelsCam &bad); 141 135 142 void ApplyPINDiodeCalibration(const MGeomCam &geom, const MBadPixelsCam &bad); 143 void ApplyBlindPixelCalibration(const MGeomCam &geom, const MBadPixelsCam &bad); 136 void ApplyPINDiodeCalibration(const MGeomCam &geom, 137 const MBadPixelsCam &bad, 138 const MCalibrationChargePINDiode &pindiode); 139 void ApplyBlindPixelCalibration(const MGeomCam &geom, 140 const MBadPixelsCam &bad, 141 const MCalibrationChargeBlindPix &blindpix); 144 142 void ApplyFFactorCalibration(const MGeomCam &geom, const MBadPixelsCam &bad); 145 143 -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargePix.cc
r3496 r3511 83 83 // since we might be applying it to PMTs in the totally wrong direction. 84 84 // 85 // 86 // Error of all variables are calculated by error-propagation. Note that internally, 87 // all error variables contain Variances in order to save the CPU-intensive square rooting 85 88 // 86 89 ///////////////////////////////////////////////////////////////////////////// … … 109 112 const Float_t MCalibrationChargePix::fgTimeLimit = 1.5; 110 113 const Float_t MCalibrationChargePix::fgTimeErrLimit = 3.; 114 const Float_t MCalibrationChargePix::fgPheFFactorMethodLimit = 5.; 111 115 // -------------------------------------------------------------------------- 112 116 // … … 136 140 SetTimeLimit(); 137 141 SetTimeErrLimit(); 142 SetPheFFactorMethodLimit(); 143 138 144 } 139 145 … … 156 162 157 163 fHiGainMeanCharge = -1.; 158 fHiGainMeanCharge Err = -1.;164 fHiGainMeanChargeVar = -1.; 159 165 fHiGainSigmaCharge = -1.; 160 fHiGainSigmaCharge Err = -1.;166 fHiGainSigmaChargeVar = -1.; 161 167 fHiGainChargeProb = -1.; 162 168 163 169 fLoGainMeanCharge = -1.; 164 fLoGainMeanCharge Err = -1.;170 fLoGainMeanChargeVar = -1.; 165 171 fLoGainSigmaCharge = -1.; 166 fLoGainSigmaCharge Err = -1.;172 fLoGainSigmaChargeVar = -1.; 167 173 fLoGainChargeProb = -1.; 168 174 169 175 fRSigmaCharge = -1.; 170 fRSigmaCharge Err = -1.;176 fRSigmaChargeVar = -1.; 171 177 172 178 fHiGainNumPickup = -1; … … 177 183 fPed = -1.; 178 184 fPedRms = -1.; 179 fPed Err = -1.;185 fPedVar = -1.; 180 186 181 187 fLoGainPedRms = -1.; 182 fLoGainPedRms Err = -1.;188 fLoGainPedRmsVar = -1.; 183 189 184 190 fTimeFirstHiGain = 0 ; … … 191 197 192 198 fPheFFactorMethod = -1.; 193 fPheFFactorMethod Err = -1.;199 fPheFFactorMethodVar = -1.; 194 200 195 201 fMeanConversionFFactorMethod = -1.; … … 198 204 fMeanConversionCombinedMethod = -1.; 199 205 200 fConversionFFactorMethod Err = -1.;201 fConversionBlindPixelMethod Err = -1.;202 fConversionPINDiodeMethod Err = -1.;203 fConversionCombinedMethod Err = -1.;206 fConversionFFactorMethodVar = -1.; 207 fConversionBlindPixelMethodVar = -1.; 208 fConversionPINDiodeMethodVar = -1.; 209 fConversionCombinedMethodVar = -1.; 204 210 205 211 fSigmaConversionFFactorMethod = -1.; … … 231 237 fPed = ped; 232 238 fPedRms = pedrms; 233 fPed Err =pederr;239 fPedVar = pederr*pederr; 234 240 } 235 241 … … 246 252 { 247 253 if (IsHiGainSaturation()) 248 fLoGainMeanCharge Err =f;254 fLoGainMeanChargeVar = f*f; 249 255 else 250 fHiGainMeanCharge Err =f;256 fHiGainMeanChargeVar = f*f; 251 257 252 258 } … … 264 270 { 265 271 if (IsHiGainSaturation()) 266 fLoGainSigmaCharge Err =f;272 fLoGainSigmaChargeVar = f*f; 267 273 else 268 fHiGainSigmaChargeErr = f; 269 270 } 271 272 274 fHiGainSigmaChargeVar = f*f; 275 276 } 273 277 274 278 // -------------------------------------------------------------------------- … … 279 283 { 280 284 fMeanConversionFFactorMethod = c; 281 fConversionFFactorMethod Err =err;285 fConversionFFactorMethodVar = err*err; 282 286 fSigmaConversionFFactorMethod = sig; 283 287 } … … 290 294 { 291 295 fMeanConversionCombinedMethod = c; 292 fConversionCombinedMethod Err =err;296 fConversionCombinedMethodVar = err*err; 293 297 fSigmaConversionCombinedMethod = sig; 294 298 } … … 302 306 { 303 307 fMeanConversionBlindPixelMethod = c; 304 fConversionBlindPixelMethod Err =err;308 fConversionBlindPixelMethodVar = err*err; 305 309 fSigmaConversionBlindPixelMethod = sig; 306 310 } … … 313 317 { 314 318 fMeanConversionPINDiodeMethod = c ; 315 fConversionPINDiodeMethod Err =err;319 fConversionPINDiodeMethodVar = err*err; 316 320 fSigmaConversionPINDiodeMethod = sig; 317 321 } … … 408 412 void MCalibrationChargePix::SetAbsTimeBordersLoGain(const Byte_t f, const Byte_t l) 409 413 { 410 411 414 fTimeFirstLoGain = f; 412 415 fTimeLastLoGain = l; 413 414 416 } 415 417 … … 421 423 Float_t MCalibrationChargePix::GetPedRmsErr() const 422 424 { 423 return IsHiGainSaturation() ? fLoGainPedRmsErr : fPedErr/2.; 425 return IsHiGainSaturation() ? TMath::Sqrt(fLoGainPedRmsVar) : TMath::Sqrt(fPedVar)/2.; 426 } 427 428 Float_t MCalibrationChargePix::GetPedErr() const 429 { 430 return TMath::Sqrt(fPedVar); 424 431 } 425 432 426 433 Float_t MCalibrationChargePix::GetMeanCharge() const 427 434 { 428 return IsHiGainSaturation() ? fLoGainMeanCharge : fHiGainMeanCharge;435 return IsHiGainSaturation() ? GetLoGainMeanCharge() : GetHiGainMeanCharge() ; 429 436 } 430 437 431 438 Float_t MCalibrationChargePix::GetMeanChargeErr() const 432 439 { 433 return IsHiGainSaturation() ? fLoGainMeanChargeErr : fHiGainMeanChargeErr;440 return IsHiGainSaturation() ? GetLoGainMeanChargeErr() : GetHiGainMeanChargeErr() ; 434 441 } 435 442 … … 441 448 Float_t MCalibrationChargePix::GetSigmaCharge() const 442 449 { 443 return IsHiGainSaturation() ? fLoGainSigmaCharge : fHiGainSigmaCharge;450 return IsHiGainSaturation() ? GetLoGainSigmaCharge() : GetHiGainSigmaCharge() ; 444 451 } 445 452 446 453 Float_t MCalibrationChargePix::GetSigmaChargeErr() const 447 454 { 448 return IsHiGainSaturation() ? fLoGainSigmaChargeErr : fHiGainSigmaChargeErr ; 455 return IsHiGainSaturation() ? GetLoGainSigmaChargeErr() : GetHiGainSigmaChargeErr() ; 456 } 457 458 Float_t MCalibrationChargePix::GetHiGainMeanChargeErr() const 459 { 460 return TMath::Sqrt(fHiGainMeanChargeVar); 461 } 462 463 Float_t MCalibrationChargePix::GetLoGainMeanCharge() const 464 { 465 return fLoGainMeanCharge * fConversionHiLo; 466 } 467 468 Float_t MCalibrationChargePix::GetLoGainMeanChargeErr() const 469 { 470 471 const Float_t chargeRelVar = fLoGainMeanChargeVar 472 /( fLoGainMeanCharge * fLoGainMeanCharge ); 473 474 const Float_t conversionRelVar = fConversionHiLoVar 475 /( fConversionHiLo * fConversionHiLo ); 476 477 return TMath::Sqrt(chargeRelVar+conversionRelVar) * GetLoGainMeanCharge(); 478 } 479 480 Float_t MCalibrationChargePix::GetLoGainSigmaCharge() const 481 { 482 return fLoGainSigmaCharge * fConversionHiLo; 483 } 484 485 Float_t MCalibrationChargePix::GetLoGainSigmaChargeErr() const 486 { 487 488 const Float_t sigmaRelVar = fLoGainSigmaChargeVar 489 /( fLoGainSigmaCharge * fLoGainSigmaCharge ); 490 491 const Float_t conversionRelVar = fConversionHiLoVar 492 /( fConversionHiLo * fConversionHiLo ); 493 494 return TMath::Sqrt(sigmaRelVar+conversionRelVar) * GetLoGainSigmaCharge(); 495 } 496 497 Float_t MCalibrationChargePix::GetHiGainSigmaChargeErr() const 498 { 499 return TMath::Sqrt(fHiGainSigmaChargeVar); 500 } 501 502 Float_t MCalibrationChargePix::GetRSigmaCharge() const 503 { 504 return IsHiGainSaturation() ? fRSigmaCharge*fConversionHiLo : fRSigmaCharge ; 505 } 506 507 Float_t MCalibrationChargePix::GetRSigmaChargeErr() const 508 { 509 if (IsHiGainSaturation()) 510 { 511 const Float_t rsigmaRelVar = fRSigmaChargeVar 512 /( fRSigmaCharge * fRSigmaCharge ); 513 const Float_t conversionRelVar = fConversionHiLoVar 514 /( fConversionHiLo * fConversionHiLo ); 515 return TMath::Sqrt(rsigmaRelVar+conversionRelVar) * GetRSigmaCharge(); 516 } 517 else 518 return TMath::Sqrt(fRSigmaChargeVar); 519 520 } 521 522 Float_t MCalibrationChargePix::GetConversionHiLoErr() const 523 { 524 if (fConversionHiLoVar < 0.) 525 return -1.; 526 return TMath::Sqrt(fConversionHiLoVar); 527 } 528 529 Float_t MCalibrationChargePix::GetPheFFactorMethodErr() const 530 { 531 if (fPheFFactorMethodVar < 0.) 532 return -1.; 533 return TMath::Sqrt(fPheFFactorMethodVar); 534 } 535 536 Float_t MCalibrationChargePix::GetConversionCombinedMethodErr() const 537 { 538 if (fConversionCombinedMethodVar < 0.) 539 return -1.; 540 return TMath::Sqrt(fConversionCombinedMethodVar); 541 } 542 543 Float_t MCalibrationChargePix::GetConversionPINDiodeMethodErr() const 544 { 545 if (fConversionPINDiodeMethodVar < 0.) 546 return -1.; 547 return TMath::Sqrt(fConversionPINDiodeMethodVar); 548 } 549 550 Float_t MCalibrationChargePix::GetConversionBlindPixelMethodErr() const 551 { 552 if (fConversionBlindPixelMethodVar < 0.) 553 return -1.; 554 return TMath::Sqrt(fConversionBlindPixelMethodVar); 555 } 556 557 Float_t MCalibrationChargePix::GetConversionFFactorMethodErr() const 558 { 559 if (fConversionFFactorMethodVar < 0.) 560 return -1.; 561 return TMath::Sqrt(fConversionFFactorMethodVar); 562 } 563 564 Float_t MCalibrationChargePix::GetTotalFFactorCombinedMethodErr() const 565 { 566 if (fTotalFFactorCombinedMethodVar < 0.) 567 return -1.; 568 return TMath::Sqrt(fTotalFFactorCombinedMethodVar); 569 } 570 571 Float_t MCalibrationChargePix::GetTotalFFactorPINDiodeMethodErr() const 572 { 573 if (fTotalFFactorPINDiodeMethodVar < 0.) 574 return -1.; 575 return TMath::Sqrt(fTotalFFactorPINDiodeMethodVar); 576 } 577 578 Float_t MCalibrationChargePix::GetTotalFFactorBlindPixelMethodErr() const 579 { 580 if (fTotalFFactorBlindPixelMethodVar < 0.) 581 return -1.; 582 return TMath::Sqrt(fTotalFFactorBlindPixelMethodVar); 583 } 584 585 Float_t MCalibrationChargePix::GetTotalFFactorFFactorMethodErr() const 586 { 587 if (fTotalFFactorFFactorMethodVar < 0.) 588 return -1.; 589 return TMath::Sqrt(fTotalFFactorFFactorMethodVar); 449 590 } 450 591 … … 454 595 } 455 596 456 457 597 Bool_t MCalibrationChargePix::IsExcluded() const 458 598 { … … 505 645 // 506 646 // 1) Pixel has a fitted charge greater than fChargeLimit*PedRMS 507 // 2) Pixel has a fit error greater than fCharge ErrLimit508 // 3) Pixel has a fitted charge greater its fChargeRel ErrLimit times its charge error647 // 2) Pixel has a fit error greater than fChargeVarLimit 648 // 3) Pixel has a fitted charge greater its fChargeRelVarLimit times its charge error 509 649 // 4) Pixel has a charge sigma bigger than its Pedestal RMS 510 650 // … … 520 660 } 521 661 522 if (GetMeanChargeErr() < fChargeErrLimit) 523 { 524 *fLog << warn << "WARNING: Error of Fitted Charge is smaller than " 525 << fChargeErrLimit << " in Pixel " << fPixId << endl; 662 const Float_t meanchargevar = IsHiGainSaturation() ? fLoGainMeanChargeVar : fHiGainMeanChargeVar; 663 664 if (meanchargevar < fChargeVarLimit) 665 { 666 *fLog << warn << "WARNING: Variance of Fitted Charge is smaller than " 667 << meanchargevar << " in Pixel " << fPixId << endl; 526 668 bad->SetChargeErrNotValid(); 527 669 bad->SetUnsuitable(MBadPixelsPix::kUnsuitableRun); 528 670 } 529 671 530 if (GetMeanCharge() < fChargeRelErrLimit*GetMeanChargeErr())672 if (GetMeanCharge()*GetMeanCharge() < fChargeRelVarLimit*meanchargevar) 531 673 { 532 674 *fLog << warn << "WARNING: Fitted Charge is smaller than " 533 << fChargeRelErrLimit<< "* its error in Pixel " << fPixId << endl;675 << TMath::Sqrt(fChargeRelVarLimit) << "* its error in Pixel " << fPixId << endl; 534 676 bad->SetChargeRelErrNotValid(); 535 677 bad->SetUnsuitable(MBadPixelsPix::kUnsuitableRun); … … 577 719 { 578 720 579 Float_t pedRmsSquare = fPedRms * fPedRms; 580 Float_t pedRmsSquareErrSquare = fPedErr * fPedErr * pedRmsSquare; // fPedRmsErr = fPedErr/2. 581 Float_t pedRmsSquareErr; 721 Float_t pedRmsSquare = fPedRms * fPedRms; 722 Float_t pedRmsSquareVar = fPedVar * pedRmsSquare; // fPedRmsErr = fPedErr/2. 582 723 583 724 // … … 587 728 // We extract the pure NSB contribution: 588 729 // 589 const Float_t elecRmsSquare 590 const Float_t elecRmsSquare ErrSquare = 4.*fElectronicPedRmsErr * fElectronicPedRmsErr * elecRmsSquare;730 const Float_t elecRmsSquare = fElectronicPedRms * fElectronicPedRms; 731 const Float_t elecRmsSquareVar = 4.*fElectronicPedRmsVar * elecRmsSquare; 591 732 592 Float_t nsbSquare = pedRmsSquare 593 Float_t nsbSquareRel ErrSquare = (pedRmsSquareErrSquare + elecRmsSquareErrSquare)733 Float_t nsbSquare = pedRmsSquare - elecRmsSquare; 734 Float_t nsbSquareRelVar = (pedRmsSquareVar + elecRmsSquareVar) 594 735 / (nsbSquare * nsbSquare) ; 595 736 596 737 if (nsbSquare < 0.) 597 738 nsbSquare = 0.; 598 739 599 740 // … … 601 742 // add it quadratically to the electronic noise 602 743 // 603 const Float_t conversionSquare = fConversionHiLo * fConversionHiLo; 604 const Float_t conversionSquareRelErrSquare = 4.*fConversionHiLoErr * fConversionHiLoErr / conversionSquare; 744 const Float_t conversionSquare = fConversionHiLo * fConversionHiLo; 745 const Float_t convertedNsbSquare = nsbSquare / conversionSquare; 746 const Float_t convertedNsbSquareVar = nsbSquareRelVar 747 * convertedNsbSquare * convertedNsbSquare; 605 748 606 const Float_t convertedNsbSquare = nsbSquare / conversionSquare; 607 const Float_t convertedNsbSquareErrSquare = (nsbSquareRelErrSquare + conversionSquareRelErrSquare) 608 * convertedNsbSquare * convertedNsbSquare; 749 pedRmsSquare = convertedNsbSquare + elecRmsSquare; 750 pedRmsSquareVar = convertedNsbSquareVar + elecRmsSquareVar; 609 751 610 pedRmsSquare = convertedNsbSquare + elecRmsSquare; 611 pedRmsSquareErr = TMath::Sqrt( convertedNsbSquareErrSquare + elecRmsSquareErrSquare ); 612 613 // 614 // Correct also for the conversion to Hi-Gain: 615 // 616 fLoGainPedRms = TMath::Sqrt(pedRmsSquare) * fConversionHiLo; 617 fLoGainPedRmsErr = 0.5 * pedRmsSquareErr / fLoGainPedRms * fConversionHiLo; 618 } 619 752 fLoGainPedRms = TMath::Sqrt(pedRmsSquare); 753 fLoGainPedRmsVar = 0.25 * pedRmsSquareVar / pedRmsSquare; 754 755 } 756 757 // 758 // 759 // 620 760 Bool_t MCalibrationChargePix::CalcReducedSigma() 621 761 { 622 762 623 const Float_t sigmaSquare = GetSigmaCharge() * GetSigmaCharge(); 624 const Float_t sigmaSquareErrSquare = 4.*GetSigmaChargeErr()* GetSigmaChargeErr() * sigmaSquare; 625 626 Float_t pedRmsSquare; 627 Float_t pedRmsSquareErrSquare; 763 const Float_t sigmacharge = IsHiGainSaturation() ? fLoGainSigmaCharge : fHiGainSigmaCharge ; 764 const Float_t sigmachargevar = IsHiGainSaturation() ? fLoGainSigmaChargeVar : fHiGainSigmaChargeVar; 765 766 const Float_t sigmaSquare = sigmacharge * sigmacharge; 767 const Float_t sigmaSquareVar = 4.* sigmachargevar * sigmaSquare; 768 769 Float_t pedRmsSquare ; 770 Float_t pedRmsSquareVar; 628 771 629 772 if (IsHiGainSaturation()) 630 {631 pedRmsSquare 632 pedRmsSquare ErrSquare = 4.* fLoGainPedRmsErr * fLoGainPedRmsErr * pedRmsSquare;773 { 774 pedRmsSquare = fLoGainPedRms * fLoGainPedRms; 775 pedRmsSquareVar = 4.* fLoGainPedRmsVar * pedRmsSquare; 633 776 } 634 777 else 635 778 { 636 637 pedRmsSquare = fPedRms * fPedRms; 638 pedRmsSquareErrSquare = fPedErr * fPedErr * pedRmsSquare; // fPedRmsErr = fPedErr/2. 779 pedRmsSquare = fPedRms * fPedRms; 780 pedRmsSquareVar = fPedVar * pedRmsSquare; // fPedRmsErr = fPedErr/2. 639 781 } 640 782 // … … 642 784 // 643 785 const Float_t rsigmachargesquare = sigmaSquare - pedRmsSquare; 644 645 786 if (rsigmachargesquare <= 0.) 646 787 { … … 651 792 } 652 793 794 653 795 fRSigmaCharge = TMath::Sqrt(rsigmachargesquare); 654 fRSigmaCharge Err = TMath::Sqrt(sigmaSquareErrSquare + pedRmsSquareErrSquare) / 2. / fRSigmaCharge;796 fRSigmaChargeVar = 0.25 * (sigmaSquareVar + pedRmsSquareVar) / rsigmachargesquare; 655 797 656 798 return kTRUE; … … 670 812 } 671 813 814 const Float_t charge = IsHiGainSaturation() ? fLoGainMeanCharge : fHiGainMeanCharge ; 815 const Float_t chargevar = IsHiGainSaturation() ? fLoGainMeanChargeVar : fHiGainMeanChargeVar; 816 672 817 // 673 818 // Square all variables in order to avoid applications of square root … … 675 820 // First the relative error squares 676 821 // 677 const Float_t chargeSquare = GetMeanCharge() * GetMeanCharge(); 678 const Float_t chargeSquareRelErrSquare = 4.* GetMeanChargeErr() * GetMeanChargeErr() / chargeSquare; 679 680 const Float_t ffactorsquare = gkFFactor * gkFFactor; 681 const Float_t ffactorsquareRelErrSquare = 4.*gkFFactorErr * gkFFactorErr / ffactorsquare; 682 683 684 const Float_t rsigmaSquare = fRSigmaCharge * fRSigmaCharge; 685 const Float_t rsigmaSquareRelErrSquare = 4.* fRSigmaChargeErr * fRSigmaChargeErr / rsigmaSquare; 686 822 const Float_t chargeSquare = charge * charge; 823 const Float_t chargeSquareRelVar = 4.* chargevar/ chargeSquare; 824 825 const Float_t ffactorsquare = gkFFactor * gkFFactor; 826 const Float_t ffactorsquareRelVar = 4.*gkFFactorErr * gkFFactorErr / ffactorsquare; 827 828 const Float_t rsigmaSquare = fRSigmaCharge * fRSigmaCharge; 829 const Float_t rsigmaSquareRelVar = 4.* fRSigmaChargeVar / rsigmaSquare; 687 830 688 831 // … … 692 835 fPheFFactorMethod = ffactorsquare * chargeSquare / rsigmaSquare; 693 836 694 if (fPheFFactorMethod < 0.)837 if (fPheFFactorMethod < fPheFFactorMethodLimit) 695 838 { 696 839 SetFFactorMethodValid(kFALSE); … … 701 844 // Calculate the Error of Nphe 702 845 // 703 const Float_t pheFFactorRelErrSquare = ffactorsquareRelErrSquare 704 + chargeSquareRelErrSquare 705 + rsigmaSquareRelErrSquare; 706 fPheFFactorMethodErr = TMath::Sqrt(pheFFactorRelErrSquare) * fPheFFactorMethod; 846 fPheFFactorMethodVar = (ffactorsquareRelVar + chargeSquareRelVar + rsigmaSquareRelVar) 847 * fPheFFactorMethod * fPheFFactorMethod; 707 848 708 849 SetFFactorMethodValid(kTRUE); 709 710 850 return kTRUE; 711 851 } … … 715 855 { 716 856 717 const Float_t chargeRelErrSquare = fLoGainMeanChargeErr * fLoGainMeanChargeErr 718 /( fLoGainMeanCharge * fLoGainMeanCharge ); 719 const Float_t sigmaRelErrSquare = fLoGainSigmaChargeErr * fLoGainSigmaChargeErr 720 /( fLoGainSigmaCharge * fLoGainSigmaCharge ); 721 const Float_t conversionRelErrSquare = fConversionHiLoErr * fConversionHiLoErr 722 /( fConversionHiLo * fConversionHiLo ); 723 724 fLoGainMeanCharge *= fConversionHiLo; 725 fLoGainMeanChargeErr = TMath::Sqrt(chargeRelErrSquare + conversionRelErrSquare) * fLoGainMeanCharge; 726 727 fLoGainSigmaCharge *= fConversionHiLo; 728 fLoGainSigmaChargeErr = TMath::Sqrt(sigmaRelErrSquare + conversionRelErrSquare) * fLoGainSigmaCharge; 729 730 fElectronicPedRms = gkElectronicPedRms * TMath::Sqrt(fNumLoGainSamples); 731 fElectronicPedRmsErr = gkElectronicPedRmsErr * TMath::Sqrt(fNumLoGainSamples); 857 fElectronicPedRms = gkElectronicPedRms * TMath::Sqrt(fNumLoGainSamples); 858 fElectronicPedRmsVar = gkElectronicPedRmsErr * gkElectronicPedRmsErr * fNumLoGainSamples; 732 859 733 860 CalcLoGainPed(); 734 735 } 736 737 861 } 862 863
Note:
See TracChangeset
for help on using the changeset viewer.