Plotting Conditional RooProdPdf on 1d plot with pyroot

Dear RooFit and pyroot experts,

I’m trying to rewrite this tutorial :
root.cern.ch/root/html/tutorials … rod.C.html
with pyroot.

However I get the following error when trying to run :
[#0] ERROR:Plotting – RooProdPdf::model:plotOn: WARNING: variable is not an explicit dependent: x
[#0] ERROR:Plotting – RooProdPdf::model:plotOn: WARNING: variable is not an explicit dependent: x
[#1] INFO:Plotting – RooAbsReal::plotOn(model) plot on x integrates over variables (y)
[#0] ERROR:Plotting – RooProdPdf::model:createPlotProjection: “x” is not a dependent and will be ignored.
[#0] ERROR:InputArguments – RooProdPdf::model:fillHistogram: WARNING: variable is not an explicit dependent: x
[#0] ERROR:Plotting – RooProdPdf::model:createPlotProjection: “x” is not a dependent and will be ignored.

Below is code snipet :
x = ROOT.RooRealVar(“x”,“x”,-5,5)
y = ROOT.RooRealVar(“y”,“y”,-5,5)
a0 = ROOT.RooRealVar(“a0”,“a0”,-0.5,-5,5)
a1 = ROOT.RooRealVar(“a1”,“a1”,-0.5,-1,1)
fy = ROOT.RooPolyVar(“fy”,“fy”,y,ROOT.RooArgList(a0,a1))
sigmax = ROOT.RooRealVar(“sigma”,“width of gaussian”,0.5)
gaussx = ROOT.RooGaussian(“gaussx”,“Gaussian in x with shifting mean in y”,x,fy,sigmax)
gaussy = ROOT.RooGaussian(“gaussy”,“Gaussian in y”,y,ROOT.RooFit.RooConst(0),ROOT.RooFit.RooConst(3))
model = ROOT.RooProdPdf(“model”,“gaussx(x|y)*gaussy(y)”,ROOT.RooArgSet(gaussy),ROOT.RooFit.Conditional(ROOT.RooArgSet(gaussx),ROOT.RooArgSet(x)))
xframe = x.frame()
model.plotOn(xframe)

I’m using ROOT 5.22/00b and the cint macro work perfectly well with this version.

Cheers,
Renaud.

Hi Renaud,

I’m not much of a python expert: if you can give a complete
prescription how to run this in pyroot from the unix command
line, I can have a look at the RooFit end of things.

Wouter

Hi Wouter,

I have put my small translation of the cint macro to pyroot in attach.
In order to run it, I only type
python -i condcorrprod.py

Cheers,
Renaud.
condcorrprod.py (2.34 KB)

Hi Renaud,

When I run your macro in ROOT release 5.24, I do not get the problem:

bash-3.00$ python condcorrprod.py

RooFit v3.00 – Developed by Wouter Verkerke and David Kirkby
Copyright © 2000-2009 NIKHEF, University of California & Stanford University
All rights reserved, please read roofit.sourceforge.net/license.txt

[#1] INFO:Plotting – RooAbsReal::plotOn(model) plot on x integrates over variables (y)
[#1] INFO:NumericIntegration – RooRealIntegral::init(SPECINT_gaussy_NORM[y]_X_gaussx_NORM[x]_Int[y]) using numeric integrator RooIntegrator1D to calculate Int(y)
[#1] INFO:Plotting – RooAbsReal::plotOn(model) plot on y integrates over variables (x)

so the problem has already been fixed in 5.24.

Wouter