 ROOT   Reference Guide rf304_uncorrprod.C File Reference

## Detailed Description  Multidimensional models: simple uncorrelated multi-dimensional pdfs

pdf = gauss(x,mx,sx) * gauss(y,my,sy) [1mRooFit v3.60 -- Developed by Wouter Verkerke and David Kirkby[0m
Copyright (C) 2000-2013 NIKHEF, University of California & Stanford University
[#0] WARNING:InputArguments -- The parameter 'sigmax' with range [-1e+30, 1e+30] of the RooGaussian 'gaussx' exceeds the safe range of (0, inf). Advise to limit its range.
[#0] WARNING:InputArguments -- The parameter 'sigmay' with range [-1e+30, 1e+30] of the RooGaussian 'gaussy' exceeds the safe range of (0, inf). Advise to limit its range.
[#1] INFO:Plotting -- RooAbsReal::plotOn(gaussxy) plot on x integrates over variables (y)
[#1] INFO:Plotting -- RooAbsReal::plotOn(gaussxy) plot on y integrates over variables (x)
#include "RooRealVar.h"
#include "RooDataSet.h"
#include "RooGaussian.h"
#include "RooProdPdf.h"
#include "TCanvas.h"
#include "TAxis.h"
#include "RooPlot.h"
using namespace RooFit;
{
// C r e a t e c o m p o n e n t p d f s i n x a n d y
// ----------------------------------------------------------------
// Create two pdfs gaussx(x,meanx,sigmax) gaussy(y,meany,sigmay) and its variables
RooRealVar x("x", "x", -5, 5);
RooRealVar y("y", "y", -5, 5);
RooRealVar meanx("mean1", "mean of gaussian x", 2);
RooRealVar meany("mean2", "mean of gaussian y", -2);
RooRealVar sigmax("sigmax", "width of gaussian x", 1);
RooRealVar sigmay("sigmay", "width of gaussian y", 5);
RooGaussian gaussx("gaussx", "gaussian PDF", x, meanx, sigmax);
RooGaussian gaussy("gaussy", "gaussian PDF", y, meany, sigmay);
// C o n s t r u c t u n c o r r e l a t e d p r o d u c t p d f
// -------------------------------------------------------------------
// Multiply gaussx and gaussy into a two-dimensional pdf gaussxy
RooProdPdf gaussxy("gaussxy", "gaussx*gaussy", RooArgList(gaussx, gaussy));
// S a m p l e p d f , p l o t p r o j e c t i o n o n x a n d y
// ---------------------------------------------------------------------------
// Generate 10000 events in x and y from gaussxy
RooDataSet *data = gaussxy.generate(RooArgSet(x, y), 10000);
// Plot x distribution of data and projection of gaussxy on x = Int(dy) gaussxy(x,y)
RooPlot *xframe = x.frame(Title("X projection of gauss(x)*gauss(y)"));
data->plotOn(xframe);
gaussxy.plotOn(xframe);
// Plot x distribution of data and projection of gaussxy on y = Int(dx) gaussxy(x,y)
RooPlot *yframe = y.frame(Title("Y projection of gauss(x)*gauss(y)"));
data->plotOn(yframe);
gaussxy.plotOn(yframe);
// Make canvas and draw RooPlots
TCanvas *c = new TCanvas("rf304_uncorrprod", "rf304_uncorrprod", 800, 400);
c->Divide(2);
c->cd(1);
xframe->GetYaxis()->SetTitleOffset(1.4);
xframe->Draw();
c->cd(2);
yframe->GetYaxis()->SetTitleOffset(1.4);
yframe->Draw();
}
Date
July 2008

Definition in file rf304_uncorrprod.C.

c
#define c(i)
Definition: RSha256.hxx:101
RooPlot::Draw
virtual void Draw(Option_t *options=0)
Draw this plot and all of the elements it contains.
Definition: RooPlot.cxx:691
RooArgList
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgList.h:21
RooGaussian.h
x
Double_t x[n]
Definition: legend1.C:17
RooGaussian
Plain Gaussian p.d.f.
Definition: RooGaussian.h:24
TCanvas.h
RooDataSet.h
rf304_uncorrprod
Definition: rf304_uncorrprod.py:1
RooProdPdf.h
RooFit
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
Definition: RooCFunction1Binding.h:29
RooAbsData::plotOn
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
Definition: RooAbsData.cxx:547
RooPlot.h
RooPlot::GetYaxis
TAxis * GetYaxis() const
Definition: RooPlot.cxx:1258
RooPlot
A RooPlot is a plot frame and a container for graphics objects within that frame.
Definition: RooPlot.h:44
y
Double_t y[n]
Definition: legend1.C:17
RooRealVar.h
TCanvas
The Canvas class.
Definition: TCanvas.h:23
TAxis.h
RooDataSet
RooDataSet is a container class to hold unbinned data.
Definition: RooDataSet.h:33
TAttAxis::SetTitleOffset
virtual void SetTitleOffset(Float_t offset=1)
Set distance between the axis and the axis title.
Definition: TAttAxis.cxx:293
RooRealVar
RooRealVar represents a variable that can be changed from the outside.
Definition: RooRealVar.h:37
RooProdPdf
RooProdPdf is an efficient implementation of a product of PDFs of the form.
Definition: RooProdPdf.h:37
RooFit::Title
RooCmdArg Title(const char *name)
Definition: RooGlobalFunc.cxx:176
RooArgSet
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:29