Changeset 6749 for trunk/MagicSoft
- Timestamp:
- 03/04/05 16:25:15 (20 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r6743 r6749 29 29 - set version number to 3 30 30 31 * mcalib/MCalibrationChargeCam.[h,cc] 32 - added new function GetAvergedConvFADC2PhePerArea for the datacheck 31 33 32 34 2005/03/04 Abelardo Moralejo -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.cc
r6211 r6749 761 761 // -------------------------------------------------------------------------- 762 762 // 763 // Calculates the average conversion factor FADC counts to equiv. photo-electrons for pixel sizes. 764 // The geometry container is used to get the necessary 765 // geometry information (area index). The MCalibrationQECam container is necessary for 766 // the quantum efficiency information. 767 // If the bad pixel container is given all pixels which have the flag 'kUnsuitableRun' are ignored 768 // in the calculation of the size average. 769 // 770 // Returns a TArrayF of dimension 2: 771 // arr[0]: averaged conversion factors (default: -1.) 772 // arr[1]: Error (rms) of averaged conversion factors (default: 0.) 773 // 774 TArrayF MCalibrationChargeCam::GetAveragedConvFADC2PhePerArea ( const MGeomCam &geom, const MCalibrationQECam &qecam, 775 const UInt_t ai, MBadPixelsCam *bad) 776 { 777 778 const Int_t np = GetSize(); 779 780 Double_t mean = 0.; 781 Double_t mean2 = 0.; 782 Int_t nr = 0; 783 784 MHCamera convcam(geom,"ConvFactors","Conversion Factors;Conv Factor [phe/FADC cnts];channels"); 785 786 for (int i=0; i<np; i++) 787 { 788 if (bad && (*bad)[i].IsUnsuitable(MBadPixelsPix::kUnsuitableRun)) 789 continue; 790 791 if (bad && (*bad)[i].IsUncalibrated(MBadPixelsPix::kDeviatingNumPhes)) 792 continue; 793 794 const UInt_t aidx = geom[i].GetAidx(); 795 796 if (ai != aidx) 797 continue; 798 799 const MCalibrationQEPix &qepix = (MCalibrationQEPix&)qecam[i]; 800 if (!qepix.IsAverageQEFFactorAvailable()) 801 continue; 802 803 const MCalibrationChargePix &pix = (MCalibrationChargePix&)(*this)[i]; 804 const Float_t conv = pix.GetMeanConvFADC2Phe()/qepix.GetQECascadesFFactor()*MCalibrationQEPix::gkDefaultAverageQE; 805 806 mean += conv; 807 mean2 += conv*conv; 808 nr ++; 809 810 convcam.Fill(i,conv); 811 convcam.SetUsed(i); 812 } 813 814 Float_t mn = nr ? mean/nr : -1.; 815 Float_t sg = nr>1 ? TMath::Sqrt((mean2 - mean*mean/nr)/(nr-1)) : 0.; 816 817 const Int_t aidx = (Int_t)ai; 818 819 TH1D *h = convcam.ProjectionS(TArrayI(),TArrayI(1,&aidx),"_py",750); 820 h->SetDirectory(NULL); 821 822 TF1 *fit = NULL; 823 824 if (geom.InheritsFrom("MGeomCamMagic")) 825 { 826 827 fit = new TF1("fit","gaus",0.01,1.); 828 829 // Fix the ranges, as found by Nadia 830 if(aidx == 0) 831 {h->Fit("fit","REQ", "",0.07,0.3);} 832 else 833 {h->Fit("fit","REQ", "",0.15,1.0);} 834 } 835 else 836 { 837 h->Fit("gaus","Q"); 838 fit = h->GetFunction("gaus"); 839 } 840 841 Float_t ci2 = fit->GetChisquare(); 842 Float_t sigma = fit->GetParameter(2); 843 844 if (ci2 > 500. || sigma > sg) 845 { 846 if (geom.InheritsFrom("MGeomCamMagic")) 847 { 848 // Fix the ranges, as found by Nadia 849 if(aidx == 0) 850 {h->Fit("fit","REQ", "",0.07,0.3);} 851 else 852 {h->Fit("fit","REQ", "",0.15,1.0);} 853 } 854 else 855 { 856 h->Fit("gaus","MREQ"); 857 fit = h->GetFunction("gaus"); 858 } 859 860 ci2 = fit->GetChisquare(); 861 sigma = fit->GetParameter(2); 862 } 863 864 const Int_t ndf = fit->GetNDF(); 865 866 if (ci2 < 500. && sigma < sg && ndf > 2) 867 { 868 mn = fit->GetParameter(1); 869 sg = sigma; 870 } 871 872 *fLog << inf << "Conversion Factors to equiv. photo-electrons area idx: " << aidx << ":" << endl; 873 *fLog << inf << "Mean: " << Form("%4.3f",mn) 874 << "+-" << Form("%4.3f",fit->GetParError(1)) 875 << " Sigma: " << Form("%4.3f",sg) << "+-" << Form("%4.3f",fit->GetParError(2)) 876 << " Chisquare: " << Form("%4.3f",fit->GetChisquare()) << " NDF : " << ndf << endl; 877 878 delete fit; 879 delete h; 880 gROOT->GetListOfFunctions()->Remove(fit); 881 882 TArrayF arr(2); 883 arr[0] = mn; 884 arr[1] = sg; 885 886 return arr; 887 } 888 889 // -------------------------------------------------------------------------- 890 // 763 891 // Calculates the average conversion factor FADC counts to photons for camera sectors. 764 892 // The geometry container is used to get the necessary -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.h
r5557 r6749 46 46 TArrayF GetAveragedConvFADC2PhotPerArea (const MGeomCam &geom, const MCalibrationQECam &qecam, 47 47 const UInt_t ai=0, MBadPixelsCam *bad=NULL); 48 TArrayF GetAveragedConvFADC2PhePerArea (const MGeomCam &geom, const MCalibrationQECam &qecam, 49 const UInt_t ai=0, MBadPixelsCam *bad=NULL); 48 50 TArrayF GetAveragedConvFADC2PhotPerSector (const MGeomCam &geom, const MCalibrationQECam &qecam, 49 51 const UInt_t sec=0, MBadPixelsCam *bad=NULL);
Note:
See TracChangeset
for help on using the changeset viewer.