Building model in ROOFIT

Dear rooters,

I’m new in roofit classes so I’m sorry for (may be) stupid questions.
Let’s assume that my model is one-exponential decay:

``````  RooRealVar t("t","t",0,10) ;
RooRealVar tau1("tau1","tau1",0.150) ;
RooDecay dec_1("dec_1","decay",t,tau1,g_res,RooDecay::SingleSided) ;``````

where g_res is some resolution function

What are the easiest ways for

1. adding a constant (fixed) background Bg to model dec_1?
2. shifting decay model dec_1 along t-axis by time t_shift (i.e. my decay starts not in t=0, but in t=t_shift)?

Hi Dmitry,

for 1)

The easiest ways to add a background is to use a RooAddPdf,

``````RooPolynomial bkg("bkg","bkg",t) ;
RooRealVar frac("frac","frac",0.5,1) ;
``````

for 2)

``````The easiest way to do this is to absorb the shift as bias in your resolution gaussmodel,
e.g set the 'mean' parameter of you RooGaussModel not to zero but to 't_shift'
``````

Alternatively, here is a complete example constructing your p.d.f. using the workspace&factory (requires ROOT >= 5.24)

RooWorkspace w(“w”,kTRUE) ;
w.factory("SUM::model(frac[0.9,0,1]Decay::dec(t[0,10],tau[0.15],GaussModel::res(t,t_shift[1],sigma[0.2]),SingleSided),Polynomial::bkg(t))")
RooPlot
frame = w::t.frame() ;
w::model.plotOn(frame) ;
frame->Draw()

Wouter

It works but i can’t understand one moment in adding p.d.f.s with RooAddPdf object. Could you please clear it too?
I’d like to sum 3 exponential decays and a background provided that I set number of events in each component.
I make RooAddPdf object according to users manual:
where I1_c is a fraction of 1-st decay multiplied by number of all events in experiment and so on, bg is a fraction of background which may be extracted from experiment (mean number of background events for one temporal channel).
As a result I get also normalized (or it only seems to be normalized ?) function, but I need scaled model for fitting my data.
How do I do it?
As far as I understand all RooDecay are normalized on unity (i.e. their integral over all x axis is 1), but RooAddPdf can be done without such normalization?

Hi Dmitry,

If you make a RooAddPdf with 4 p.d.f.s and 3 coefficients, then it constructs
a unit-normalized p.d.f. as follows

M(x) = f1F1(x) + f2F2(x) + f3*F3(x) + (1-f1-f2-f3)*F4(x)

which is easily seen to be unit-normalized if F1-4 are and all coefficients
are in the range [0,1]. (When you draw such a p.d.f, on a frame with a dataset,
it is always automatically rescaled to match the number of events in that dataset)

If, on the other hand you define 4 p.d.f. and 4 coefficients, you define an
extended p.d, constructed as

M(x) = f1/fsumF1(x) + f2/fsumF2(x) + f3/fsumF3(x) + f4/fsum*F4(x)

where fsum=f1+f2+f3+f4 and an extended likelihood term is automatically
added to the fit with Nexp = f1+f2+f3+f4, so that f1-f4 --when fitted-- automatically
represent the event yields associated with the four p.d.f. components.

Wouter