Changeset 4774 for trunk/MagicSoft/Mars/mcalib
- Timestamp:
- 08/27/04 18:09:50 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc
r4672 r4774 741 741 PrintUncalibrated(MBadPixelsPix::kChargeRelErrNotValid, 742 742 Form("%s%2.1f%s","Signal Error bigger than ",fChargeRelErrLimit," times Mean Signal: ")); 743 PrintUncalibrated(MBadPixelsPix::kChargeSigmaNotValid,744 "Signal Sigma smaller than Pedestal RMS: ");745 743 PrintUncalibrated(MBadPixelsPix::kLoGainSaturation, 746 744 "Pixels with Low Gain Saturation: "); … … 757 755 *fLog << GetDescriptor() << ": Unreliable errors statistics:" << endl; 758 756 757 PrintUncalibrated(MBadPixelsPix::kChargeSigmaNotValid, 758 "Signal Sigma smaller than Pedestal RMS: "); 759 759 PrintUncalibrated(MBadPixelsPix::kHiGainOscillating, 760 760 "Pixels with changing Hi Gain signal over time: "); … … 824 824 // 825 825 // Calls MCalibrationChargePix::CalcReducedSigma() and sets flag: MBadPixelsPix::kChargeIsPedestal 826 // if not succesful. 827 // 828 // Calls MCalibrationChargePix::CalcFFactorMethod() and sets flag: MBadPixelsPix::kDeviatingNumPhes) 829 // if not succesful. 826 // and returns kFALSE if not succesful. 827 // 828 // Calls MCalibrationChargePix::CalcFFactor() and sets flag: MBadPixelsPix::kDeviatingNumPhes) 829 // and returns kFALSE if not succesful. 830 // 831 // Calls MCalibrationChargePix::CalcConvFFactor()and sets flag: MBadPixelsPix::kDeviatingNumPhes) 832 // and returns kFALSE if not succesful. 830 833 // 831 834 Bool_t MCalibrationChargeCalc::FinalizeCharges(MCalibrationChargePix &cal, MBadPixelsPix &bad, const char* what) … … 857 860 << Form(" Ped. RMS: %5.2f in %s%4i",cal.GetPedRms(),what,cal.GetPixId()) << endl; 858 861 bad.SetUncalibrated( MBadPixelsPix::kChargeSigmaNotValid ); 862 return kFALSE; 859 863 } 860 864 … … 865 869 << Form(" %4i",cal.GetPixId()) 866 870 << endl; 867 bad.SetUncalibrated( MBadPixelsPix::kChargeIsPedestal);871 bad.SetUncalibrated( MBadPixelsPix::kChargeSigmaNotValid ); 868 872 return kFALSE; 869 873 } 870 874 871 if (!cal.CalcFFactor Method())875 if (!cal.CalcFFactor()) 872 876 { 873 877 *fLog << warn << GetDescriptor() … … 879 883 } 880 884 885 if (!cal.CalcConvFFactor()) 886 { 887 *fLog << warn << GetDescriptor() 888 << Form(": Could not calculate the Conv. FADC counts to Phes in %s: ",what) 889 << Form(" %4i",cal.GetPixId()) 890 << endl; 891 bad.SetUncalibrated(MBadPixelsPix::kDeviatingNumPhes); 892 return kFALSE; 893 } 894 881 895 return kTRUE; 882 896 } … … 889 903 // - MBadPixelsPix::kChargeIsPedestal 890 904 // - MBadPixelsPix::kChargeRelErrNotValid 891 // - MBadPixelsPix::kChargeSigmaNotValid892 905 // - MBadPixelsPix::kMeanTimeInFirstBin 893 906 // - MBadPixelsPix::kMeanTimeInLast2Bins … … 895 908 // 896 909 // - Call MCalibrationPix::SetExcluded() for the bad pixels 910 // 911 // Sets pixel to MBadPixelsPix::kUnreliableRun, if one of the following flags is set: 912 // - MBadPixelsPix::kChargeSigmaNotValid 897 913 // 898 914 void MCalibrationChargeCalc::FinalizeBadPixels() … … 914 930 bad.SetUnsuitable( MBadPixelsPix::kUnsuitableRun ); 915 931 916 if (bad.IsUncalibrated( MBadPixelsPix::kChargeSigmaNotValid ))917 bad.SetUnsuitable( MBadPixelsPix::kUnsuitableRun );918 919 932 if (bad.IsUncalibrated( MBadPixelsPix::kMeanTimeInFirstBin )) 920 933 bad.SetUnsuitable( MBadPixelsPix::kUnsuitableRun ); … … 929 942 pix.SetExcluded(); 930 943 944 if (bad.IsUncalibrated( MBadPixelsPix::kChargeSigmaNotValid )) 945 bad.SetUnsuitable( MBadPixelsPix::kUnreliableRun ); 931 946 } 932 947 } … … 936 951 // 937 952 // First loop: Calculate a mean and mean RMS of photo-electrons per area index 938 // Include only pixels which are not MBadPixelsPix::kUnsuitableRun or939 // MBadPixelsPix::k UnreliableRun(see FinalizeBadPixels()) and set953 // Include only pixels which are not MBadPixelsPix::kUnsuitableRun nor 954 // MBadPixelsPix::kChargeSigmaNotValid (see FinalizeBadPixels()) and set 940 955 // MCalibrationChargePix::SetFFactorMethodValid(kFALSE) in that case. 941 956 // 942 // Second loop: Get weightedmean number of photo-electrons and its RMS including957 // Second loop: Get mean number of photo-electrons and its RMS including 943 958 // only pixels with flag MCalibrationChargePix::IsFFactorMethodValid() 944 959 // and further exclude those deviating by more than fPheErrLimit mean 945 960 // sigmas from the mean (obtained in first loop). Set 946 961 // MBadPixelsPix::kDeviatingNumPhes if excluded. 962 // 963 // For the suitable pixels with flag MBadPixelsPix::kChargeSigmaNotValid 964 // set the number of photo-electrons as the mean number of photo-electrons 965 // calculated in that area index. 947 966 // 948 967 // Set weighted mean and variance of photo-electrons per area index in: … … 953 972 // average sector pixels of MCalibrationChargeCam (obtained from: 954 973 // MCalibrationChargeCam::GetAverageSector() ) 974 // 975 // 976 // Third loop: Set mean number of photo-electrons and its RMS in the pixels 977 // only excluded as: MBadPixelsPix::kChargeSigmaNotValid 955 978 // 956 979 Bool_t MCalibrationChargeCalc::FinalizeFFactorMethod() … … 999 1022 } 1000 1023 1001 // if (bad.IsUnsuitable(MBadPixelsPix::kUnreliableRun))1002 //continue;1024 if (bad.IsUncalibrated(MBadPixelsPix::kChargeSigmaNotValid)) 1025 continue; 1003 1026 1004 1027 const Float_t nphe = pix.GetPheFFactorMethod(); … … 1109 1132 continue; 1110 1133 1134 MBadPixelsPix &bad = (*fBadPixels)[i]; 1135 1136 if (bad.IsUncalibrated(MBadPixelsPix::kChargeSigmaNotValid)) 1137 continue; 1138 1111 1139 const Float_t nvar = pix.GetPheFFactorMethodVar(); 1112 1140 … … 1117 1145 } 1118 1146 1119 MBadPixelsPix &bad = (*fBadPixels)[i];1120 1121 1147 const Int_t aidx = (*fGeom)[i].GetAidx(); 1122 1148 const Int_t sector = (*fGeom)[i].GetSector(); … … 1232 1258 } 1233 1259 1260 // 1261 // Third loop: Set mean number of photo-electrons and its RMS in the pixels 1262 // only excluded as: MBadPixelsPix::kChargeSigmaNotValid 1263 // 1264 for (UInt_t i=0; i<npixels; i++) 1265 { 1266 1267 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[i]; 1268 MBadPixelsPix &bad = (*fBadPixels)[i]; 1269 1270 if (!pix.IsFFactorMethodValid()) 1271 continue; 1272 1273 const Int_t aidx = (*fGeom)[i].GetAidx(); 1274 1275 if (bad.IsUncalibrated(MBadPixelsPix::kChargeSigmaNotValid)) 1276 { 1277 MCalibrationChargePix &apix = (MCalibrationChargePix&)fCam->GetAverageArea(aidx); 1278 pix.SetPheFFactorMethod ( apix.GetPheFFactorMethod() ); 1279 pix.SetPheFFactorMethodVar( apix.GetPheFFactorMethodVar() ); 1280 if (!pix.CalcConvFFactor()) 1281 { 1282 *fLog << warn << GetDescriptor() 1283 << ": Could not calculate the Conv. FADC counts to Phes in pixel: " 1284 << Form(" %4i",pix.GetPixId()) 1285 << endl; 1286 bad.SetUncalibrated( MBadPixelsPix::kDeviatingNumPhes ); 1287 bad.SetUnsuitable ( MBadPixelsPix::kUnsuitableRun ); 1288 } 1289 } 1290 } 1291 1234 1292 return kTRUE; 1235 1293 } … … 1523 1581 const Float_t qe = pix.GetPheFFactorMethod() / photons ; 1524 1582 1525 if (!pix.CalcMeanFFactor( photons , avphotrelvar ))1526 {1527 (*fBadPixels)[i].SetUncalibrated( MBadPixelsPix::kDeviatingNumPhes );1528 continue;1529 }1530 1531 1583 const Float_t qerelvar = avphotrelvar + pix.GetPheFFactorMethodRelVar(); 1532 1584 … … 1538 1590 *fLog << warn << GetDescriptor() 1539 1591 << ": Cannot update Quantum efficiencies with the F-Factor Method" << endl; 1592 1593 // 1594 // The following pixels are those with deviating sigma, but otherwise OK, 1595 // probably those with stars during the pedestal run, but not the cal. run. 1596 // 1597 if (!pix.CalcMeanFFactor( photons , avphotrelvar )) 1598 { 1599 (*fBadPixels)[i].SetUncalibrated( MBadPixelsPix::kDeviatingFFactor ); 1600 (*fBadPixels)[i].SetUnsuitable ( MBadPixelsPix::kUnreliableRun ); 1601 continue; 1602 } 1540 1603 1541 1604 const Int_t aidx = (*fGeom)[i].GetAidx(); … … 1929 1992 } 1930 1993 1994 // -------------------------------------------------------------------------- 1995 // 1996 // Set the output file 1997 // 1931 1998 void MCalibrationChargeCalc::SetOutputFile(TString file) 1932 1999 { 1933 fOutputFile 2000 fOutputFile = file; 1934 2001 } 1935 2002 … … 1943 2010 } 1944 2011 2012 // -------------------------------------------------------------------------- 2013 // 2014 // Read the environment for the following data members: 2015 // - fChargeLimit 2016 // - fChargeErrLimit 2017 // - fChargeRelErrLimit 2018 // - fDebug 2019 // - fFFactorErrLimit 2020 // - fLambdaErrLimit 2021 // - fLambdaCheckErrLimit 2022 // - fPheErrLimit 2023 // 1945 2024 Int_t MCalibrationChargeCalc::ReadEnv(const TEnv &env, TString prefix, Bool_t print) 1946 2025 { 1947 Bool_t rc = kFALSE; 1948 if (IsEnvDefined(env, prefix, "ChargeLimit", print)) 1949 { 1950 SetChargeLimit(GetEnvValue(env, prefix, "ChargeLimit", fChargeLimit)); 1951 rc = kTRUE; 1952 } 1953 1954 if (IsEnvDefined(env, prefix, "ChargeErrLimit", print)) 1955 { 1956 SetChargeErrLimit(GetEnvValue(env, prefix, "ChargeErrLimit", fChargeErrLimit)); 1957 rc = kTRUE; 1958 } 1959 1960 if (IsEnvDefined(env, prefix, "ChargeRelErrLimit", print)) 1961 { 1962 SetChargeRelErrLimit(GetEnvValue(env, prefix, "ChargeRelErrLimit", fChargeRelErrLimit)); 1963 rc = kTRUE; 1964 } 1965 if (IsEnvDefined(env, prefix, "Debug", print)) 1966 { 1967 SetDebug(GetEnvValue(env, prefix, "Debug", IsDebug())); 1968 rc = kTRUE; 1969 } 1970 if (IsEnvDefined(env, prefix, "FFactorErrLimit", print)) 1971 { 1972 SetFFactorErrLimit(GetEnvValue(env, prefix, "FFactorErrLimit", fFFactorErrLimit)); 1973 rc = kTRUE; 1974 } 1975 if (IsEnvDefined(env, prefix, "LambdaErrLimit", print)) 1976 { 1977 SetLambdaErrLimit(GetEnvValue(env, prefix, "LambdaErrLimit", fLambdaErrLimit)); 1978 rc = kTRUE; 1979 } 1980 if (IsEnvDefined(env, prefix, "LambdaCheckLimit", print)) 1981 { 1982 SetLambdaCheckLimit(GetEnvValue(env, prefix, "LambdaCheckLimit", fLambdaCheckLimit)); 1983 rc = kTRUE; 1984 } 1985 if (IsEnvDefined(env, prefix, "PheErrLimit", print)) 1986 { 1987 SetPheErrLimit(GetEnvValue(env, prefix, "PheErrLimit", fPheErrLimit)); 1988 rc = kTRUE; 1989 } 1990 // void SetPulserColor(const MCalibrationCam::PulserColor_t col) { fPulserColor = col; } 1991 1992 return rc; 1993 } 2026 2027 Bool_t rc = kFALSE; 2028 if (IsEnvDefined(env, prefix, "ChargeLimit", print)) 2029 { 2030 SetChargeLimit(GetEnvValue(env, prefix, "ChargeLimit", fChargeLimit)); 2031 rc = kTRUE; 2032 } 2033 if (IsEnvDefined(env, prefix, "ChargeErrLimit", print)) 2034 { 2035 SetChargeErrLimit(GetEnvValue(env, prefix, "ChargeErrLimit", fChargeErrLimit)); 2036 rc = kTRUE; 2037 } 2038 if (IsEnvDefined(env, prefix, "ChargeRelErrLimit", print)) 2039 { 2040 SetChargeRelErrLimit(GetEnvValue(env, prefix, "ChargeRelErrLimit", fChargeRelErrLimit)); 2041 rc = kTRUE; 2042 } 2043 if (IsEnvDefined(env, prefix, "Debug", print)) 2044 { 2045 SetDebug(GetEnvValue(env, prefix, "Debug", IsDebug())); 2046 rc = kTRUE; 2047 } 2048 if (IsEnvDefined(env, prefix, "FFactorErrLimit", print)) 2049 { 2050 SetFFactorErrLimit(GetEnvValue(env, prefix, "FFactorErrLimit", fFFactorErrLimit)); 2051 rc = kTRUE; 2052 } 2053 if (IsEnvDefined(env, prefix, "LambdaErrLimit", print)) 2054 { 2055 SetLambdaErrLimit(GetEnvValue(env, prefix, "LambdaErrLimit", fLambdaErrLimit)); 2056 rc = kTRUE; 2057 } 2058 if (IsEnvDefined(env, prefix, "LambdaCheckLimit", print)) 2059 { 2060 SetLambdaCheckLimit(GetEnvValue(env, prefix, "LambdaCheckLimit", fLambdaCheckLimit)); 2061 rc = kTRUE; 2062 } 2063 if (IsEnvDefined(env, prefix, "PheErrLimit", print)) 2064 { 2065 SetPheErrLimit(GetEnvValue(env, prefix, "PheErrLimit", fPheErrLimit)); 2066 rc = kTRUE; 2067 } 2068 // void SetPulserColor(const MCalibrationCam::PulserColor_t col) { fPulserColor = col; } 2069 2070 return rc; 2071 }
Note:
See TracChangeset
for help on using the changeset viewer.