RooFit example : fraction and errors, segfault with python

Hi

I’ve several questions about the way a fit is done using RooFit with python …

I’ve joined a example of macro and a root file that contains Three histos : data, signal and background
With both signal and background, i’m creating a RooHistPdf and then i’m combinning them in an RooAddPdf that should fit my data histogram. i’ve associated to them a RooRealVar that is supposed to be the fraction of signal (fsig) and background (fbkg) in data so I’ve set these variable to be bound in [0,1] (is it correct ?)

My first question is do i have to normalized to one the data histogram ? (fisg and fbkg are always equal to one-the upper limit- if i’m not doing it). If i’m doing it, it looks good graphically but the fraction are really small, their sum is not equal to one and i can’t understand how am i supposed to interpret the errors bars.

Finally If i’m drawing anything with RooFits methods, it makes a segfault when i leave python interpreter and i don’t understand why.

I’m using ROOT 5.26.00

many thanks
jb
resu.root (4.77 KB)
RooTest.py (1.84 KB)

Hi,

to start of with your last question … it doesn’t segfault in trunk. It looks like the cleanup of the RooFit objects in v5.26 happens after the file has been closed. It segfault goes away by closing out the file explicitly at the end of the script: Data.Close() .

Cheers,
Wim