Fitting histogram with TF1 multiple times

Hi Experts,

I have to fit same histogram with different functions. Different function in the sense, the function is fixed but the parameter values are different. There are 4 parameters to the function and there are around 2000 values for each parameter stored in the tree. How can i fit 2000 times to the same histogram where all the 2000 fit should be visible in the histogram.

I hope what i want to ask is clear. I am attaching the root file where all the parameter values are stored and another root file which consist the histogram. I am attaching the code too where i was trying to do the multifit, but i couldn’t do.

Please help me solving this.

Thanks
Priyanka

eff_band.cpp (2.5 KB)
eff_var.root (7.5 KB)
parametr_eff_syst_2sigma_ch1.root (69.4 KB)

I think @moneta can help you.

Hi,
Have you tried to use the option + ?
This will allow you to store all the fitting functions in the histograms.
If it does not work, please let me know

Cheers

Lorenzo

Hi,

Thanks for your reply. I have tried using R+ before. I could do the fitting with multiple function when all the functions are different. But here specifically my problem is, function parameters need to vary 2000 times. It shows “Error in : function function has illegal number of parameters = 0” when i run the code. (code attached)

Thanks
Priyanka
eff_band.cpp (2.5 KB)

See how to do the fits, in particular with “user-defined functions” and more info in the links included:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.