Changeset 4603 for trunk/MagicSoft/Mars/mcalib
- Timestamp:
- 08/12/04 21:36:20 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/mcalib
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mcalib/MCalibrateData.h
r4599 r4603 52 52 MCerPhotEvt *fCerPhotEvt; // Cerenkov Photon Event used for calculation 53 53 54 UShort_t fCalibrationMode; 54 UShort_t fCalibrationMode; // Flag defining the calibration mode (CalibrationMode_t) 55 55 Byte_t fPedestalFlag; // Flags defining to calibrate the pedestal each event or each run 56 56 -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc
r4542 r4603 231 231 const Float_t MCalibrationChargeCalc::fgLambdaErrLimit = 0.2; 232 232 const Float_t MCalibrationChargeCalc::fgLambdaCheckLimit = 0.5; 233 const Float_t MCalibrationChargeCalc::fgPheErrLimit = 3.5;233 const Float_t MCalibrationChargeCalc::fgPheErrLimit = 4.5; 234 234 const Float_t MCalibrationChargeCalc::fgFFactorErrLimit = 4.5; 235 235 // -------------------------------------------------------------------------- … … 582 582 return kFALSE; 583 583 584 *fLog << endl; 585 584 586 if (fPINDiode) 585 587 if (!fPINDiode->IsValid()) … … 606 608 } 607 609 610 *fLog << endl; 608 611 // 609 612 // First loop over pixels, call FinalizePedestals and FinalizeCharges … … 627 630 FinalizePedestals(ped,pix,aidx); 628 631 629 if (FinalizeCharges(pix,bad ))632 if (FinalizeCharges(pix,bad,"pixel ")) 630 633 nvalid++; 631 634 } 632 635 636 *fLog << endl; 633 637 // 634 638 // The Michele check ... … … 651 655 652 656 FinalizePedestals(ped,pix,aidx); 653 FinalizeCharges(pix, fCam->GetAverageBadArea(aidx)); 654 } 655 657 FinalizeCharges(pix, fCam->GetAverageBadArea(aidx),"area id"); 658 } 659 660 *fLog << endl; 661 656 662 for (UInt_t sector=0; sector<fGeom->GetNumSectors(); sector++) 657 663 { … … 661 667 MCalibrationChargePix &pix = (MCalibrationChargePix&)fCam->GetAverageSector(sector); 662 668 FinalizePedestals(ped,pix, 0); 663 FinalizeCharges(pix, fCam->GetAverageBadSector(sector)); 664 } 665 669 } 670 671 *fLog << endl; 672 666 673 // 667 674 // Finalize Bad Pixels … … 681 688 fCam->SetFFactorMethodValid(kTRUE); 682 689 690 *fLog << endl; 683 691 // 684 692 // Finalize Blind Pixel … … 821 829 // if not succesful. 822 830 // 823 Bool_t MCalibrationChargeCalc::FinalizeCharges(MCalibrationChargePix &cal, MBadPixelsPix &bad )831 Bool_t MCalibrationChargeCalc::FinalizeCharges(MCalibrationChargePix &cal, MBadPixelsPix &bad, const char* what) 824 832 { 825 833 … … 829 837 if (cal.GetMean() < fChargeLimit*cal.GetPedRms()) 830 838 { 831 *fLog << warn << GetDescriptor() << ": Fitted Charge: " << cal.GetMean() << " is smaller than " 832 << fChargeLimit << " Pedestal RMS: " << cal.GetPedRms() << " in Pixel " << cal.GetPixId() << endl; 839 *fLog << warn << GetDescriptor() 840 << Form(": Fitted Charge: %5.2f is smaller than %2.1f",cal.GetMean(),fChargeLimit) 841 << Form(" Pedestal RMS: %5.2f in %s%4i",cal.GetPedRms(),what,cal.GetPixId()) << endl; 833 842 bad.SetUncalibrated( MBadPixelsPix::kChargeIsPedestal); 834 843 } … … 836 845 if (cal.GetMean() < fChargeRelErrLimit*cal.GetMeanErr()) 837 846 { 838 *fLog << warn << GetDescriptor() << ": Fitted Charge: " << cal.GetMean() << " is smaller than "839 << fChargeRelErrLimit << "* its error: " << cal.GetMeanErr()840 << " in Pixel " << cal.GetPixId() << endl;847 *fLog << warn << GetDescriptor() 848 << Form(": Fitted Charge: %4.2f is smaller than %2.1f",cal.GetMean(),fChargeRelErrLimit) 849 << Form(" times its error: %4.2f in %s%4i",cal.GetMeanErr(),what,cal.GetPixId()) << endl; 841 850 bad.SetUncalibrated( MBadPixelsPix::kChargeRelErrNotValid ); 842 851 } … … 844 853 if (cal.GetSigma() < cal.GetPedRms()) 845 854 { 846 *fLog << warn << GetDescriptor() << ": Sigma of Fitted Charge: " << cal.GetSigma() 847 << " smaller than Pedestal RMS: " << cal.GetPedRms() << " in Pixel " << cal.GetPixId() << endl; 855 *fLog << warn << GetDescriptor() 856 << Form(": Sigma of Fitted Charge: %6.2f is smaller than",cal.GetSigma()) 857 << Form(" Ped. RMS: %5.2f in %s%4i",cal.GetPedRms(),what,cal.GetPixId()) << endl; 848 858 bad.SetUncalibrated( MBadPixelsPix::kChargeSigmaNotValid ); 849 859 } … … 852 862 { 853 863 *fLog << warn << GetDescriptor() 854 << ": Could not calculate reduced sigmas of pixel: " << cal.GetPixId() << endl; 864 << Form(": Could not calculate the reduced sigma in %s: ",what) 865 << Form(" %4i",cal.GetPixId()) 866 << endl; 855 867 bad.SetUncalibrated(MBadPixelsPix::kChargeIsPedestal); 856 868 return kFALSE; … … 860 872 { 861 873 *fLog << warn << GetDescriptor() 862 << ": Could not calculate F-Factor of pixel: " << cal.GetPixId() << endl; 874 << Form(": Could not calculate the F-Factor in %s: ",what) 875 << Form(" %4i",cal.GetPixId()) 876 << endl; 863 877 bad.SetUncalibrated(MBadPixelsPix::kDeviatingNumPhes); 864 878 return kFALSE; … … 1008 1022 } 1009 1023 1010 areavars[i] = (areavars[i] - areaphes[i]*areaphes[i]/numareavalid[i]) / (numareavalid[i]-1.); 1011 areaphes[i] = areaphes[i] / numareavalid[i]; 1012 1024 if (numareavalid[i] == 1) 1025 areavars[i] = 0.; 1026 else if (numareavalid[i] == 0) 1027 { 1028 areaphes[i] = -1.; 1029 areaweights[i] = -1.; 1030 } 1031 else 1032 { 1033 areavars[i] = (areavars[i] - areaphes[i]*areaphes[i]/numareavalid[i]) / (numareavalid[i]-1); 1034 areaphes[i] = areaphes[i] / numareavalid[i]; 1035 } 1036 1013 1037 if (areavars[i] < 0.) 1014 1038 { … … 1029 1053 const Float_t sigma = hist->GetFunction("gaus")->GetParameter(2); 1030 1054 const Int_t ndf = hist->GetFunction("gaus")->GetNDF(); 1055 1056 if (IsDebug()) 1057 camphes.DrawClone(); 1031 1058 1032 1059 if (ndf < 2) … … 1053 1080 } 1054 1081 1055 *fLog << inf << endl; 1056 *fLog << inf << GetDescriptor() << ": Mean Number of photo-electrons " 1057 << "in the camera with area index: " << i << ": " 1058 << Form("%4.2f%s%4.2f",mean,"+-",sigma) << endl; 1059 *fLog << inf << endl; 1082 *fLog << inf << GetDescriptor() << ": Mean number of photo-electrons " 1083 << "with area idx " << i << ": " 1084 << Form("%7.2f+-%6.2f",mean,sigma) << endl; 1060 1085 1061 1086 lowlim [i] = mean - fPheErrLimit*sigma; … … 1064 1089 delete hist; 1065 1090 } 1091 1092 *fLog << endl; 1066 1093 1067 1094 memset(numareavalid,0,nareas*sizeof(Int_t)); … … 1094 1121 const Int_t aidx = (*fGeom)[i].GetAidx(); 1095 1122 const Int_t sector = (*fGeom)[i].GetSector(); 1123 const Float_t area = (*fGeom)[i].GetA(); 1096 1124 const Float_t nphe = pix.GetPheFFactorMethod(); 1097 1125 1098 1126 if ( nphe < lowlim[aidx] || nphe > upplim[aidx] ) 1099 1127 { 1100 *fLog << warn << GetDescriptor() << ": Deviating number of photo-electrons: "1101 << Form("% 4.2f",nphe) << " out of accepted limits: ["1102 << Form(" %4.2f%s%4.2f",lowlim[aidx],",",upplim[aidx]) << "] in pixel " << i<< endl;1128 *fLog << warn << GetDescriptor() << ": Number of phes: " 1129 << Form("%7.2f out of %3.1f sigma limit: ",nphe,fPheErrLimit) 1130 << Form("[%7.2f,%7.2f] pixel%4i",lowlim[aidx],upplim[aidx],i) << endl; 1103 1131 bad.SetUncalibrated( MBadPixelsPix::kDeviatingNumPhes ); 1104 1132 bad.SetUnsuitable ( MBadPixelsPix::kUnsuitableRun ); … … 1107 1135 } 1108 1136 1109 // const Float_t weight = 1./nvar;1110 // areaweights [aidx] += weight;1111 // areaphes [aidx] += weight*nphe;1112 1137 areaweights [aidx] += nphe*nphe; 1113 1138 areaphes [aidx] += nphe; … … 1116 1141 if (aidx == 0) 1117 1142 fNumInnerFFactorMethodUsed++; 1118 // sectorweights [sector] += weight; 1119 // sectorphes [sector] += weight*nphe; 1120 sectorweights [sector] += nphe*nphe; 1121 sectorphes [sector] += nphe; 1143 1144 sectorweights [sector] += nphe*nphe/area/area; 1145 sectorphes [sector] += nphe/area; 1122 1146 numsectorvalid[sector] ++; 1123 1147 } 1124 1148 1149 *fLog << endl; 1150 1125 1151 for (UInt_t aidx=0; aidx<nareas; aidx++) 1126 1152 { … … 1128 1154 MCalibrationChargePix &apix = (MCalibrationChargePix&)fCam->GetAverageArea(aidx); 1129 1155 1130 areaweights[aidx] -= areaphes[aidx]*areaphes[aidx]/numareavalid[aidx]; 1131 areaphes[aidx] /= numareavalid[aidx]; 1132 areaweights[aidx] /= numareavalid[aidx]-1.; 1133 1134 if (areaweights[aidx] <= 0. || areaphes[aidx] <= 0.) 1135 { 1136 *fLog << warn << " Mean number of phe's from area index " << aidx << " cannot be calculated: " 1137 << " Mean number of phes: " << areaphes[aidx] 1156 if (numareavalid[aidx] == 1) 1157 areaweights[aidx] = 0.; 1158 else if (numareavalid[aidx] == 0) 1159 { 1160 areaphes[aidx] = -1.; 1161 areaweights[aidx] = -1.; 1162 } 1163 else 1164 { 1165 areaweights[aidx] = (areaweights[aidx] - areaphes[aidx]*areaphes[aidx]/numareavalid[aidx]) 1166 / (numareavalid[aidx]-1); 1167 areaphes[aidx] /= numareavalid[aidx]; 1168 } 1169 1170 if (areaweights[aidx] < 0. || areaphes[aidx] <= 0.) 1171 { 1172 *fLog << warn << GetDescriptor() 1173 << ": Mean number phes from area index " << aidx << " could not be calculated: " 1174 << " Mean: " << areaphes[aidx] 1138 1175 << " Variance: " << areaweights[aidx] << endl; 1139 1176 apix.SetFFactorMethodValid(kFALSE); … … 1141 1178 } 1142 1179 1143 *fLog << inf << "Replacing number photo-electrons of average area idx " << aidx << ": " 1144 << Form("%5.3f%s%5.3f",apix.GetPheFFactorMethod()," +- ",apix.GetPheFFactorMethodErr()) << endl; 1145 *fLog << inf << " by average number of photo-electrons from area idx " << aidx << ": " 1146 << Form("%5.3f%s%5.3f",areaphes[aidx]," +- ",TMath::Sqrt(areaweights[aidx])) << endl; 1180 *fLog << inf << "Average total number phes in area idx " << aidx << ": " 1181 << Form("%7.2f%s%6.2f",areaphes[aidx]," +- ",TMath::Sqrt(areaweights[aidx])) << endl; 1147 1182 1148 // apix.SetPheFFactorMethod ( areaphes[aidx]/ areaweights[aidx] );1149 // apix.SetPheFFactorMethodVar( 1. / areaweights[aidx] );1150 1183 apix.SetPheFFactorMethod ( areaphes[aidx] ); 1151 1184 apix.SetPheFFactorMethodVar( areaweights[aidx] / numareavalid[aidx] ); … … 1154 1187 } 1155 1188 1189 *fLog << endl; 1190 1156 1191 for (UInt_t sector=0; sector<nsectors; sector++) 1157 1192 { 1158 1193 1159 sectorweights[sector] -= sectorphes[sector]*sectorphes[sector]/numsectorvalid[sector]; 1160 sectorphes[sector] /= numsectorvalid[sector]; 1161 sectorweights[sector] /= numsectorvalid[sector]-1.; 1162 1194 if (numsectorvalid[sector] == 1) 1195 sectorweights[sector] = 0.; 1196 else if (numsectorvalid[sector] == 0) 1197 { 1198 sectorphes[sector] = -1.; 1199 sectorweights[sector] = -1.; 1200 } 1201 else 1202 { 1203 sectorweights[sector] = (sectorweights[sector] 1204 - sectorphes[sector]*sectorphes[sector]/numsectorvalid[sector] 1205 ) 1206 / (numsectorvalid[sector]-1.); 1207 sectorphes[sector] /= numsectorvalid[sector]; 1208 } 1209 1163 1210 MCalibrationChargePix &spix = (MCalibrationChargePix&)fCam->GetAverageSector(sector); 1164 1211 1165 if (sectorweights[sector] <= 0. || sectorphes[sector] <= 0.) 1166 { 1167 *fLog << warn << " Mean number of phe's from sector " << sector << " cannot be calculated: " 1168 << " Mean number of phes: " << sectorphes[sector] 1212 if (sectorweights[sector] < 0. || sectorphes[sector] <= 0.) 1213 { 1214 *fLog << warn << GetDescriptor() 1215 <<": Mean number phes per area for sector " << sector << " could not be calculated: " 1216 << " Mean: " << sectorphes[sector] 1169 1217 << " Variance: " << sectorweights[sector] << endl; 1170 1218 spix.SetFFactorMethodValid(kFALSE); … … 1172 1220 } 1173 1221 1174 *fLog << inf << "Replacing number photo-electrons of average sector " << sector << ": " 1175 << Form("%5.3f%s%5.3f",spix.GetPheFFactorMethod()," +- ",spix.GetPheFFactorMethodErr()) << endl; 1176 *fLog << inf << " by average number photo-electrons from sector " << sector << ": " 1177 << Form("%5.3f%s%5.3f",sectorphes[sector]," +- ",TMath::Sqrt(sectorweights[sector])) << endl; 1178 1179 // spix.SetPheFFactorMethod ( sectorphes[sector]/ sectorweights[sector] ); 1180 // spix.SetPheFFactorMethodVar( 1. / sectorweights[sector] ); 1222 *fLog << inf << "Average number phes per area in sector " << sector << ": " 1223 << Form("%5.2f+-%4.2f [phe/mm^2]",sectorphes[sector],TMath::Sqrt(sectorweights[sector])) 1224 << endl; 1225 1181 1226 spix.SetPheFFactorMethod ( sectorphes[sector] ); 1182 1227 spix.SetPheFFactorMethodVar( sectorweights[sector] / numsectorvalid[sector]); … … 1453 1498 const Int_t ndf = hist->GetFunction("gaus")->GetNDF(); 1454 1499 1500 if (IsDebug()) 1501 camffactor.DrawClone(); 1502 1455 1503 if (ndf < 2) 1456 1504 { … … 1476 1524 } 1477 1525 1478 *fLog << inf << endl; 1479 *fLog << inf << GetDescriptor() << ": Mean F-Factor " 1480 << "in the camera with area index: " << i << ": " 1481 << Form("%4.2f%s%4.2f",mean,"+-",sigma) << endl; 1482 *fLog << inf << endl; 1483 1484 lowlim [i] = mean - fFFactorErrLimit*sigma; 1526 *fLog << inf << GetDescriptor() << ": Mean overall F-Factor (photons to FADC counts) " 1527 << "with area index: " << i << ": " 1528 << Form("%4.2f+-%4.2f",mean,sigma) << endl; 1529 1530 lowlim [i] = 1.1; 1485 1531 upplim [i] = mean + fFFactorErrLimit*sigma; 1486 1532 1487 1533 delete hist; 1488 1534 } 1535 1536 *fLog << endl; 1489 1537 1490 1538 for (UInt_t i=0; i<npixels; i++) … … 1502 1550 if ( ffactor < lowlim[aidx] || ffactor > upplim[aidx] ) 1503 1551 { 1504 *fLog << warn << GetDescriptor() << ": DeviatingF-Factor: "1505 << Form("% 4.2f",ffactor) << " out of accepted limits: ["1506 << Form(" %4.2f%s%4.2f",lowlim[aidx],",",upplim[aidx]) << "] in pixel " << i<< endl;1552 *fLog << warn << GetDescriptor() << ": Overall F-Factor: " 1553 << Form("%5.2f out of %3.1f sigma limit: ",ffactor,fFFactorErrLimit) 1554 << Form("[%5.2f,%5.2f] pixel %4i",lowlim[aidx],upplim[aidx],i) << endl; 1507 1555 bad.SetUncalibrated( MBadPixelsPix::kDeviatingFFactor ); 1508 1556 bad.SetUnsuitable ( MBadPixelsPix::kUnsuitableRun ); -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.h
r4542 r4603 53 53 static const Float_t fgLambdaCheckLimit; //! Default for fLambdaCheckLimit (now set to: 0.2) 54 54 static const Float_t fgLambdaErrLimit; //! Default for fLabmdaErrLimit (now set to: 0.5) 55 static const Float_t fgPheErrLimit; //! Default for fPheErrLimit (now set to: 4. )56 static const Float_t fgFFactorErrLimit; //! Default for fFFactorErrLimit (now set to: 4. )55 static const Float_t fgPheErrLimit; //! Default for fPheErrLimit (now set to: 4.5) 56 static const Float_t fgFFactorErrLimit; //! Default for fFFactorErrLimit (now set to: 4.5) 57 57 58 58 // Variables … … 95 95 const char* GetOutputFile(); 96 96 void FinalizePedestals ( const MPedestalPix &ped, MCalibrationChargePix &cal, const Int_t aidx ); 97 Bool_t FinalizeCharges ( MCalibrationChargePix &cal, MBadPixelsPix &bad 97 Bool_t FinalizeCharges ( MCalibrationChargePix &cal, MBadPixelsPix &bad, const char* what); 98 98 Bool_t FinalizePINDiode (); 99 99 Bool_t FinalizeBlindPixel (); -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.cc
r4192 r4603 130 130 fAverageAreas = new TClonesArray("MCalibrationChargePix",1); 131 131 fAverageSectors = new TClonesArray("MCalibrationChargePix",1); 132 132 133 133 Clear(); 134 134 } -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargePix.cc
r4334 r4603 723 723 if (fRSigmaSquare <= 0.) 724 724 { 725 *fLog << warn 726 << "WARNING: Cannot calculate the reduced sigma: smaller than 0 in pixel " 727 << fPixId << endl; 725 if (IsDebug()) 726 *fLog << warn 727 << "WARNING: Cannot calculate the reduced sigma: smaller than 0 in pixel " 728 << fPixId << endl; 728 729 return kFALSE; 729 730 } … … 863 864 if (convrelvar > limit || convrelvar < 0.) 864 865 { 865 *fLog << warn << GetDescriptor() << ": Conversion F-Factor Method Rel. Variance: " 866 << convrelvar << " above limits of: [0," << Form("%3.2f",limit) 867 << "] in pixel: " << fPixId << endl; 866 *fLog << warn << GetDescriptor() << ": Conv. F-Factor Method Rel. Var.: " 867 << Form("%4.3f out of limits: [0,%3.2f] in pixel:%4i",convrelvar,limit,fPixId) << endl; 868 868 return kFALSE; 869 869 } -
trunk/MagicSoft/Mars/mcalib/MHCalibrationCam.cc
r4337 r4603 646 646 if (bad.IsUnsuitable(MBadPixelsPix::kUnsuitableRun)) 647 647 hist.SetExcluded(); 648 648 649 649 hist.InitBins(); 650 650 hist.ChangeHistId(i);
Note:
See TracChangeset
for help on using the changeset viewer.