Changeset 14231
- Timestamp:
- 06/25/12 17:52:05 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/tools/marsmacros/singlepe.C
r14230 r14231 421 421 // ====================================================== 422 422 423 const char *drsfile = "/fact/raw/2012/03/09/20120309_012.drs.fits.gz"; 424 // const char *drsfile = "/fact/raw/2012/01/13/20120113_003.drs.fits.gz"; 423 const char *drsfile = "/fact/raw/2012/05/18/20120518_012.drs.fits.gz"; 425 424 426 425 MDirIter iter; 427 // iter.AddDirectory("/fact/raw/2012/03/09", "20120309_014.fits.gz"); 428 // iter.AddDirectory("/fact/raw/2012/03/09", "20120309_032.fits.gz"); 429 // iter.AddDirectory("/fact/raw/2012/03/09", "20120309_038.fits.gz"); 430 iter.AddDirectory("/fact/raw/2012/03/09", "20120309_017.fits.gz"); 431 // iter.AddDirectory("/fact/raw/2012/03/09", "20120309_018.fits.gz"); 432 // iter.AddDirectory("/fact/raw/2012/01/13", "20120113_007.fits.gz"); 426 iter.AddDirectory("/fact/raw/2012/05/18", "20120518_005.fits.gz"); 433 427 434 428 // ====================================================== … … 519 513 plist1.AddToList(&header); 520 514 521 MEvtLoop loop1("DetermineCalConst"); 515 TString Title; 516 Title = iter.Next(); 517 iter.Reset(); 518 Title += "; "; 519 Title += max1; 520 521 MEvtLoop loop1(Title); 522 522 loop1.SetDisplay(d); 523 523 loop1.SetParList(&plist1); … … 602 602 TH1F hSum ("Sum1", "Sum of all pixel amplitude Spectra", 603 603 100, 0, 2000); 604 hSum.Sumw2(); 605 604 606 TH1F hSumScale ("Sum2", 605 607 "Sum of all pixel amplitude Spectra (scaled with gain)", 606 100, 0, 10); 608 100, 0.05, 10.05); 609 hSumScale.Sumw2(); 607 610 608 611 // define fit function for Amplitudespectrum … … 648 651 649 652 // List of Pixel that should be ignored in camera view 650 suspicous[802] = true; 651 suspicous[543] = true; 652 suspicous[465] = true; 653 suspicous[1154] = true; 654 suspicous[342] = true; 655 suspicous[1319] = true; 656 suspicous[1401] = true; 657 suspicous[1318] = true; 658 suspicous[1400] = true; 659 suspicous[243] = true; 660 suspicous[1299] = true; 661 suspicous[764] = true; 662 suspicous[762] = true; 663 suspicous[1427] = true; 664 suspicous[1319] = true; 665 suspicous[118] = true; 653 // suspicous[802] = true; 666 654 667 655 //------------------------------------------------------------------------ … … 684 672 } 685 673 } 674 for(UInt_t bin = 1; bin < hSum.GetNbinsX()+1; bin++) 675 { 676 hSum.SetBinError(bin, hSum.GetBinContent(bin)*0.1); 677 } 686 678 687 679 gROOT->SetSelectedPad(0); 688 680 TCanvas &c11 = d->AddTab("SumHist"); 689 681 gPad->SetLogy(); 690 hSum.DrawCopy(); 682 gPad->SetGridx(); 683 gPad->SetGridy(); 684 hSum.DrawCopy("hist"); 691 685 //------------------------fit sum spectrum------------------------------- 692 686 const Int_t maxbin = hSum.GetMaximumBin(); … … 716 710 717 711 //calculate fit range 718 const double min = sum_par[1]-fwhm2* 1.4;712 const double min = sum_par[1]-fwhm2*2; 719 713 const double max = sum_par[1]*(maxOrder+1); 720 func2.SetRange(min -2*fwhm2, max);714 func2.SetRange(min, max); 721 715 722 716 //Fit and draw spectrum … … 762 756 TF1 fExpo1( "fExpo1","expo", min, max); 763 757 fExpo1.SetLineColor(kRed); 764 hMaxHeightsSum.Fit(&fExpo1, "N0S" ); 758 hMaxHeightsSum.Fit(&fExpo1, "WLN0S" ); 759 hMaxHeightsSum.DrawCopy("SAME"); 765 760 fExpo1.DrawCopy("SAME"); 766 761 … … 784 779 TH1D *hist = hsignal->ProjectionY("proj", pixel+1, pixel+1); 785 780 hist->SetDirectory(0); 781 782 for(UInt_t bin = 1; bin < hSum.GetNbinsX()+1; bin++) 783 { 784 hist->SetBinError(bin, hSum.GetBinContent(bin)*0.1); 785 } 786 786 787 787 const Int_t maxbin = hist->GetMaximumBin(); … … 835 835 << fwhm << "\t" << endl; 836 836 } 837 838 //Rebin Projection 839 hist->Rebin(2); 840 837 841 //Fit Pixels spectrum 838 const TFitResultPtr rc = hist->Fit(&func, " N0QS", "", fit_min, fit_max);842 const TFitResultPtr rc = hist->Fit(&func, "WLN0QS", "", fit_min, fit_max); 839 843 840 844 const bool ok = int(rc)==0; … … 878 882 for (int b=1; b<=hist->GetNbinsX(); b++) 879 883 { 880 hSum.Fill(hist->GetBinCenter(b), hist->GetBinContent(b));884 // hSum.Fill(hist->GetBinCenter(b), hist->GetBinContent(b)); 881 885 hSumScale.Fill((hist->GetBinCenter(b)-fOffset)/fGain, hist->GetBinContent(b)); 882 886 } … … 891 895 c.cd(); 892 896 hist->SetName(Form("Pix%d", pixel)); 893 hist->DrawCopy( )->SetDirectory(0);897 hist->DrawCopy("hist")->SetDirectory(0); 894 898 // hist->Draw(); 895 899 func.DrawCopy("SAME"); … … 916 920 TCanvas &c12 = d->AddTab("GainHist"); 917 921 gPad->SetLogy(); 918 hSumScale.DrawCopy(); 922 gPad->SetGridx(); 923 gPad->SetGridy(); 924 for(UInt_t bin = 1; bin < hSum.GetNbinsX()+1; bin++) 925 { 926 hSumScale.SetBinError(bin, hSum.GetBinContent(bin)*0.1); 927 } 928 hSumScale.DrawCopy("hist"); 929 919 930 920 931 //-------------------- fit gain corrected sum spectrum ------------------- … … 939 950 Double_t par2[5] = 940 951 { 941 ampl2, hSumScale.GetBinCenter(maxbin2), fwhm2*1.4, 0.1, -0.2952 ampl2, 1, fwhm2*1.4, Crosstlk, 0 942 953 }; 943 954 944 955 func3.SetParameters(par2); 956 func3.FixParameter(1,1); 957 func3.FixParameter(4,0); 945 958 946 959 const double min2 = par2[1]-fwhm2*1.4; 947 960 const double max2 = par2[1]*maxOrder; 948 961 // func.SetRange(min2-fwhm2, max); 949 hSumScale.Fit(&func3, " N0QS", "", min2, max2);962 hSumScale.Fit(&func3, "WLN0QS", "", min2, max2); 950 963 func3.DrawCopy("SAME"); 951 964 … … 987 1000 c2.cd(2); 988 1001 gPad->SetLogy(); 1002 TF1 GainGaus( "GainGaus", "gaus"); 1003 hGain.Fit(&GainGaus, "N0QS"); 1004 // hGain.Scale(1/GainGaus.GetParameter(1)); 989 1005 hGain.DrawCopy(); 1006 GainGaus.DrawCopy("SAME"); 990 1007 991 1008 c2.cd(3); … … 1070 1087 // xTalk *= cross; 1071 1088 // } 1072 cross *= TMath::Exp(-powOfX*cross);1089 // cross *= TMath::Exp(-powOfX*cross); 1073 1090 xTalk *= cross; 1074 1091 }
Note:
See TracChangeset
for help on using the changeset viewer.