00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef __CINT__
00011 #include "RooGlobalFunc.h"
00012 #endif
00013 #include "RooRealVar.h"
00014 #include "RooProdPdf.h"
00015 #include "RooWorkspace.h"
00016 #include "RooDataSet.h"
00017 #include "TCanvas.h"
00018 #include "TH1.h"
00019
00020 using namespace RooFit;
00021 using namespace RooStats;
00022
00023 void Zbi_Zgamma() {
00024
00025
00026
00027
00028 RooWorkspace* w = new RooWorkspace("w",true);
00029 w->factory("Poisson::px(x[150,0,500],sum::splusb(s[0,0,100],b[100,0,300]))");
00030 w->factory("Poisson::py(y[100,0,500],prod::taub(tau[1.],b))");
00031 w->factory("Uniform::prior_b(b)");
00032
00033
00034
00035 w->factory("PROJ::averagedModel(PROD::foo(px|b,py,prior_b),b)") ;
00036
00037
00038 RooPlot* frame = w->var("x")->frame() ;
00039 w->pdf("averagedModel")->plotOn(frame) ;
00040 w->pdf("px")->plotOn(frame,LineColor(kRed)) ;
00041 frame->Draw() ;
00042
00043
00044
00045
00046
00047
00048 w->var("y")->setVal(100);
00049 w->var("x")->setVal(150);
00050 RooAbsReal* cdf = w->pdf("averagedModel")->createCdf(*w->var("x"));
00051 cdf->getVal();
00052
00053 cout << "Hybrid p-value = " << cdf->getVal() << endl;
00054 cout << "Z_Gamma Significance = " <<
00055 PValueToSignificance(1-cdf->getVal()) << endl;
00056
00057
00058 double Z_Bi = NumberCountingUtils::BinomialWithTauObsZ(150, 100, 1);
00059 std::cout << "Z_Bi significance estimation: " << Z_Bi << std::endl;
00060
00061
00062
00063
00064
00065
00066
00067 }