Hello,

I am trying to visualize a pdf in the same way you would visualize a histogram. I’ve got the point where I have made a pdf from my histogram, which includes some poisson constraining terms to account for the errors. I can draw my pdf and normalize it to the original histogram’s integral, so I get my pdf drawn with the correct “central values”, but now I want to visualize the errors (basically draw the +/- 1sigma bands for the underlying constraint terms of each bin). Does anyone know how I would do that?

My (simplified) code so far is below.

Thanks!

```
{
using namespace RooFit;
TH1D* h = new TH1D("h","h",2,0,2);
h->SetBinContent(1,2); h->SetBinContent(2,5);
h->SetBinError(1,1.1); h->SetBinError(2,3.3);
RooRealVar x("x","x",0,2);x.setBins(2);
//make nominal values function
RooDataHist d("d","d",RooArgList(x),h);
RooHistFunc nominals("f","f",x,d);
//create constraining terms
RooRealVar a1("a1","a1",1,-5,5);
RooRealVar a2("a2","a2",1,-5,5);
ParamHistFunc alphas("s","s",x,RooArgSet(a1,a2));
RooRealVar tau1("tau1","tau1",pow(2/1.1,2));
RooRealVar tau2("tau2","tau2",pow(5/3.3,2));
RooFormulaVar v1("v1","v1","a1*tau1",RooArgList(a1,tau1));
RooFormulaVar v2("v2","v2","a2*tau2",RooArgList(a2,tau2));
//poisson with the same relative error as the original histogram
RooPoisson c1("c1","c1",RooConst(pow(2/1.1,2)),a1);
RooPoisson c2("c2","c2",RooConst(pow(5/3.3,2)),a2);
RooProduct p("p","p",RooArgList(nominals,alphas));
//convert histfunc*constraintPars to a pdf
RooRealSumPdf m("m","m",RooArgList(p),RooArgList(RooConst(1)));
//form final pdf
RooProdPdf model("model","model",RooArgList(m,c1,c2));
RooPlot* f = x.frame();
model.plotOn(f,Normalization(h->Integral()));
f->Draw();
}
```