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 "RooGaussian.h"
00019 #include "RooConstVar.h"
00020 #include "RooAddPdf.h"
00021 #include "RooMinuit.h"
00022 #include "TCanvas.h"
00023 #include "TAxis.h"
00024 #include "RooPlot.h"
00025 using namespace RooFit ;
00026
00027
00028 void rf605_profilell()
00029 {
00030
00031
00032
00033
00034 RooRealVar x("x","x",-20,20) ;
00035
00036
00037 RooRealVar mean("mean","mean of g1 and g2",0,-10,10) ;
00038 RooRealVar sigma_g1("sigma_g1","width of g1",3) ;
00039 RooGaussian g1("g1","g1",x,mean,sigma_g1) ;
00040
00041 RooRealVar sigma_g2("sigma_g2","width of g2",4,3.0,6.0) ;
00042 RooGaussian g2("g2","g2",x,mean,sigma_g2) ;
00043
00044 RooRealVar frac("frac","frac",0.5,0.0,1.0) ;
00045 RooAddPdf model("model","model",RooArgList(g1,g2),frac) ;
00046
00047
00048 RooDataSet* data = model.generate(x,1000) ;
00049
00050
00051
00052
00053
00054
00055
00056 RooAbsReal* nll = model.createNLL(*data,NumCPU(2)) ;
00057
00058
00059 RooMinuit(*nll).migrad() ;
00060
00061
00062 RooPlot* frame1 = frac.frame(Bins(10),Range(0.01,0.95),Title("LL and profileLL in frac")) ;
00063 nll->plotOn(frame1,ShiftToZero()) ;
00064
00065
00066 RooPlot* frame2 = sigma_g2.frame(Bins(10),Range(3.3,5.0),Title("LL and profileLL in sigma_g2")) ;
00067 nll->plotOn(frame2,ShiftToZero()) ;
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077 RooAbsReal* pll_frac = nll->createProfile(frac) ;
00078
00079
00080 pll_frac->plotOn(frame1,LineColor(kRed)) ;
00081
00082
00083 frame1->SetMinimum(0) ;
00084 frame1->SetMaximum(3) ;
00085
00086
00087
00088
00089
00090
00091
00092
00093 RooAbsReal* pll_sigmag2 = nll->createProfile(sigma_g2) ;
00094
00095
00096 pll_sigmag2->plotOn(frame2,LineColor(kRed)) ;
00097
00098
00099 frame2->SetMinimum(0) ;
00100 frame2->SetMaximum(3) ;
00101
00102
00103
00104
00105 TCanvas *c = new TCanvas("rf605_profilell","rf605_profilell",800, 400);
00106 c->Divide(2);
00107 c->cd(1) ; gPad->SetLeftMargin(0.15) ; frame1->GetYaxis()->SetTitleOffset(1.4) ; frame1->Draw() ;
00108 c->cd(2) ; gPad->SetLeftMargin(0.15) ; frame2->GetYaxis()->SetTitleOffset(1.4) ; frame2->Draw() ;
00109
00110 delete pll_frac ;
00111 delete pll_sigmag2 ;
00112 delete nll ;
00113 }
00114