Fit parameters saved to file

Dear all,

I fit a histogram (s1 below) and save it to a file. When I later open it in root, the fit is drawn on top of the histogram, but I can’t find a way to show parameters. Played with SetOptFit, could not find a way. Could you, please, tell me how I can show the parameters on the histogram plot

#include "TROOT.h"
#include "TFile.h"
#include "TH1F.h"
#include "TRandom.h"
#include "TStyle.h"

int main()
{
  TFile *outfile = new TFile("testfit.root","recreate");	//open output file 
  gStyle->SetOptFit(1);

  TH1F *s1     = new TH1F("s1","This is the first signal",100,-4,4);
  s1->SetStats(0);

  s1->SetFillColor(42);


  // Fill histograms randomly
  gRandom->SetSeed();
  Float_t xs1;
  for ( Int_t i=0; i<10000; i++) {
     xs1   = gRandom->Gaus(-0.5,0.5);
     s1->Fill(xs1,0.3);
  }

  s1->Fit("gaus");

  outfile->Write();
  outfile->Close();
}

Slava

Remove the line

In teh second session when viewing your histogram, do

or (samething) activate “Fit Parameters” in the canvas “Option” menu.

Rene