00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef __CINT__
00016 #include "RooGlobalFunc.h"
00017 #endif
00018 #include "RooRealVar.h"
00019 #include "RooDataSet.h"
00020 #include "RooGaussian.h"
00021 #include "RooPolyVar.h"
00022 #include "RooPlot.h"
00023 #include "TCanvas.h"
00024 #include "TH1.h"
00025 using namespace RooFit ;
00026
00027
00028
00029 class TestBasic301 : public RooFitTestUnit
00030 {
00031 public:
00032 TestBasic301(TFile* refFile, Bool_t writeRef, Int_t verbose) : RooFitTestUnit("Composition extension of basic p.d.f",refFile,writeRef,verbose) {} ;
00033 Bool_t testCode() {
00034
00035
00036
00037
00038
00039 RooRealVar x("x","x",-5,5) ;
00040 RooRealVar y("y","y",-5,5) ;
00041
00042
00043 RooRealVar a0("a0","a0",-0.5,-5,5) ;
00044 RooRealVar a1("a1","a1",-0.5,-1,1) ;
00045 RooPolyVar fy("fy","fy",y,RooArgSet(a0,a1)) ;
00046
00047
00048 RooRealVar sigma("sigma","width of gaussian",0.5) ;
00049 RooGaussian model("model","Gaussian with shifting mean",x,fy,sigma) ;
00050
00051
00052
00053
00054
00055
00056 RooDataSet *data = model.generate(RooArgSet(x,y),10000) ;
00057
00058
00059 RooPlot* xframe = x.frame() ;
00060 data->plotOn(xframe) ;
00061 model.plotOn(xframe) ;
00062
00063
00064 RooPlot* yframe = y.frame() ;
00065 data->plotOn(yframe) ;
00066 model.plotOn(yframe) ;
00067
00068
00069 TH1* hh_model = model.createHistogram("hh_model",x,Binning(50),YVar(y,Binning(50))) ;
00070 hh_model->SetLineColor(kBlue) ;
00071
00072
00073 regPlot(xframe,"rf301_plot1") ;
00074 regPlot(yframe,"rf302_plot2") ;
00075 regTH(hh_model,"rf302_model2d") ;
00076
00077 delete data ;
00078 return kTRUE ;
00079 }
00080 } ;
00081
00082