Loading [MathJax]/extensions/tex2jax.js
Logo ROOT   6.16/01
Reference Guide
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
TestNonCentral.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_roostats
3/// \notebook -js
4///
5/// \macro_image
6/// \macro_output
7/// \macro_code
8///
9/// \author Lorenzo Moneta
10
11using namespace RooFit;
12void TestNonCentral(){
13
14 RooWorkspace w("w");
15 // k <2, must use sum
16 w.factory("NonCentralChiSquare::nc(x[0,50],k[1.99,0,5],lambda[5])");
17 // kk > 2 can use bessel
18 w.factory("NonCentralChiSquare::ncc(x,kk[2.01,0,5],lambda)");
19 // kk > 2, force sum
20 w.factory("NonCentralChiSquare::nccc(x,kk,lambda)");
21 ((RooNonCentralChiSquare*)w.pdf("nccc"))->SetForceSum(true);
22
23 // a normal "central" chi-square for comparison when lambda->0
24 w.factory("ChiSquarePdf::cs(x,k)");
25
26 //w.var("kk")->setVal(4.); // test a large kk
27
28 RooDataSet* ncdata = w.pdf("nc")->generate(*w.var("x"),100);
29 RooDataSet* csdata = w.pdf("cs")->generate(*w.var("x"),100);
30 RooPlot* plot = w.var("x")->frame();
31 ncdata->plotOn(plot,MarkerColor(kRed));
32 csdata->plotOn(plot,MarkerColor(kBlue));
33 w.pdf("nc")->plotOn(plot,LineColor(kRed));
34 w.pdf("ncc")->plotOn(plot,LineColor(kGreen));
35 w.pdf("nccc")->plotOn(plot,LineColor(kYellow),LineStyle(kDashed));
36 w.pdf("cs")->plotOn(plot,LineColor(kBlue),LineStyle(kDotted));
37 plot->Draw();
38
39}
@ kRed
Definition: Rtypes.h:63
@ kGreen
Definition: Rtypes.h:63
@ kBlue
Definition: Rtypes.h:63
@ kYellow
Definition: Rtypes.h:63
@ kDashed
Definition: TAttLine.h:48
@ kDotted
Definition: TAttLine.h:48
virtual RooPlot * plotOn(RooPlot *frame, const RooCmdArg &arg1=RooCmdArg::none(), const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none(), const RooCmdArg &arg6=RooCmdArg::none(), const RooCmdArg &arg7=RooCmdArg::none(), const RooCmdArg &arg8=RooCmdArg::none()) const
Calls RooPlot* plotOn(RooPlot* frame, const RooLinkedList& cmdList) const ;.
Definition: RooAbsData.cxx:531
RooDataSet is a container class to hold unbinned data.
Definition: RooDataSet.h:31
The PDF of the Non-Central Chi Square distribution for n degrees of freedom.
A RooPlot is a plot frame and a container for graphics objects within that frame.
Definition: RooPlot.h:41
virtual void Draw(Option_t *options=0)
Draw this plot and all of the elements it contains.
Definition: RooPlot.cxx:558
The RooWorkspace is a persistable container for RooFit projects.
Definition: RooWorkspace.h:43
RooCmdArg MarkerColor(Color_t color)
RooCmdArg LineColor(Color_t color)
RooCmdArg LineStyle(Style_t style)