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 "RooConstVar.h"
00019 #include "RooGaussian.h"
00020 #include "RooProdPdf.h"
00021 #include "TCanvas.h"
00022 #include "TAxis.h"
00023 #include "TH1.h"
00024 #include "RooPlot.h"
00025 using namespace RooFit ;
00026
00027
00028 void rf309_ndimplot()
00029 {
00030
00031
00032
00033
00034
00035 RooRealVar x("x","x",-5,5) ;
00036 RooRealVar y("y","y",-5,5) ;
00037
00038
00039 RooRealVar a0("a0","a0",-3.5,-5,5) ;
00040 RooRealVar a1("a1","a1",-1.5,-1,1) ;
00041 RooRealVar sigma("sigma","width of gaussian",1.5) ;
00042
00043
00044 RooFormulaVar fy("fy","a0-a1*sqrt(10*abs(y))",RooArgSet(y,a0,a1)) ;
00045
00046
00047 RooGaussian model("model","Gaussian with shifting mean",x,fy,sigma) ;
00048
00049
00050 RooDataSet* data = model.generate(RooArgSet(x,y),10000) ;
00051
00052
00053
00054
00055
00056
00057
00058 TH1* hh_data = data->createHistogram("x,y",20,20) ;
00059
00060
00061
00062 TH1* hh_pdf = model.createHistogram("x,y",50,50) ;
00063 hh_pdf->SetLineColor(kBlue) ;
00064
00065
00066
00067
00068
00069
00070 RooRealVar z("z","z",-5,5) ;
00071
00072 RooGaussian gz("gz","gz",z,RooConst(0),RooConst(2)) ;
00073 RooProdPdf model3("model3","model3",RooArgSet(model,gz)) ;
00074
00075 RooDataSet* data3 = model3.generate(RooArgSet(x,y,z),10000) ;
00076
00077
00078
00079
00080
00081
00082 TH1* hh_data3 = data3->createHistogram("hh_data3",x,Binning(8),YVar(y,Binning(8)),ZVar(z,Binning(8))) ;
00083
00084
00085 TH1* hh_pdf3 = model3.createHistogram("hh_model3",x,Binning(20),YVar(y,Binning(20)),ZVar(z,Binning(20))) ;
00086 hh_pdf3->SetFillColor(kBlue) ;
00087
00088
00089
00090 TCanvas* c1 = new TCanvas("rf309_2dimplot","rf309_2dimplot",800,800) ;
00091 c1->Divide(2,2) ;
00092 c1->cd(1) ; gPad->SetLeftMargin(0.15) ; hh_data->GetZaxis()->SetTitleOffset(1.4) ; hh_data->Draw("lego") ;
00093 c1->cd(2) ; gPad->SetLeftMargin(0.20) ; hh_pdf->GetZaxis()->SetTitleOffset(2.5) ; hh_pdf->Draw("surf") ;
00094 c1->cd(3) ; gPad->SetLeftMargin(0.15) ; hh_data->GetZaxis()->SetTitleOffset(1.4) ; hh_data->Draw("box") ;
00095 c1->cd(4) ; gPad->SetLeftMargin(0.15) ; hh_pdf->GetZaxis()->SetTitleOffset(2.5) ; hh_pdf->Draw("cont3") ;
00096
00097 TCanvas* c2 = new TCanvas("rf309_3dimplot","rf309_3dimplot",800,400) ;
00098 c2->Divide(2) ;
00099 c2->cd(1) ; gPad->SetLeftMargin(0.15) ; hh_data3->GetZaxis()->SetTitleOffset(1.4) ; hh_data3->Draw("lego") ;
00100 c2->cd(2) ; gPad->SetLeftMargin(0.15) ; hh_pdf3->GetZaxis()->SetTitleOffset(1.4) ; hh_pdf3->Draw("iso") ;
00101
00102 }