Changeset 5843 for trunk/MagicSoft/Mars/mcalib
- Timestamp:
- 01/14/05 15:22:39 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.cc
r5840 r5843 84 84 85 85 #include <TOrdCollection.h> 86 #include <TH1D.h> 87 #include <TF1.h> 86 88 87 89 #include "MLog.h" … … 96 98 #include "MCalibrationQECam.h" 97 99 #include "MCalibrationQEPix.h" 100 101 #include "MHCamera.h" 98 102 99 103 ClassImp(MCalibrationChargeCam); … … 650 654 Int_t nr = 0; 651 655 656 MHCamera convcam(geom,"ConvFactors","Conversion Factors;Conv Factor [phot/FADC cnts];channels"); 657 652 658 for (int i=0; i<np; i++) 653 659 { 654 660 if (bad && (*bad)[i].IsUnsuitable(MBadPixelsPix::kUnsuitableRun)) 661 continue; 662 663 if (bad && (*bad)[i].IsUncalibrated(MBadPixelsPix::kDeviatingNumPhes)) 655 664 continue; 656 665 … … 665 674 666 675 const MCalibrationChargePix &pix = (MCalibrationChargePix&)(*this)[i]; 667 const Float_t conv = pix.GetMeanConvFADC2Phe(); 668 const Float_t qe = qepix.GetQECascadesFFactor(); 669 670 mean += conv/qe; 671 mean2 += conv*conv/qe/qe; 676 const Float_t conv = pix.GetMeanConvFADC2Phe()/qepix.GetQECascadesFFactor(); 677 678 mean += conv; 679 mean2 += conv*conv; 672 680 nr ++; 673 674 } 681 682 convcam.Fill(i,conv); 683 convcam.SetUsed(i); 684 } 685 686 Float_t mn = nr ? mean/nr : -1.; 687 Float_t sg = nr>1 ? TMath::Sqrt((mean2 - mean*mean/nr)/(nr-1)) : 0.; 688 689 const Int_t aidx = (Int_t)ai; 690 691 TH1D *h = convcam.ProjectionS(TArrayI(),TArrayI(1,&aidx),"_py",750); 692 h->SetDirectory(NULL); 693 h->Fit("gaus","Q"); 694 TF1 *fit = h->GetFunction("gaus"); 695 696 Float_t ci2 = fit->GetChisquare(); 697 Float_t sigma = fit->GetParameter(2); 698 699 if (ci2 > 500. || sigma > sg) 700 { 701 h->Fit("gaus","QM"); 702 fit = h->GetFunction("gaus"); 703 704 ci2 = fit->GetChisquare(); 705 sigma = fit->GetParameter(2); 706 } 707 708 const Int_t ndf = fit->GetNDF(); 709 710 if (ci2 < 500. && sigma < sg && ndf > 2) 711 { 712 mn = fit->GetParameter(1); 713 sg = sigma; 714 } 715 716 *fLog << inf << "Conversion Factors to photons area idx: " << aidx << ":" << endl; 717 *fLog << inf << "Mean: " << Form("%4.3f",mn) 718 << "+-" << Form("%4.3f",fit->GetParError(1)) 719 << " Sigma: " << Form("%4.3f",sg) << "+-" << Form("%4.3f",fit->GetParError(2)) 720 << " Chisquare: " << Form("%4.3f",fit->GetChisquare()) << " NDF : " << ndf << endl; 721 722 delete h; 723 gROOT->GetListOfFunctions()->Remove(fit); 675 724 676 725 TArrayF arr(2); 677 arr[0] = nr ? mean/nr : -1.;678 arr[1] = nr>1 ? TMath::Sqrt((mean2 - mean*mean/nr)/(nr-1)) : 0.;726 arr[0] = mn; 727 arr[1] = sg; 679 728 680 729 return arr;
Note:
See TracChangeset
for help on using the changeset viewer.