Changeset 4320 for trunk/MagicSoft/Mars/mcalib
- Timestamp:
- 06/22/04 11:35:06 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc
r4283 r4320 186 186 #include <TSystem.h> 187 187 #include <TH1.h> 188 #include <TF1.h> 188 189 189 190 #include "MLog.h" … … 197 198 #include "MGeomCam.h" 198 199 #include "MGeomPix.h" 200 #include "MHCamera.h" 199 201 200 202 #include "MPedestalCam.h" … … 229 231 const Float_t MCalibrationChargeCalc::fgLambdaCheckLimit = 0.5; 230 232 const Float_t MCalibrationChargeCalc::fgPheErrLimit = 3.5; 231 const Float_t MCalibrationChargeCalc::fgFFactorErrLimit = 3.5;233 const Float_t MCalibrationChargeCalc::fgFFactorErrLimit = 4.5; 232 234 // -------------------------------------------------------------------------- 233 235 // … … 701 703 PrintUncalibrated(MBadPixelsPix::kDeviatingNumPhes, 702 704 "Pixels with deviating number of phes: "); 705 PrintUncalibrated(MBadPixelsPix::kDeviatingFFactor, 706 "Pixels with deviating F-Factor: "); 703 707 704 708 *fLog << inf << endl; … … 923 927 // The loop is only to recognize later pixels with very deviating numbers 924 928 // 929 MHCamera camphes(*fGeom,"Camphes","Phes in Camera"); 930 925 931 for (UInt_t i=0; i<npixels; i++) 926 932 { … … 944 950 const Float_t nvar = pix.GetPheFFactorMethod()*pix.GetPheFFactorMethod(); 945 951 const Int_t aidx = (*fGeom)[i].GetAidx(); 952 953 camphes.Fill(i,nphe); 954 camphes.SetUsed(i); 946 955 947 956 areaphes [aidx] += nphe; … … 973 982 lowlim [i] = areaphes[i] - fPheErrLimit*TMath::Sqrt(areavars[i]); 974 983 upplim [i] = areaphes[i] + fPheErrLimit*TMath::Sqrt(areavars[i]); 984 985 TArrayI area(1); 986 area[0] = i; 987 988 TH1D *hist = camphes.ProjectionS(TArrayI(),area); 989 hist->Fit("gaus","Q"); 990 const Float_t mean = hist->GetFunction("gaus")->GetParameter(1); 991 const Float_t sigma = hist->GetFunction("gaus")->GetParameter(2); 992 const Int_t ndf = hist->GetFunction("gaus")->GetNDF(); 993 994 if (ndf < 2) 995 { 996 *fLog << warn << GetDescriptor() << ": Cannot use a Gauss fit to the number of photo-electrons " 997 << "in the camera with area index: " << i << endl; 998 *fLog << warn << GetDescriptor() << ": Number of dof.: " << ndf << " is smaller than 2 " << endl; 999 *fLog << warn << GetDescriptor() << ": Will use the simple mean and rms " << endl; 1000 delete hist; 1001 continue; 1002 } 1003 1004 const Double_t prob = hist->GetFunction("gaus")->GetProb(); 1005 1006 if (prob < 0.001) 1007 { 1008 *fLog << warn << GetDescriptor() << ": Cannot use a Gauss fit to the number of photo-electrons " 1009 << "in the camera with area index: " << i << endl; 1010 *fLog << warn << GetDescriptor() << ": Fit probability " << prob 1011 << " is smaller than 0.001 " << endl; 1012 *fLog << warn << GetDescriptor() << ": Will use the simple mean and rms " << endl; 1013 delete hist; 1014 continue; 1015 } 1016 1017 *fLog << inf << endl; 1018 *fLog << inf << GetDescriptor() << ": Mean Number of photo-electrons " 1019 << "in the camera with area index: " << i << ": " 1020 << Form("%4.2f%s%4.2f",mean,"+-",sigma) << endl; 1021 *fLog << inf << endl; 1022 1023 lowlim [i] = mean - fPheErrLimit*sigma; 1024 upplim [i] = mean + fPheErrLimit*sigma; 1025 1026 delete hist; 975 1027 } 976 1028 … … 1289 1341 const UInt_t npixels = fGeom->GetNumPixels(); 1290 1342 1343 MHCamera camffactor(*fGeom,"Camffactor","F-Factor in Camera"); 1344 1291 1345 for (UInt_t i=0; i<npixels; i++) 1292 1346 { … … 1306 1360 (*fBadPixels)[i].SetUncalibrated( MBadPixelsPix::kDeviatingNumPhes ); 1307 1361 continue; 1308 1309 1362 } 1310 1363 … … 1320 1373 1321 1374 const Int_t aidx = (*fGeom)[i].GetAidx(); 1322 1323 avffactorphotons[aidx] += pix.GetMeanFFactorFADC2Phot(); 1375 const Float_t ffactor = pix.GetMeanFFactorFADC2Phot(); 1376 1377 camffactor.Fill(i,ffactor); 1378 camffactor.SetUsed(i); 1379 1380 avffactorphotons[aidx] += ffactor; 1324 1381 avffactorphotvar[aidx] += pix.GetMeanFFactorFADC2PhotVar(); 1325 1382 numffactor[aidx]++; … … 1330 1387 avffactorphotons[i] /= numffactor[i]; 1331 1388 avffactorphotvar[i] /= numffactor[i]; 1332 lowlim [i] = 1.1; 1389 1390 lowlim [i] = 1.1; // Lowest known F-Factor of a PMT 1333 1391 upplim [i] = avffactorphotons[i] + fFFactorErrLimit*TMath::Sqrt(avffactorphotvar[i]); 1392 1393 TArrayI area(1); 1394 area[0] = i; 1395 1396 TH1D *hist = camffactor.ProjectionS(TArrayI(),area); 1397 hist->Fit("gaus","Q"); 1398 const Float_t mean = hist->GetFunction("gaus")->GetParameter(1); 1399 const Float_t sigma = hist->GetFunction("gaus")->GetParameter(2); 1400 const Int_t ndf = hist->GetFunction("gaus")->GetNDF(); 1401 1402 if (ndf < 2) 1403 { 1404 *fLog << warn << GetDescriptor() << ": Cannot use a Gauss fit to the F-Factor " 1405 << "in the camera with area index: " << i << endl; 1406 *fLog << warn << GetDescriptor() << ": Number of dof.: " << ndf << " is smaller than 2 " << endl; 1407 *fLog << warn << GetDescriptor() << ": Will use the simple mean and rms " << endl; 1408 delete hist; 1409 continue; 1410 } 1411 1412 const Double_t prob = hist->GetFunction("gaus")->GetProb(); 1413 1414 if (prob < 0.001) 1415 { 1416 *fLog << warn << GetDescriptor() << ": Cannot use a Gauss fit to the F-Factor " 1417 << "in the camera with area index: " << i << endl; 1418 *fLog << warn << GetDescriptor() << ": Fit probability " << prob 1419 << " is smaller than 0.001 " << endl; 1420 *fLog << warn << GetDescriptor() << ": Will use the simple mean and rms " << endl; 1421 delete hist; 1422 continue; 1423 } 1424 1425 *fLog << inf << endl; 1426 *fLog << inf << GetDescriptor() << ": Mean F-Factor " 1427 << "in the camera with area index: " << i << ": " 1428 << Form("%4.2f%s%4.2f",mean,"+-",sigma) << endl; 1429 *fLog << inf << endl; 1430 1431 lowlim [i] = mean - fFFactorErrLimit*sigma; 1432 upplim [i] = mean + fFFactorErrLimit*sigma; 1433 1434 delete hist; 1334 1435 } 1335 1436
Note:
See TracChangeset
for help on using the changeset viewer.