Fitting histograms in the same canvas

I want to fit the same histogram with different function and draw them in the same canvas, but different pad. Every time, when I want to save this canvas into a ps file, the histogram in the last pad will overwrite all the previous ones.
This maybe need just one line to solve it , unfortunately, I don’t get it.
I attach my example, just run plotbsa.C and try to save the canvas into a ps file.
Thanks a lot,
Bo
histerror.C (2.53 KB)
bsa.root (5.28 KB)
plotbsa.C (2.1 KB)

When you fit the same histogram with 2 different functions, the second function will replace the first one in the list of functions of the histogram.
Make a copy of the histogram

//hbsa_eta->Fit("func2", "EMR"); TH1F *hbsa_eta_copy = (TH1F*)hbsa_eta->Clone(); hbsa_eta_copy->Fit("func2", "EMR");

Rene

It’s so fast. Thanks a lot.
Bo