RooFit not fitting

Hi all-

This question is probably stupid and I am just off by a line or an option, but I cannot get this to work. All I am trying to do is fit an exponential using the RooDecay pdf. The code is copied and pasted below. I am trying to do this unbinned and it spits out that the value of tau is nan. If I fix it to 0.002 and just draw it to see how close I am, it’s right on top of the points. Am I missing an option to fitTo()? Thanks!


TFile *open =new TFile(“signalMC_masslifetime_allcuts1st.root”,“READ”);
TTree tree = (TTree) open->Get(“LifetimeInfo”);

RooRealVar truedecay(“truedecay”,“truedecay”,-0.005,0.02);

RooDataSet data(“data”,“data”,tree,truedecay);

RooTruthModel noRes(“noRes”,“Truth Model”,truedecay);

RooRealVar tau(“tau”,“lifetime”,0.002,0.02,0.1);
RooDecay decay(“decay”,“decaymodel”,truedecay,tau,noRes,RooDecay::SingleSided);



What your are doing looks fine code-wise at first glance. You have to be careful though
with the allowed range of the lifetime parameter: if in the course of the likelihood minimization you pass through tau=0 the p.d.f becomes a delta function and the likelihood would not be well defined for data points at t!=0 as the p.d.f. returns zero there. Even if the fitted value
of tau comes at >0, minuit may still walk through the tau=0 zero area when it is determining the error on tau (if you allow it to go to tau<=0).

Does the fit converge if you set the lower limit for tau at a very small, though non-zero value?