# [RooFit] pdf integral

``````gSystem->Load("libRooFit.so");
using namespace RooFit;
RooRealVar x("x","x",-3,3);
RooRealVar m("m","m",0);
RooRealVar s("s","s",3) ;
RooGaussian g("g","g",x,m,s) ;
RooAbsReal* fracInt = g.createIntegral(x);
cout << fracInt->getVal() << endl;``````

With the above code, I expected I had the value of 0.683(1sigma).
But the output is 5.13375. Why is it 5.13375 not 0.683?

I have mailed your problem to Wouter Verkerke. I hope that he will

Rene

Hi,

This behavior is correct.

The createIntegral() function returns the intergral
of the unnormalized RooGaussian function and serves
primarily to calculate the normalization that you need
to use RooGaussian as a normalized probability densitity function.
So the number you get out depends a bit on the formula that
was put in RooGaussian, but can in general be anything.

In general RooFit p.d.f.s are only normalized when you explicitly request a normalization. This makes it possible to use (multi-dimensional) p.d.f with more than one choice of normalization.

You can actually calculate the answer that you expected or wanted to get out, e.g.

RooRealVar x(“x”,“x”,-20,20);
RooRealVar m(“m”,“m”,0);
RooRealVar s(“s”,“s”,3) ;
RooGaussian g(“g”,“g”,x,m,s) ;

x.setRange(“oneSigma”,-3,3) ;
RooAbsReal* fracInt = g.createIntegral(x,NormSet(x),Range(“cut”))

In this example fracInt is the integral of g over x over the range specified by “cut” where the p.d.f. g is normalized over x.

Wouter