I have some experimental data and simulated data of some beta decay. I want to find out a method to scale down the experimental data and stretch or shrink it so it will fit the simulated data, and getting the parameters that root used for this fit, something like:

Ah(ax+b),

where “A” would be the scaling factor, as in the Scale(); function and x the bins of the histogram, where “a” and “b” are some parameters. I have the idea of how this could be done with minimization in a mathematical sense, but I don’t know how to implement it in root.

I read it yesterday while searching the topic (now I know how to do the stretching so it’s great), but my questions was rather how to find the best parameters for the scaling and stretching apart from trial and error, like a minimization of the distance between the two histograms like

I guess, in general (when stretching/shrinking and scaling are needed), you would need to write your own “chi2” or “likelihood” function.
See: ${ROOTSYS}/tutorials/fit/

You could also try to use (but the involved histograms need to have well “aligned” bins, I guess):

It is important to have the simulated data and real data with same binning (otherwise it looks horrible). If you fit several histograms, it is also better to only allow a shift on the x Axis that is discrete like the bins