I am trying to use RooFit for fitting a histogram (already weighted and sumw2() is used while filling). I do the following in my code:
- Fit a histogram (with in some range ) with a pdf “f1_Fit”
- Take this f1_Fit and generate a toy
- fit the toy with a different pdf “test_Fit”
Now at step-1 my fit get converge but I see that fitted function is always above the input histogram when I plot them(black dots and blue line once plotted from attached code). I tried varying fit parameter but of no help and it seems its just normalization issue as shapes looks quite similar.
The 2nd problem is at step-3. I make transfer from RooFit to TF1 object so that I could get the shape uncertainty in each bin using test_Fit->InegralError(…) method which I need for my study. But when I print the bin-by-bin value using Eval() method from this fit function I see that its nowhere near the input histogram values. I print them in same bin and at the bin center. Although I expected them to be a bit different due to above problem at step-1 but they look completely off. On the other hand the toy data and fit to it looks fine (green dot and green dashed line if one runs the attached script.).
I have attached the testFit.C and input root file here in case you would like to see it. I will appreciate any help on this.