Getting integral of fitted pdf

Dear Experts

  I want to get the integral of a fitted pdf. I was doing like

RooAbsReal *frac2 = pdfV.createIntegral(mass);

It returns value in fraction ~0.75. if it is over full range it should not be 1? If not then 75% of what?

If I want to get the number of events in RooDataSet (in a full and sub-range), how I can do it?

Thanks for your help


Hi Sunil,

If you want to calculate the fraction of a normalized pdf in a certain range in your
observable ‘mass’ you should do the following

mass.setRange(“signal”,lowVal,highVal) ;


RooAbsReal* fracInt = pdf.createIntegral(mass,mass,“signal”) ;

Note that in this invocation mass appears twice (once as spefication as normalization
observable and once as specification of integration observable). If you specify
the observable just once in createIntegral() your integrate a unnormalized pdf
expression, which you cannot interpret as a fraction.


Hi Wouter

Thanks for your reply. Is it possible to get integral of pdf in term of number of events instead of fraction. Is it correct to multiply this fraction with total number of events in data? Please suggest a way to calculate the number of events in subrange of RooDataSet.



Hi Sunil,

A pdf is always in terms of probabilities, not in terms of event counts. To get an event count you can multiply the total event count associated with that pdf with the fraction.

For dataset you can use

data->sumEntries(const char* cutSpec, const char* cutRange=0)



to find the number of tevents in that dataset that are in the named range “signal”.