00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef __CINT__
00015 #include "RooGlobalFunc.h"
00016 #endif
00017 #include "RooRealVar.h"
00018 #include "RooGaussian.h"
00019 #include "RooConstVar.h"
00020 #include "RooProdPdf.h"
00021 #include "RooAbsReal.h"
00022 #include "RooPlot.h"
00023 #include "TCanvas.h"
00024 #include "TAxis.h"
00025 #include "TH1.h"
00026 using namespace RooFit ;
00027
00028
00029 void rf308_normintegration2d()
00030 {
00031
00032
00033
00034
00035 RooRealVar x("x","x",-10,10) ;
00036 RooRealVar y("y","y",-10,10) ;
00037
00038
00039 RooGaussian gx("gx","gx",x,RooConst(-2),RooConst(3)) ;
00040 RooGaussian gy("gy","gy",y,RooConst(+2),RooConst(2)) ;
00041
00042
00043 RooProdPdf gxy("gxy","gxy",RooArgSet(gx,gy)) ;
00044
00045
00046
00047
00048
00049
00050
00051 cout << "gxy = " << gxy.getVal() << endl ;
00052
00053
00054 RooArgSet nset_xy(x,y) ;
00055 cout << "gx_Norm[x,y] = " << gxy.getVal(&nset_xy) << endl ;
00056
00057
00058
00059 RooAbsReal* igxy = gxy.createIntegral(RooArgSet(x,y)) ;
00060 cout << "gx_Int[x,y] = " << igxy->getVal() << endl ;
00061
00062
00063
00064
00065 RooArgSet nset_x(x) ;
00066 cout << "gx_Norm[x] = " << gxy.getVal(&nset_x) << endl ;
00067
00068
00069 RooArgSet nset_y(y) ;
00070 cout << "gx_Norm[y] = " << gxy.getVal(&nset_y) << endl ;
00071
00072
00073
00074
00075
00076
00077
00078 x.setRange("signal",-5,5) ;
00079 y.setRange("signal",-3,3) ;
00080
00081
00082
00083
00084 RooAbsReal* igxy_sig = gxy.createIntegral(RooArgSet(x,y),NormSet(RooArgSet(x,y)),Range("signal")) ;
00085 cout << "gx_Int[x,y|signal]_Norm[x,y] = " << igxy_sig->getVal() << endl ;
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095 RooAbsReal* gxy_cdf = gxy.createCdf(RooArgSet(x,y)) ;
00096
00097
00098 TH1* hh_cdf = gxy_cdf->createHistogram("hh_cdf",x,Binning(40),YVar(y,Binning(40))) ;
00099 hh_cdf->SetLineColor(kBlue) ;
00100
00101 new TCanvas("rf308_normintegration2d","rf308_normintegration2d",600,600) ;
00102 gPad->SetLeftMargin(0.15) ; hh_cdf->GetZaxis()->SetTitleOffset(1.8) ;
00103 hh_cdf->Draw("surf") ;
00104
00105 }