Logo ROOT  
Reference Guide
rf313_paramranges.C File Reference

Detailed Description

View in nbviewer Open in SWAN

Multidimensional models: working with parametrized ranges to define non-rectangular regions for fitting and integration

RooFit v3.60 -- Developed by Wouter Verkerke and David Kirkby
Copyright (C) 2000-2013 NIKHEF, University of California & Stanford University
All rights reserved, please read http://roofit.sourceforge.net/license.txt
[#1] INFO:NumericIntegration -- RooRealIntegral::init(pxyz_Int[z|R]_Norm[x,y,z]_Int[y|R]) using numeric integrator RooIntegrator1D to calculate Int(y)
[#1] INFO:NumericIntegration -- RooRealIntegral::init(pxyz_Int[z|R]_Norm[x,y,z]_Int[y|R]_Int[x|R]) using numeric integrator RooIntegrator1D to calculate Int(x)
[#1] INFO:NumericIntegration -- RooRealIntegral::init(pxyz_Int[z|R]_Norm[x,y,z]_Int[y|R]) using numeric integrator RooIntegrator1D to calculate Int(y)
#include "RooRealVar.h"
#include "RooDataSet.h"
#include "RooGaussian.h"
#include "RooConstVar.h"
#include "RooPolynomial.h"
#include "RooProdPdf.h"
#include "TCanvas.h"
#include "TAxis.h"
#include "RooPlot.h"
using namespace RooFit;
{
// C r e a t e 3 D p d f
// -------------------------
// Define observable (x,y,z)
RooRealVar x("x", "x", 0, 10);
RooRealVar y("y", "y", 0, 10);
RooRealVar z("z", "z", 0, 10);
// Define 3 dimensional pdf
RooRealVar z0("z0", "z0", -0.1, 1);
RooPolynomial px("px", "px", x, RooConst(0));
RooPolynomial py("py", "py", y, RooConst(0));
RooPolynomial pz("pz", "pz", z, z0);
RooProdPdf pxyz("pxyz", "pxyz", RooArgSet(px, py, pz));
// D e f i n e d n o n - r e c t a n g u l a r r e g i o n R i n ( x , y , z )
// -------------------------------------------------------------------------------------
//
// R = Z[0 - 0.1*Y^2] * Y[0.1*X - 0.9*X] * X[0 - 10]
//
// Construct range parametrized in "R" in y [ 0.1*x, 0.9*x ]
RooFormulaVar ylo("ylo", "0.1*x", x);
RooFormulaVar yhi("yhi", "0.9*x", x);
y.setRange("R", ylo, yhi);
// Construct parametrized ranged "R" in z [ 0, 0.1*y^2 ]
RooFormulaVar zlo("zlo", "0.0*y", y);
RooFormulaVar zhi("zhi", "0.1*y*y", y);
z.setRange("R", zlo, zhi);
// C a l c u l a t e i n t e g r a l o f n o r m a l i z e d p d f i n R
// ----------------------------------------------------------------------------------
// Create integral over normalized pdf model over x,y,z in "R" region
RooAbsReal *intPdf = pxyz.createIntegral(RooArgSet(x, y, z), RooArgSet(x, y, z), "R");
// Plot value of integral as function of pdf parameter z0
RooPlot *frame = z0.frame(Title("Integral of pxyz over x,y,z in region R"));
intPdf->plotOn(frame);
new TCanvas("rf313_paramranges", "rf313_paramranges", 600, 600);
gPad->SetLeftMargin(0.15);
frame->GetYaxis()->SetTitleOffset(1.6);
frame->Draw();
return;
}
Date
07/2008
Author
Wouter Verkerke

Definition in file rf313_paramranges.C.

RooPlot::Draw
virtual void Draw(Option_t *options=0)
Draw this plot and all of the elements it contains.
Definition: RooPlot.cxx:691
RooAbsReal::createIntegral
RooAbsReal * createIntegral(const RooArgSet &iset, 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
Create an object that represents the integral of the function over one or more observables listed in ...
Definition: RooAbsReal.cxx:561
RooGaussian.h
x
Double_t x[n]
Definition: legend1.C:17
RooAbsReal
Definition: RooAbsReal.h:61
TCanvas.h
RooDataSet.h
RooPolynomial.h
RooFormulaVar
Definition: RooFormulaVar.h:30
RooProdPdf.h
RooFit
Definition: RooCFunction1Binding.h:29
RooPolynomial
Definition: RooPolynomial.h:28
RooPlot.h
RooPlot::GetYaxis
TAxis * GetYaxis() const
Definition: RooPlot.cxx:1256
RooPlot
Definition: RooPlot.h:44
rf313_paramranges
Definition: rf313_paramranges.py:1
y
Double_t y[n]
Definition: legend1.C:17
RooRealVar.h
RooConstVar.h
RooAbsReal::plotOn
virtual RooPlot * plotOn(RooPlot *frame, const RooCmdArg &arg1=RooCmdArg(), const RooCmdArg &arg2=RooCmdArg(), const RooCmdArg &arg3=RooCmdArg(), const RooCmdArg &arg4=RooCmdArg(), const RooCmdArg &arg5=RooCmdArg(), const RooCmdArg &arg6=RooCmdArg(), const RooCmdArg &arg7=RooCmdArg(), const RooCmdArg &arg8=RooCmdArg(), const RooCmdArg &arg9=RooCmdArg(), const RooCmdArg &arg10=RooCmdArg()) const
Plot (project) PDF on specified frame.
Definition: RooAbsReal.cxx:1714
TCanvas
Definition: TCanvas.h:23
TAxis.h
gPad
#define gPad
Definition: TVirtualPad.h:287
TAttAxis::SetTitleOffset
virtual void SetTitleOffset(Float_t offset=1)
Set distance between the axis and the axis title.
Definition: TAttAxis.cxx:293
RooRealVar
Definition: RooRealVar.h:35
RooProdPdf
Definition: RooProdPdf.h:33
RooFit::Title
RooCmdArg Title(const char *name)
Definition: RooGlobalFunc.cxx:173
RooArgSet
Definition: RooArgSet.h:28
RooFit::RooConst
RooConstVar & RooConst(Double_t val)
Definition: RooGlobalFunc.cxx:341