I am working with root 5.34 on MacOSX Mavericks.
I am fitting a given data distribution using TFractionFitter to accomate the use of template histograms for the fit. In the example discussed here, I am using three templates to fit the data distribution in a given range. The signal contributions are quite obvious which should make the fit simple enough. I am not interested for the moment in any high quality of the fit as I know my templates are biased. I have posted all the related material in attachment.
When I plot the result of the fit, the sum of the 3 histogram pdfs shows a reasonnable fit (red curve). However, when I plot the individual template contributions (appropriately scaled by the results of the fit, at least I think…), I see a very unpleasant distortion of the first template (in black). It seems like some artificial content is added to the template to accomodate for a better fit. The issue doesn’t seem to come from the scaling and I’ve also observed the absence of this distortion for a slightly different data distribution. The level of distortion is certainly affected by the fitting range used for the integration but I don’t understand why there should be any distortion of the template in the first place. The fit should only act on some scaling of the input templates or not? The problem does not appear when using Roofit but the coding with TFractionFitter is somewhat easier for this simple exercise.
I have been looking for the bug in my code for a while now but failed to find an explanation. Surely the problem is on my side. If anyone had a hint for me, it would be very much appreciated! By the way, is the TFractionFitter class the appropriate tool for what I am doing?