Dear Roofit expert I need your help.
I want to fit a very simple RooDecay times an efficiency function.
I can fit this dataset with a Root TF1 very well, but when I try with roofit I get a consistent bias in the time constant. Reading old threads I think the problem lies in an uncorrect normalization since I have point only starting from ct = 0.007.
This is a snipplet of my code:
auto ct = new RooRealVar("ct","ct [cm]",0.007,0.5);
auto ctau = new RooRealVar("ctau", "ctau", ctau_mc, 0.045, 0.055);
auto ctTruth = new RooTruthModel("ctTruth", "ctTruth", *ct);
auto ct_wReso = new RooDecay("ct_wReso","decay",*ct, *ctau, *ctTruth, RooDecay::SingleSided);
auto ctEffFunc = new RooFormulaVar("ctEffFunc","eff Model", "exp(@0+@1*ct)*ROOT::Math::Chebyshev4(BsCt2DMC,@2,@3,@4,@5,@6)", RooArgList(ctp0, ctp1, ctp2, ctp3, ctp4, ctp5, ctp6, *ct)); // Efficiency function fitted with Rooot
auto ctSigPdf = new RooEffProd("ctSigPdf","model with efficiency", *ct_wReso, *ctEffFunc);
// --- FIT
RooFitResult* fitRes = ctSigPdf->fitTo(*data,Save(),NumCPU(8));
I tried evrything, from adding a "number of events as
auto ctSigPdf = new RooEffProd("ctSigPdf","model with efficiency", *ct_wReso, *ctEffFunc);
auto nSig = new RooRealVar("nSig", "Number of Signal Events", 0.6*data->sumEntries(), 0.,1.5*data->sumEntries());
auto ctSigPdf_norm = new RooAddPdf("ctSigPdf_norm","ctSigPdf_norm", RooArgList(*ctSigPdf), RooArgList(*nSig));
To add a manual range as
RooFitResult* fitRes = ctSigPdf->fitTo(*data,Save(),NumCPU(8), Range(0.007,0.5));
The ctau fit value changes but nowere near the set value. The root fit:
TF1 *ctModel = new TF1("ctModel"," [8]*TMath::Exp(-x/[7])*(expo(0)*ROOT::Math::Chebyshev4(x,[2],[3],[4],[5],[6]))",0.007,0.5);
is spot on, so there is an issue with my RooFit model.
Can someone help me?
Thanks,
Alberto