ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TestNonCentral.C
Go to the documentation of this file.
1 
2 using namespace RooFit;
4 
5  RooWorkspace w("w");
6  // k <2, must use sum
7  w.factory("NonCentralChiSquare::nc(x[0,50],k[1.99,0,5],lambda[5])");
8  // kk > 2 can use bessel
9  w.factory("NonCentralChiSquare::ncc(x,kk[2.01,0,5],lambda)");
10  // kk > 2, force sum
11  w.factory("NonCentralChiSquare::nccc(x,kk,lambda)");
12  ((RooNonCentralChiSquare*)w.pdf("nccc"))->SetForceSum(true);
13 
14  // a normal "central" chi-square for comparision when lambda->0
15  w.factory("ChiSquarePdf::cs(x,k)");
16 
17  //w.var("kk")->setVal(4.); // test a large kk
18 
19  RooDataSet* ncdata = w.pdf("nc")->generate(*w.var("x"),100);
20  RooDataSet* csdata = w.pdf("cs")->generate(*w.var("x"),100);
21  RooPlot* plot = w.var("x")->frame();
22  ncdata->plotOn(plot,MarkerColor(kRed));
23  csdata->plotOn(plot,MarkerColor(kBlue));
24  w.pdf("nc")->plotOn(plot,LineColor(kRed));
25  w.pdf("ncc")->plotOn(plot,LineColor(kGreen));
26  w.pdf("nccc")->plotOn(plot,LineColor(kYellow),LineStyle(kDashed));
27  w.pdf("cs")->plotOn(plot,LineColor(kBlue),LineStyle(kDotted));
28  plot->Draw();
29 
30 }
RooCmdArg LineColor(Color_t color)
Definition: Rtypes.h:61
Definition: Rtypes.h:61
Definition: Rtypes.h:61
The PDF of the Non-Central Chi Square distribution for n degrees of freedom.
void plot(TString fname="data.root", TString var0="var0", TString var1="var1")
Definition: createData.C:17
RooAbsPdf * pdf(const char *name) const
Retrieve p.d.f (RooAbsPdf) with given name. A null pointer is returned if not found.
RooCmdArg LineStyle(Style_t style)
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
Plot dataset on specified frame.
Definition: RooAbsData.cxx:626
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 RooCmdArg &arg9=RooCmdArg::none(), const RooCmdArg &arg10=RooCmdArg::none()) const
Plot (project) PDF on specified frame.
Definition: RooAbsPdf.h:105
tuple w
Definition: qtexample.py:51
RooPlot * frame(const RooCmdArg &arg1, 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
RooDataSet is a container class to hold unbinned data.
Definition: RooDataSet.h:29
void TestNonCentral()
Definition: TestNonCentral.C:3
RooRealVar * var(const char *name) const
Retrieve real-valued variable (RooRealVar) with given name. A null pointer is returned if not found...
A RooPlot is a plot frame and a container for graphics objects within that frame. ...
Definition: RooPlot.h:41
RooFactoryWSTool & factory()
Return instance to factory tool.
RooDataSet * generate(const RooArgSet &whatVars, Int_t nEvents, const RooCmdArg &arg1, const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none())
Generate a new dataset containing the specified variables with events sampled from our distribution...
Definition: RooAbsPdf.cxx:1702
Definition: Rtypes.h:61
RooCmdArg MarkerColor(Color_t color)
The RooWorkspace is a persistable container for RooFit projects.
Definition: RooWorkspace.h:42
virtual void Draw(Option_t *options=0)
Draw this plot and all of the elements it contains.
Definition: RooPlot.cxx:559