00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef __CINT__
00014 #include "RooGlobalFunc.h"
00015 #endif
00016 #include "RooRealVar.h"
00017 #include "RooDataSet.h"
00018 #include "RooGaussian.h"
00019 #include "RooPolynomial.h"
00020 #include "RooHistPdf.h"
00021 #include "TCanvas.h"
00022 #include "RooPlot.h"
00023 using namespace RooFit ;
00024
00025
00026
00027 class TestBasic706 : public RooFitTestUnit
00028 {
00029 public:
00030 TestBasic706(TFile* refFile, Bool_t writeRef, Int_t verbose) : RooFitTestUnit("Histogram based p.d.f.s",refFile,writeRef,verbose) {} ;
00031 Bool_t testCode() {
00032
00033
00034
00035
00036 RooRealVar x("x","x",0,20) ;
00037 RooPolynomial p("p","p",x,RooArgList(RooConst(0.01),RooConst(-0.01),RooConst(0.0004))) ;
00038
00039
00040
00041
00042
00043
00044
00045 x.setBins(20) ;
00046 RooDataSet* data1 = p.generate(x,500) ;
00047
00048
00049 RooDataHist* hist1 = data1->binnedClone() ;
00050
00051
00052 RooHistPdf histpdf1("histpdf1","histpdf1",x,*hist1,0) ;
00053
00054
00055 RooPlot* frame1 = x.frame(Title("Low statistics histogram pdf"),Bins(100)) ;
00056 data1->plotOn(frame1) ;
00057 histpdf1.plotOn(frame1) ;
00058
00059
00060
00061
00062
00063
00064 x.setBins(10) ;
00065 RooDataSet* data2 = p.generate(x,100000) ;
00066
00067
00068 RooDataHist* hist2 = data2->binnedClone() ;
00069
00070
00071 RooHistPdf histpdf2("histpdf2","histpdf2",x,*hist2,2) ;
00072
00073
00074 RooPlot* frame2 = x.frame(Title("High stats histogram pdf with interpolation"),Bins(100)) ;
00075 data2->plotOn(frame2) ;
00076 histpdf2.plotOn(frame2) ;
00077
00078
00079 regPlot(frame1,"rf607_plot1") ;
00080 regPlot(frame2,"rf607_plot2") ;
00081
00082 delete data1 ;
00083 delete hist1 ;
00084 delete data2 ;
00085 delete hist2 ;
00086
00087 return kTRUE ;
00088 }
00089 } ;