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 "TAxis.h"
00025 #include "TH1.h"
00026 using namespace RooFit ;
00027
00028
00029
00030 void rf301_composition()
00031 {
00032
00033
00034
00035
00036 RooRealVar x("x","x",-5,5) ;
00037 RooRealVar y("y","y",-5,5) ;
00038
00039
00040 RooRealVar a0("a0","a0",-0.5,-5,5) ;
00041 RooRealVar a1("a1","a1",-0.5,-1,1) ;
00042 RooPolyVar fy("fy","fy",y,RooArgSet(a0,a1)) ;
00043
00044
00045 RooRealVar sigma("sigma","width of gaussian",0.5) ;
00046 RooGaussian model("model","Gaussian with shifting mean",x,fy,sigma) ;
00047
00048
00049
00050
00051
00052
00053 RooDataSet *data = model.generate(RooArgSet(x,y),10000) ;
00054
00055
00056 RooPlot* xframe = x.frame() ;
00057 data->plotOn(xframe) ;
00058 model.plotOn(xframe) ;
00059
00060
00061 RooPlot* yframe = y.frame() ;
00062 data->plotOn(yframe) ;
00063 model.plotOn(yframe) ;
00064
00065
00066 TH1* hh_model = model.createHistogram("hh_model",x,Binning(50),YVar(y,Binning(50))) ;
00067 hh_model->SetLineColor(kBlue) ;
00068
00069
00070
00071
00072 TCanvas *c = new TCanvas("rf301_composition","rf301_composition",1200, 400);
00073 c->Divide(3);
00074 c->cd(1) ; gPad->SetLeftMargin(0.15) ; xframe->GetYaxis()->SetTitleOffset(1.4) ; xframe->Draw() ;
00075 c->cd(2) ; gPad->SetLeftMargin(0.15) ; yframe->GetYaxis()->SetTitleOffset(1.4) ; yframe->Draw() ;
00076 c->cd(3) ; gPad->SetLeftMargin(0.20) ; hh_model->GetZaxis()->SetTitleOffset(2.5) ; hh_model->Draw("surf") ;
00077
00078 }
00079
00080
00081