Fit parameters

Good morning,
I have a macro that produces a lot of histograms: I use an array of canvases to fit and draw them, and I save these canvases to file. When the canvases are drawn interactively, the fit parameters are shown in the statistics box, while they’re not when I open my file. I use the command:
gStyle->SetOptFit(1101)

Could someone help me?
Thanks,
Daniel

I just tried to plot an histo, fit it, display the fit parameters, and save the result in a root file. When I draw the canvas saved in that file the fit parameters are displayed the same way they were before saving the canvas. Can you provide a small macro reproducing the problem ?

the macro I attached should do the same things of mine, even though mine is quite longer, so there could be other stuff that influence… Anyway, with this macro I don’t see the fit parameters in the file, but I don’t know if they are ever written, because for some reason the histo is not drawn interactively.

Thank you for your time,
Daniel
prova.C (919 Bytes)

The following version of your macro works.
prova.C (419 Bytes)

Thank you for your reply, but I still have a problem: as I have to draw a lot of histos, I have to create directories in my file and save different groups of histos in different directories. How can I do it with your method?

Basically the method is the same as yours. During my tests I simplified the saving in a file by using the Print method but important trick is :
canv->Update();
without this call the fits parameters were not saved.