Changeset 4198 for trunk/MagicSoft
- Timestamp:
- 05/26/04 18:24:22 (20 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r4197 r4198 29 29 - set MCalibrationChargeBlindPix and MCalibrationChargePINDiode as 30 30 data members and store them in the output of WriteResult() 31 32 * mcalib/MCalibrationQEPix.cc 33 - several small bugs fixed concerning calibration with the blind pixel 34 or the PIN Diode 31 35 32 36 * mjobs/MGCamDisplays.[h,cc] -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc
r4166 r4198 227 227 const Float_t MCalibrationChargeCalc::fgChargeRelErrLimit = 1.; 228 228 const Float_t MCalibrationChargeCalc::fgLambdaErrLimit = 0.2; 229 const Float_t MCalibrationChargeCalc::fgLambdaCheckLimit = 0. 2;229 const Float_t MCalibrationChargeCalc::fgLambdaCheckLimit = 0.5; 230 230 const Float_t MCalibrationChargeCalc::fgPheErrLimit = 3.5; 231 231 const Float_t MCalibrationChargeCalc::fgFFactorErrLimit = 3.; … … 600 600 *fLog << err << GetDescriptor() << ": Or, maybe, you have used a pedestal run " 601 601 << "instead of a calibration run " << endl; 602 return kFALSE;602 return kFALSE; 603 603 } 604 604 … … 1117 1117 const Float_t lambdacheck = fBlindPixel->GetLambdaCheck(); 1118 1118 1119 if (2.*(lambdacheck-lambda)/(lambdacheck+lambda) < fLambdaCheckLimit) 1120 { 1121 *fLog << warn << GetDescriptor() << ": Lambda and Lambda-Check differ by more than " 1122 << fLambdaCheckLimit << " in the Blind Pixel " << endl; 1123 return kFALSE; 1124 } 1125 1126 if (lambdaerr < fLambdaErrLimit) 1127 { 1128 *fLog << warn << GetDescriptor() << ": Error of Fitted Lambda is greater than " 1129 << fLambdaErrLimit << " in Blind Pixel " << endl; 1119 if (2.*(lambdacheck-lambda)/(lambdacheck+lambda) > fLambdaCheckLimit) 1120 { 1121 *fLog << warn << GetDescriptor() 1122 << Form("%s%4.2f%s%4.2f%s%4.2f%s",": Lambda: ",lambda," and Lambda-Check: ", 1123 lambdacheck," differ by more than ",fLambdaCheckLimit," in the Blind Pixel ") 1124 << endl; 1125 return kFALSE; 1126 } 1127 1128 if (lambdaerr > fLambdaErrLimit) 1129 { 1130 *fLog << warn << GetDescriptor() 1131 << Form("%s%4.2f%s%4.2f%s",": Error of Fitted Lambda: ",lambdaerr," is greater than ", 1132 fLambdaErrLimit," in Blind Pixel ") << endl; 1130 1133 return kFALSE; 1131 1134 } … … 1376 1379 continue; 1377 1380 } 1378 1381 1379 1382 if (!fBlindPixel->IsFluxInsidePlexiglassAvailable()) 1380 1383 { … … 1385 1388 MBadPixelsPix &bad = (*fBadPixels)[i]; 1386 1389 1387 if ( !bad.IsUnsuitable (MBadPixelsPix::kUnsuitableRun))1390 if (bad.IsUnsuitable (MBadPixelsPix::kUnsuitableRun)) 1388 1391 { 1389 1392 qepix.SetBlindPixelMethodValid(kFALSE, fPulserColor); … … 1397 1400 / fBlindPixel->GetFluxInsidePlexiglass() 1398 1401 / geo.GetA() 1399 * fQECam->GetPlexiglassQE();1402 * fQECam->GetPlexiglassQE(); 1400 1403 1401 1404 const Float_t qerelvar = fBlindPixel->GetFluxInsidePlexiglassRelVar() … … 1405 1408 qepix.SetQEBlindPixel ( qe , fPulserColor ); 1406 1409 qepix.SetQEBlindPixelVar ( qerelvar*qe*qe, fPulserColor ); 1407 qepix.UpdateBlindPixelMethod(); 1410 qepix.SetBlindPixelMethodValid( kTRUE , fPulserColor ); 1411 1412 if (!qepix.UpdateBlindPixelMethod()) 1413 *fLog << warn << GetDescriptor() 1414 << ": Cannot update Quantum efficiencies with the Blind Pixel Method" << endl; 1408 1415 } 1409 1416 } … … 1471 1478 qepix.SetQEPINDiode ( qe , fPulserColor ); 1472 1479 qepix.SetQEPINDiodeVar ( qerelvar*qe*qe, fPulserColor ); 1473 qepix.UpdateBlindPixelMethod(); 1480 qepix.SetPINDiodeMethodValid( kTRUE , fPulserColor ); 1481 1482 if (!qepix.UpdatePINDiodeMethod()) 1483 *fLog << warn << GetDescriptor() 1484 << ": Cannot update Quantum efficiencies with the PIN Diode Method" << endl; 1474 1485 } 1475 1486 } -
trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeBlindPix.cc
r3963 r4198 96 96 const Double_t MHCalibrationChargeBlindPix::gkElectronicAmpErr = 0.002; 97 97 98 const Int_t MHCalibrationChargeBlindPix::fgChargeNbins = 300;99 const Axis_t MHCalibrationChargeBlindPix::fgChargeFirst = - 100.5;100 const Axis_t MHCalibrationChargeBlindPix::fgChargeLast = 5 199.5;101 const Float_t MHCalibrationChargeBlindPix::fgSinglePheCut = 200.;98 const Int_t MHCalibrationChargeBlindPix::fgChargeNbins = 1000; 99 const Axis_t MHCalibrationChargeBlindPix::fgChargeFirst = -0.5; 100 const Axis_t MHCalibrationChargeBlindPix::fgChargeLast = 5999.5; 101 const Float_t MHCalibrationChargeBlindPix::fgSinglePheCut = 600.; 102 102 const Float_t MHCalibrationChargeBlindPix::fgNumSinglePheLimit = 50.; 103 103 // -------------------------------------------------------------------------- … … 146 146 SetNumSinglePheLimit(); 147 147 148 SetBinsAfterStripping( 30);148 SetBinsAfterStripping(50); 149 149 150 150 fHGausHist.SetName("HCalibrationChargeBlindPix"); … … 216 216 fLambdaCheckErr = -999.; 217 217 218 fFitFunc = kEPoisson5; 218 fFitFunc = kEMichele; 219 // fFitFunc = kEPoisson4; 219 220 220 221 fNumSinglePhes = 0; … … 387 388 // 388 389 const Float_t signal = (Float_t)fSignal->GetExtractedSignal(); 389 if (signal > - 1)390 if (signal > -0.5) 390 391 FillHistAndArray(signal); 392 else 393 return kTRUE; 391 394 392 395 // … … 448 451 fBlindPix->SetSinglePheFitOK(); 449 452 else 450 fBlindPix->SetValid( kFALSE);451 452 fBlindPix->SetLambda ( fLambda 453 fBlindPix->SetLambdaVar ( fLambda Err*fLambdaErr );453 fBlindPix->SetValid(IsPedestalFitOK()); 454 455 fBlindPix->SetLambda ( fLambdaCheck ); 456 fBlindPix->SetLambdaVar ( fLambdaCheckErr*fLambdaCheckErr ); 454 457 fBlindPix->SetMu0 ( fMu0 ); 455 458 fBlindPix->SetMu0Err ( fMu0Err ); … … 462 465 fBlindPix->SetProb ( fProb ); 463 466 464 fBlindPix->SetLambdaCheck ( fLambda Check);465 fBlindPix->SetLambdaCheckErr ( fLambda CheckErr);467 fBlindPix->SetLambdaCheck ( fLambda ); 468 fBlindPix->SetLambdaCheckErr ( fLambdaErr ); 466 469 467 470 return kTRUE; … … 598 601 break; 599 602 case kEMichele: 600 break;601 603 fSinglePheFit = new TF1("SinglePheFit",&fFitFuncMichele,rmin,rmax,10); 604 break; 602 605 default: 603 606 *fLog << warn << "WARNING: Could not find Fit Function for Blind Pixel " << endl; … … 614 617 const Double_t mu_0_guess = maximum_bin; 615 618 const Double_t si_0_guess = 40.; 616 const Double_t mu_1_guess = mu_0_guess + 100.;619 const Double_t mu_1_guess = mu_0_guess + 4000.; 617 620 const Double_t si_1_guess = si_0_guess + si_0_guess; 618 621 // Michele 619 // const Double_t lambda_1cat_guess = 0.5; 620 // const Double_t lambda_1dyn_guess = 0.5; 621 // const Double_t mu_1cat_guess = mu_0_guess + 50.; 622 // const Double_t mu_1dyn_guess = mu_0_guess + 20.; 623 // const Double_t si_1cat_guess = si_0_guess + si_0_guess; 624 // const Double_t si_1dyn_guess = si_0_guess; 622 const Double_t lambda_1cat_guess = 0.005; 623 const Double_t lambda_1dyn_guess = 0.002; 624 // const Double_t mu_1cat_guess = mu_0_guess + 4500.; 625 // const Double_t mu_1dyn_guess = mu_0_guess + 2500.; 626 const Double_t mu_1cat_guess = mu_0_guess + 1000.; 627 const Double_t mu_1dyn_guess = mu_0_guess + 2500.; 628 const Double_t si_1cat_guess = 500.; 629 const Double_t si_1dyn_guess = 1000.; 630 const Double_t offset_guess = 0.5; 625 631 // Polya 626 632 const Double_t excessPoisson_guess = 0.5; … … 689 695 break; 690 696 case kEMichele: 697 fSinglePheFit->SetParameters(lambda_1cat_guess, lambda_1dyn_guess, 698 mu_0_guess, mu_1cat_guess,mu_1dyn_guess, 699 si_0_guess, si_1cat_guess,si_1dyn_guess, 700 norm, offset_guess); 701 fSinglePheFit->SetParNames("#lambda_{cat}","#lambda_{dyn}", 702 "#mu_{0}","#mu_{1cat}","#mu_{1dyn}", 703 "#sigma_{0}","#sigma_{1cat}","#sigma_{1dyn}", 704 "Area","offset"); 705 fSinglePheFit->SetParLimits(0,0.,0.2); 706 fSinglePheFit->SetParLimits(1,0.,0.05); 707 fSinglePheFit->SetParLimits(2,0.,fSinglePheCut); 708 // fSinglePheFit->SetParLimits(3,4000.,5500.); 709 // fSinglePheFit->SetParLimits(4,2500.,5000.); 710 fSinglePheFit->SetParLimits(3,fSinglePheCut,3000.); 711 fSinglePheFit->SetParLimits(4,fSinglePheCut,3500.); 712 fSinglePheFit->SetParLimits(5,0.,fSinglePheCut); 713 fSinglePheFit->SetParLimits(6,500.,1000.); 714 fSinglePheFit->SetParLimits(7,300.,1500.); 715 // fSinglePheFit->SetParLimits(6,300.,2000.); 716 // fSinglePheFit->SetParLimits(7,100.,2500.); 717 fSinglePheFit->SetParLimits(8,norm/1.1,norm*1.1); 718 fSinglePheFit->SetParLimits(9,0.,1.); 691 719 break; 692 720 … … 745 773 fSigma0Err = fSinglePheFit->GetParError(5); 746 774 fSigma1Err = 0.; 775 case kEMichele: 776 fLambda = fSinglePheFit->GetParameter(0); 777 fMu0 = fSinglePheFit->GetParameter(2); 778 fMu1 = fSinglePheFit->GetParameter(3); 779 fSigma0 = fSinglePheFit->GetParameter(5); 780 fSigma1 = fSinglePheFit->GetParameter(6); 781 782 fLambdaErr = fSinglePheFit->GetParError(0); 783 fMu0Err = fSinglePheFit->GetParError(2); 784 fMu1Err = fSinglePheFit->GetParError(3); 785 fSigma0Err = fSinglePheFit->GetParError(5); 786 fSigma1Err = fSinglePheFit->GetParError(6); 787 break; 747 788 default: 748 789 break; … … 832 873 // Perform the cross-check fitting only the pedestal: 833 874 const Axis_t rmin = 0.; 834 const Axis_t rmax = fHGausHist.GetBinCenter(fHGausHist.GetMaximumBin()); 875 // const Axis_t rmax = fHGausHist.GetBinCenter(fHGausHist.GetMaximumBin()); 876 const Axis_t rmax = fSinglePheCut; 835 877 836 878 FitGaus(opt, rmin, rmax); 837 879 838 880 const Stat_t entries = fHGausHist.Integral("width"); 839 const Double_t fitarea = fFGausFit->GetParameter(0); 840 const Double_t pedarea = fitarea * TMath::Sqrt(TMath::TwoPi()) * fFGausFit->GetParameter(2); 841 881 const Double_t pedarea = fFGausFit->Integral(0.,fSinglePheCut); 882 842 883 fLambdaCheck = TMath::Log(entries/pedarea); 843 fLambdaCheckErr = fFGausFit->GetParError(0)/fFGausFit->GetParameter(0) 844 + fFGausFit->GetParError(2)/fFGausFit->GetParameter(2); 845 846 847 SetPedestalFitOK(); 884 // estimate the error by the error of the obtained area from the Gauss-function: 885 fLambdaCheckErr = fFGausFit->GetParError(0)/fFGausFit->GetParameter(0); 886 887 SetPedestalFitOK(IsGausFitOK()); 848 888 return; 849 889 } … … 861 901 fFitLegend = new TPaveText(0.05,0.05,0.95,0.95); 862 902 fFitLegend->SetLabel(Form("%s%s", "Results of the single PhE Fit (", 863 (fFitFunc = kEPoisson4) ? "Poisson(k=4))" :864 (fFitFunc = kEPoisson5) ? "Poisson(k=5))" :865 (fFitFunc = kEPoisson6) ? "Poisson(k=4))" :866 (fFitFunc = kEPolya ) ? "Polya(k=4))" :867 (fFitFunc = kEMichele ) ? "Michele)" : " none )" ));903 (fFitFunc == kEPoisson4) ? "Poisson(k=4))" : 904 (fFitFunc == kEPoisson5) ? "Poisson(k=5))" : 905 (fFitFunc == kEPoisson6) ? "Poisson(k=6))" : 906 (fFitFunc == kEPolya ) ? "Polya(k=4))" : 907 (fFitFunc == kEMichele ) ? "Michele)" : " none )" )); 868 908 fFitLegend->SetTextSize(0.05); 869 909 } … … 979 1019 fFGausFit->SetLineColor(kBlue); 980 1020 fFGausFit->Draw("same"); 1021 TLine *line = new TLine(fSinglePheCut, 0., fSinglePheCut, 10.); 1022 line->SetBit(kCanDelete); 1023 line->SetLineColor(kBlue); 1024 line->SetLineWidth(3); 1025 line->DrawLine(fSinglePheCut, 0., fSinglePheCut, 2.); 981 1026 } 982 1027 if (fSinglePheFit) … … 985 1030 fSinglePheFit->Draw("same"); 986 1031 } 1032 987 1033 988 1034 pad->cd(2); -
trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeBlindPix.h
r3952 r4198 146 146 // Fits 147 147 public: 148 enum FitFunc_t 148 enum FitFunc_t { kEPoisson4, kEPoisson5, kEPoisson6, kEPoisson7, kEPolya, kEMichele }; // The possible fit functions 149 149 150 150 private: … … 175 175 Double_t sigma1cat = par[6]; 176 176 Double_t sigma1dyn = par[7]; 177 177 Double_t offset = par[9]; 178 178 179 Double_t sumcat = 0.; 179 180 Double_t sumdyn = 0.; … … 240 241 sumdyn = TMath::Exp(-1.*lambda1dyn)*sumdyn; 241 242 242 return par[8]*(sumcat+sumdyn)/2. ;243 return par[8]*(sumcat+sumdyn)/2. + offset; 243 244 244 245 } -
trunk/MagicSoft/Mars/mcalib/MHGausEvents.cc
r3989 r4198 662 662 StripZeros(&fHGausHist,fBinsAfterStripping); 663 663 664 TAxis *axe = fHGausHist.GetXaxis(); 664 665 // 665 666 // Get the fitting ranges 666 667 // 667 Axis_t rmin = ( xmin==0.) && (xmax==0.) ? fHGausHist.GetBinCenter(fHGausHist.GetXaxis()->GetFirst()) : xmin;668 Axis_t rmax = ( xmin==0.) && (xmax==0.) ? fHGausHist.GetBinCenter(fHGausHist.GetXaxis()->GetLast()) : xmax;668 Axis_t rmin = ((xmin==0.) && (xmax==0.)) ? fHGausHist.GetBinCenter(axe->GetFirst()) : xmin; 669 Axis_t rmax = ((xmin==0.) && (xmax==0.)) ? fHGausHist.GetBinCenter(axe->GetLast()) : xmax; 669 670 670 671 // 671 672 // First guesses for the fit (should be as close to reality as possible, 672 673 // 673 const Stat_t entries = fHGausHist.Integral( "width");674 const Stat_t entries = fHGausHist.Integral(axe->FindBin(rmin),axe->FindBin(rmax),"width"); 674 675 const Double_t mu_guess = fHGausHist.GetBinCenter(fHGausHist.GetMaximumBin()); 675 676 const Double_t sigma_guess = fHGausHist.GetRMS(); … … 687 688 fFGausFit->SetParameters(area_guess,mu_guess,sigma_guess); 688 689 fFGausFit->SetParNames("Area","#mu","#sigma"); 689 fFGausFit->SetParLimits(0,0.,area_guess* 1.5);690 fFGausFit->SetParLimits(0,0.,area_guess*25.); 690 691 fFGausFit->SetParLimits(1,rmin,rmax); 691 692 fFGausFit->SetParLimits(2,0.,rmax-rmin);
Note:
See TracChangeset
for help on using the changeset viewer.