Difficulties fitting a decay

Dear RooFitter

I’m trying to make a simple fit on a lifetime distribution using RooDecay as pdf. Inspired by [url]RooFit not fitting I did the following:

[code] const int nBins(50);

RooRealVar t("ctB0","measured lifetime B^{0}",.5e-12, 15e-12,"s");
RooTruthModel idealres("idealres","Ideal resolution model",t);

RooRealVar tau("tau","tau",1.525e-12,1e-12,5e-12,"s");
RooDecay decay("decay","decay",t,tau,idealres,RooDecay::SingleSided);

// Getting data from tree
RooDataSet data("data", "B^{0} lifetime dataset", t, RooFit::Import(*tree));

// Now do the fit
decay.fitTo(data);

fitresults.lifetime = tau.getVal();
fitresults.lifetimeE = tau.getError();

// Plotting
RooPlot* frame = t.frame(Title("Lifetime of B^{0}"));
data.plotOn(frame,RooFit::Binning(nBins));
decay.plotOn(frame,ProjWData(data,true));

frame->Draw();
gPad->SetLogy();

[/code]

Obviously I run into similar problems as the original poster years ago. When I run this code I end up with lots of warnings along the lines

[quote][#1] INFO:Minization – RooMinuit::optimizeConst: activating const optimization


** 13 **MIGRAD 500 1


FIRST CALL TO USER FUNCTION AT NEW START POINT, WITH IFLAG=4.
[#0] WARNING:Minization – RooFitGlue: Minimized function has error status.
Returning maximum FCN so far (-1e+30) to force MIGRAD to back out of this region. Error log follows
Parameter values: tau=1.525e-12
RooDecay::decay[ t=ct3dB0 tau=tau ]
getLogVal() top-level p.d.f evaluates to zero @ !convSet=(idealres_conv_exp(-@0/@1)ct3dB0_tau[decay] = 0/1.52492e-12), t=ct3dB0=-1.66661e-12, tau=tau=1.525e-12
getLogVal() top-level p.d.f evaluates to zero @ !convSet=(idealres_conv_exp(-@0/@1)ct3dB0_tau[decay] = 0/1.52492e-12), t=ct3dB0=-1.51636e-13, tau=tau=1.525e-12
getLogVal() top-level p.d.f evaluates to zero @ !convSet=(idealres_conv_exp(-@0/@1)ct3dB0_tau[decay] = 0/1.52492e-12), t=ct3dB0=-1.09021e-13, tau=tau=1.525e-12
[/quote]
and later on

[quote][#0] WARNING:Minization – RooFitGlue: Minimized function has error status.
Returning maximum FCN so far (-1e+30) to force MIGRAD to back out of this region. Error log follows
Parameter values: tau=2.05074e-12
RooDecay::decay[ t=ct3dB0 tau=tau ]
getLogVal() top-level p.d.f evaluates to zero @ !convSet=(idealres_conv_exp(-@0/@1)ct3dB0_tau[decay] = 0/2.04938e-12), t=ct3dB0=-1.66661e-12, tau=tau=2.05074e-12
[/quote]
and it ends with

[quote] MINUIT WARNING IN HESSE
============== Second derivative zero for parameter1
MNHESS FAILS AND WILL RETURN DIAGONAL MATRIX.
FCN=-1e+30 FROM HESSE STATUS=FAILED 3 CALLS 25 TOTAL
EDM=0 STRATEGY= 1 ERROR MATRIX UNCERTAINTY 100.0 per cent
EXT PARAMETER APPROXIMATE INTERNAL INTERNAL
NO. NAME VALUE ERROR STEP SIZE VALUE
1 tau 5.40706e-13 1.93709e-12 0.00000e+00 -4.00635e-01
ERR DEF= 0.5
EXTERNAL ERROR MATRIX. NDIM= 25 NPAR= 1 ERR DEF=0.5
5.299e-24
ERR MATRIX APPROXIMATE
[#1] INFO:Minization – RooMinuit::optimizeConst: deactivating const optimization
[/quote]

No surprise the fit result is far from what it should be. The start point is the ideal PDG value and the data used in the tree should match this. A simple crosscheck using the fit window of root does the job with the expected result.

I tried varying the start value and the limits of tau without any success.

Any help is appreciated.

Kind regards,

Frank

Just for the record: In reply to my own post because somebody touchbased with me on the solution and I found one (but forgot to post.

RooRealVar t("t3d", "t", tLo, tHi);
RooRealVar tau("tau","tau", tauTruthVal, 0e-12, tauTruthVal ); // some good start value
RooRealVar nsig("nsig","signal fraction", .5*curEntries,0.,curEntries*1.4); // curEntries obtained from TTree

// Model building
// -- decay
RooTruthModel idealres("idealres","Ideal resolution model",t);
RooDecay decay("decay", "decay", t, tau, idealres, RooDecay::SingleSided);

// final model
RooAddPdf model("model", "model", RooArgSet(decay), RooArgList(nsig));

// do the fit
model.fitTo(data);

So the change was in the line where I make RooAddPdf model(…). This adds a normalization factor and then the fit works fine.