Scale Histogram Functions Primitives

Draw multiple histograms with multiple fitting functions each, some with polymarkers, in the same window, everything normalized to the same constant.

Is there a simpler methodic complete way of doing this, other than going through the list of functions, finding what is the next class, scale each function/class with each own method?

thanks for the attention,

This could be implemented as an option in TH1::DrawNormalized.
It wil not happen in the short term.


Ok, I understand it is too specific…
But I also can’t find an easy way (one method) to scale a TF1 function (multiply by a constant or something). Is there any?

thank’s again,

This is precisely the point. For example if you fit with a gaussian, one should scale the first parameter, if one fits a polynomial, one has to recompute all parameters, etc.
Of course, we could store a normalization coefficient as a new data member, but with several side effects like problems when setting the minimum/maximum of the function.
A possible implementation (as I indicated above) is to implement this possibility only
when calling TH1::DrawNormalized. In this case one does not need to store a normalization
coefficient, just need to pass the info to the drawing functions that will multiply the function value by the normalization coefficient.


Ok, now I understand the “ROOT” :slight_smile: of this little problem.
Thank you Rene.
By the way, the workaround I fell for now was to replace the formula with the “formula * Const”, and then I fix Const to the norm.


I am trying to overlay histograms normalized to 1. To normalize them, I have done:
temphist = (TH1F*)fFile->Get(hName.Data());
if temphist->Integral!=0
hist = (TH1F*)temphist->DrawNormalized();

it will now only draw one hist per pad and the rest disappear.

I do not understand your point. With your code snippet, you should have two identical histograms drawn in the same pad. To check it, just do gPad->ls()